mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 12:44:45 +02:00
Merge pull request #5424 from anhu/curl_ftps_fix
This commit is contained in:
@@ -5654,6 +5654,15 @@ then
|
|||||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_CERT_CHAINS"
|
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_CERT_CHAINS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x$ENABLED_SESSION_TICKET" = "xno"
|
||||||
|
then
|
||||||
|
ENABLED_SESSION_TICKET="yes"
|
||||||
|
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FTPS server requires pointer to session cache
|
||||||
|
AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE_REF"
|
||||||
|
|
||||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
|
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
37
src/ssl.c
37
src/ssl.c
@@ -10037,35 +10037,36 @@ WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl)
|
|||||||
/* On the client side we want to return a persistant reference for
|
/* On the client side we want to return a persistant reference for
|
||||||
* backwards compatibility. */
|
* backwards compatibility. */
|
||||||
#ifndef NO_CLIENT_CACHE
|
#ifndef NO_CLIENT_CACHE
|
||||||
if (ssl->clientSession)
|
if (ssl->clientSession) {
|
||||||
return (WOLFSSL_SESSION*)ssl->clientSession;
|
return (WOLFSSL_SESSION*)ssl->clientSession;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
/* Try to add a ClientCache entry to associate with the current
|
/* Try to add a ClientCache entry to associate with the current
|
||||||
* session. Ignore any session cache options. */
|
* session. Ignore any session cache options. */
|
||||||
int error;
|
int err;
|
||||||
const byte* id = NULL;
|
const byte* id = ssl->session->sessionID;
|
||||||
byte idSz = 0;
|
byte idSz = ssl->session->sessionIDSz;
|
||||||
id = ssl->session->sessionID;
|
|
||||||
idSz = ssl->session->sessionIDSz;
|
|
||||||
if (ssl->session->haveAltSessionID) {
|
if (ssl->session->haveAltSessionID) {
|
||||||
id = ssl->session->altSessionID;
|
id = ssl->session->altSessionID;
|
||||||
idSz = ID_LEN;
|
idSz = ID_LEN;
|
||||||
}
|
}
|
||||||
error = AddSessionToCache(ssl->ctx, ssl->session, id, idSz,
|
err = AddSessionToCache(ssl->ctx, ssl->session, id, idSz,
|
||||||
NULL, ssl->session->side,
|
NULL, ssl->session->side,
|
||||||
#ifdef HAVE_SESSION_TICKET
|
#ifdef HAVE_SESSION_TICKET
|
||||||
ssl->session->ticketLen > 0,
|
ssl->session->ticketLen > 0,
|
||||||
#else
|
#else
|
||||||
0,
|
0,
|
||||||
#endif
|
#endif
|
||||||
&ssl->clientSession);
|
&ssl->clientSession);
|
||||||
if (error == 0)
|
if (err == 0) {
|
||||||
return (WOLFSSL_SESSION*)ssl->clientSession;
|
return (WOLFSSL_SESSION*)ssl->clientSession;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
return ssl->session;
|
return ssl->session;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13633,13 +13634,17 @@ int AddSessionToCache(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* addSession,
|
|||||||
(void)useTicket;
|
(void)useTicket;
|
||||||
(void)clientCacheEntry;
|
(void)clientCacheEntry;
|
||||||
|
|
||||||
addSession = ClientSessionToSession(addSession);
|
if (idSz == 0) {
|
||||||
|
WOLFSSL_MSG("AddSessionToCache idSz == 0");
|
||||||
if (addSession == NULL || idSz == 0) {
|
|
||||||
WOLFSSL_MSG("addSession NULL or idSz == 0");
|
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSession = ClientSessionToSession(addSession);
|
||||||
|
if (addSession == NULL) {
|
||||||
|
WOLFSSL_MSG("AddSessionToCache is NULL");
|
||||||
|
return MEMORY_E;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find a position for the new session in cache and use that */
|
/* Find a position for the new session in cache and use that */
|
||||||
#ifdef HAVE_SESSION_TICKET
|
#ifdef HAVE_SESSION_TICKET
|
||||||
ticLen = addSession->ticketLen;
|
ticLen = addSession->ticketLen;
|
||||||
|
Reference in New Issue
Block a user