* This callback function is executed by OpenSSL whenever a new SSL_SESSION is * added to the internal OpenSSL session cache. We use this hook to spread the * SSL_SESSION also to the inter-process disk-cache to make share it with our * other Apache pre-forked server processes. */
| 1901 | * other Apache pre-forked server processes. |
| 1902 | */ |
| 1903 | int ssl_callback_NewSessionCacheEntry(SSL *ssl, SSL_SESSION *session) |
| 1904 | { |
| 1905 | /* Get Apache context back through OpenSSL context */ |
| 1906 | conn_rec *conn = (conn_rec *)SSL_get_app_data(ssl); |
| 1907 | server_rec *s = mySrvFromConn(conn); |
| 1908 | SSLSrvConfigRec *sc = mySrvConfig(s); |
| 1909 | long timeout = sc->session_cache_timeout; |
| 1910 | BOOL rc; |
| 1911 | IDCONST unsigned char *id; |
| 1912 | unsigned int idlen; |
| 1913 | |
| 1914 | /* |
| 1915 | * Set the timeout also for the internal OpenSSL cache, because this way |
| 1916 | * our inter-process cache is consulted only when it's really necessary. |
| 1917 | */ |
| 1918 | SSL_set_timeout(session, timeout); |
| 1919 | |
| 1920 | /* |
| 1921 | * Store the SSL_SESSION in the inter-process cache with the |
| 1922 | * same expire time, so it expires automatically there, too. |
| 1923 | */ |
| 1924 | #ifdef OPENSSL_NO_SSL_INTERN |
| 1925 | id = (unsigned char *)SSL_SESSION_get_id(session, &idlen); |
| 1926 | #else |
| 1927 | id = session->session_id; |
| 1928 | idlen = session->session_id_length; |
| 1929 | #endif |
| 1930 | |
| 1931 | rc = ssl_scache_store(s, id, idlen, |
| 1932 | apr_time_from_sec(SSL_SESSION_get_time(session) |
| 1933 | + timeout), |
| 1934 | session, conn->pool); |
| 1935 | |
| 1936 | ssl_session_log(s, "SET", id, idlen, |
| 1937 | rc == TRUE ? "OK" : "BAD", |
| 1938 | "caching", timeout); |
| 1939 | |
| 1940 | /* |
| 1941 | * return 0 which means to OpenSSL that the session is still |
| 1942 | * valid and was not freed by us with SSL_SESSION_free(). |
| 1943 | */ |
| 1944 | return 0; |
| 1945 | } |
| 1946 | |
| 1947 | /* |
| 1948 | * This callback function is executed by OpenSSL whenever a |
nothing calls this directly
no test coverage detected