Skip to content

Commit 2dad166

Browse files
bugfix: failed to build with openssl < 3.0.2.
1 parent c67e11b commit 2dad166

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/ngx_stream_lua_proxy_ssl_verifyby.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
#include "ngx_stream_lua_proxy_ssl_verifyby.h"
2323

2424

25+
#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x30000020uL)
2526
static void ngx_stream_lua_proxy_ssl_verify_done(void *data);
2627
static void ngx_stream_lua_proxy_ssl_verify_aborted(void *data);
28+
#endif
2729
static ngx_int_t ngx_stream_lua_proxy_ssl_verify_by_chunk(lua_State *L,
2830
ngx_stream_lua_request_t *r);
2931

@@ -82,7 +84,7 @@ ngx_stream_lua_proxy_ssl_verify_set_callback(ngx_conf_t *cf)
8284
return NGX_ERROR;
8385
}
8486

85-
#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \
87+
#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \
8688
|| OPENSSL_VERSION_NUMBER < 0x30000020L)
8789

8890
ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "OpenSSL too old to support "
@@ -184,8 +186,8 @@ ngx_stream_lua_proxy_ssl_verify_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
184186

185187
#else
186188

187-
#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \
188-
|| OPENSSL_VERSION_NUMBER < 0x30000020L)
189+
#if !defined(SSL_ERROR_WANT_RETRY_VERIFY) \
190+
|| (OPENSSL_VERSION_NUMBER < 0x30000020L)
189191

190192
/* SSL_set_retry_verify() was added in OpenSSL 3.0.2 */
191193
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
@@ -289,6 +291,13 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg)
289291

290292
return 1;
291293

294+
#elif defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER < 0x30000020uL)
295+
296+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
297+
"OpenSSL(< 3.0.2) does not support by proxy_ssl_verify_by_lua*");
298+
299+
return 1;
300+
292301
#else
293302

294303
lua_State *L;
@@ -397,7 +406,8 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg)
397406

398407
ngx_log_debug2(NGX_LOG_DEBUG_STREAM, c->log, 0,
399408
"proxy_ssl_verify_by_lua: handler return value: %i, "
400-
"cert verify callback exit code: %d", rc, cctx->exit_code);
409+
"cert verify callback exit code: %d",
410+
rc, cctx->exit_code);
401411

402412
c->log->action = "proxy pass SSL handshaking";
403413
return cctx->exit_code;
@@ -441,6 +451,7 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg)
441451
}
442452

443453

454+
#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x30000020uL)
444455
static void
445456
ngx_stream_lua_proxy_ssl_verify_done(void *data)
446457
{
@@ -500,6 +511,7 @@ ngx_stream_lua_proxy_ssl_verify_aborted(void *data)
500511
cctx->pool = NULL;
501512
}
502513
}
514+
#endif
503515

504516

505517
static ngx_int_t

src/ngx_stream_lua_proxy_ssl_verifyby.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#if (NGX_STREAM_SSL)
1313
#ifdef HAVE_PROXY_SSL_PATCH
1414

15-
/* do not introduce ngx_stream_proxy_module to pollute ngx_stream_lua_module.c */
15+
/* do not introduce ngx_stream_proxy_module
16+
* to pollute ngx_stream_lua_module.c
17+
*/
1618
extern ngx_module_t ngx_stream_proxy_module;
1719

1820
ngx_int_t ngx_stream_lua_proxy_ssl_verify_handler_inline(

0 commit comments

Comments
 (0)