diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-01-02 23:37:25 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-01-02 23:37:25 +0000 |
| commit | ebf2bbc31027f579a7bf6ba9664da897779fefc5 (patch) | |
| tree | 2f21d1e2f53261bfcd9c378f1f5bd4a8071e4402 /src/event/ngx_event_openssl.c | |
| parent | 7504a40130c73763fc5dce8c8e1827ff15c4773c (diff) | |
| download | nginx-ebf2bbc31027f579a7bf6ba9664da897779fefc5.tar.gz nginx-ebf2bbc31027f579a7bf6ba9664da897779fefc5.tar.bz2 | |
ngx_ssl_get_server_conf()
Diffstat (limited to 'src/event/ngx_event_openssl.c')
| -rw-r--r-- | src/event/ngx_event_openssl.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 2c6d44595..c5389e3e1 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -84,7 +84,8 @@ static long ngx_ssl_protocols[] = { }; -int ngx_connection_index; +int ngx_ssl_connection_index; +int ngx_ssl_server_conf_index; ngx_int_t @@ -101,19 +102,27 @@ ngx_ssl_init(ngx_log_t *log) ENGINE_load_builtin_engines(); #endif - ngx_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL); + ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL); - if (ngx_connection_index == -1) { + if (ngx_ssl_connection_index == -1) { ngx_ssl_error(NGX_LOG_ALERT, log, 0, "SSL_get_ex_new_index() failed"); return NGX_ERROR; } + ngx_ssl_server_conf_index = SSL_CTX_get_ex_new_index(0, NULL, NULL, NULL, + NULL); + if (ngx_ssl_server_conf_index == -1) { + ngx_ssl_error(NGX_LOG_ALERT, log, 0, + "SSL_CTX_get_ex_new_index() failed"); + return NGX_ERROR; + } + return NGX_OK; } ngx_int_t -ngx_ssl_create(ngx_ssl_t *ssl, ngx_uint_t protocols) +ngx_ssl_create(ngx_ssl_t *ssl, ngx_uint_t protocols, void *data) { ssl->ctx = SSL_CTX_new(SSLv23_method()); @@ -122,6 +131,12 @@ ngx_ssl_create(ngx_ssl_t *ssl, ngx_uint_t protocols) return NGX_ERROR; } + if (SSL_CTX_set_ex_data(ssl->ctx, ngx_ssl_server_conf_index, data) == 0) { + ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, + "SSL_CTX_set_ex_data() failed"); + return NGX_ERROR; + } + /* client side options */ SSL_CTX_set_options(ssl->ctx, SSL_OP_MICROSOFT_SESS_ID_BUG); @@ -336,7 +351,7 @@ ngx_ssl_create_connection(ngx_ssl_t *ssl, ngx_connection_t *c, ngx_uint_t flags) SSL_set_accept_state(sc->connection); } - if (SSL_set_ex_data(sc->connection, ngx_connection_index, c) == 0) { + if (SSL_set_ex_data(sc->connection, ngx_ssl_connection_index, c) == 0) { ngx_ssl_error(NGX_LOG_ALERT, c->log, 0, "SSL_set_ex_data() failed"); return NGX_ERROR; } |
