Skip to content

Commit ba83956

Browse files
bugfix: fix the compatibility issues.
1 parent 39ffaf1 commit ba83956

File tree

5 files changed

+35
-232
lines changed

5 files changed

+35
-232
lines changed

src/ngx_stream_lua_module.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@
3030
#include "ngx_stream_lua_semaphore.h"
3131
#include "ngx_stream_lua_ssl_client_helloby.h"
3232
#include "ngx_stream_lua_ssl_certby.h"
33-
34-
#ifdef HAVE_PROXY_SSL_PATCH
3533
#include "ngx_stream_lua_proxy_ssl_verifyby.h"
36-
#endif
37-
3834

3935
#include "ngx_stream_lua_prereadby.h"
4036

4137

38+
#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER > 0x101010afL
39+
#define HAVE_SSL_KEY_LOG 1
40+
#endif
41+
42+
4243
static void *ngx_stream_lua_create_main_conf(ngx_conf_t *cf);
4344
static char *ngx_stream_lua_init_main_conf(ngx_conf_t *cf, void *conf);
4445
static void *ngx_stream_lua_create_srv_conf(ngx_conf_t *cf);
@@ -53,11 +54,13 @@ static char *ngx_stream_lua_lowat_check(ngx_conf_t *cf, void *post, void *data);
5354
#if (NGX_STREAM_SSL)
5455
static ngx_int_t ngx_stream_lua_set_ssl(ngx_conf_t *cf,
5556
ngx_stream_lua_loc_conf_t *llcf);
57+
#ifdef HAVE_SSL_KEY_LOG
5658
static void key_log_callback(const ngx_ssl_conn_t *ssl_conn,
5759
const char *line);
5860
static void ngx_stream_lua_ssl_cleanup_key_log(void *data);
5961
static ngx_int_t ngx_stream_lua_ssl_key_log(ngx_conf_t *cf, ngx_ssl_t *ssl,
6062
ngx_str_t *file);
63+
#endif
6164
#if (nginx_version >= 1019004)
6265
static char *ngx_stream_lua_ssl_conf_command_check(ngx_conf_t *cf, void *post,
6366
void *data);
@@ -426,7 +429,7 @@ static ngx_command_t ngx_stream_lua_cmds[] = {
426429
0,
427430
(void *) ngx_stream_lua_ssl_cert_handler_file },
428431

429-
#ifdef HAVE_PROXY_SSL_PATCH
432+
#if HAVE_LUA_PROXY_SSL_VERIFY
430433
/* same context as proxy_pass directive */
431434
{ ngx_string("proxy_ssl_verify_by_lua_block"),
432435
NGX_STREAM_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
@@ -1021,7 +1024,6 @@ ngx_stream_lua_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
10211024

10221025
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
10231026
"DEFAULT");
1024-
10251027
ngx_conf_merge_uint_value(conf->ssl_verify_depth,
10261028
prev->ssl_verify_depth, 1);
10271029
ngx_conf_merge_ptr_value(conf->ssl_certificates,
@@ -1037,7 +1039,7 @@ ngx_stream_lua_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
10371039
NULL);
10381040
#endif
10391041

1040-
#ifdef HAVE_PROXY_SSL_PATCH
1042+
#if HAVE_LUA_PROXY_SSL_VERIFY
10411043
if (conf->ups.proxy_ssl_verify_src.len == 0) {
10421044
conf->ups.proxy_ssl_verify_src = prev->ups.proxy_ssl_verify_src;
10431045
conf->ups.proxy_ssl_verify_handler = prev->ups.proxy_ssl_verify_handler;
@@ -1179,11 +1181,13 @@ ngx_stream_lua_set_ssl(ngx_conf_t *cf, ngx_stream_lua_srv_conf_t *lscf)
11791181
return NGX_ERROR;
11801182
}
11811183

1184+
#ifdef HAVE_SSL_KEY_LOG
11821185
if (ngx_stream_lua_ssl_key_log(cf, lscf->ssl, &lscf->ssl_key_log)
11831186
!= NGX_OK)
11841187
{
11851188
return NGX_ERROR;
11861189
}
1190+
#endif
11871191

11881192
#if (nginx_version >= 1019004)
11891193
if (ngx_ssl_conf_commands(cf, lscf->ssl, lscf->ssl_conf_commands)
@@ -1197,6 +1201,7 @@ ngx_stream_lua_set_ssl(ngx_conf_t *cf, ngx_stream_lua_srv_conf_t *lscf)
11971201
}
11981202

11991203

1204+
#ifdef HAVE_SSL_KEY_LOG
12001205
static void
12011206
key_log_callback(const ngx_ssl_conn_t *ssl_conn, const char *line)
12021207
{
@@ -1290,6 +1295,7 @@ ngx_stream_lua_ssl_key_log(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *file)
12901295

12911296
return NGX_OK;
12921297
}
1298+
#endif
12931299

12941300

12951301
#if (nginx_version >= 1019004)

0 commit comments

Comments
 (0)