aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_secure_link_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2021-05-06 02:22:03 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2021-05-06 02:22:03 +0300
commit4faa84085379346fa1cf322907a1f9b6a7fbd583 (patch)
treeb71229d98bdc04e6224cd9d9a420275f64bee984 /src/http/modules/ngx_http_secure_link_module.c
parentf02e2a734ef472f0dcf83ab2e8ce96d1acead8a5 (diff)
downloadnginx-4faa84085379346fa1cf322907a1f9b6a7fbd583.tar.gz
nginx-4faa84085379346fa1cf322907a1f9b6a7fbd583.zip
Changed complex value slots to use NGX_CONF_UNSET_PTR.
With this change, it is now possible to use ngx_conf_merge_ptr_value() to merge complex values. This change follows much earlier changes in ngx_conf_merge_ptr_value() and ngx_conf_set_str_array_slot() in 1452:cd586e963db0 (0.6.10) and 1701:40d004d95d88 (0.6.22), and the change in ngx_conf_set_keyval_slot() (7728:485dba3e2a01, 1.19.4). To preserve compatibility with existing 3rd party modules, both NULL and NGX_CONF_UNSET_PTR are accepted for now.
Diffstat (limited to 'src/http/modules/ngx_http_secure_link_module.c')
-rw-r--r--src/http/modules/ngx_http_secure_link_module.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/http/modules/ngx_http_secure_link_module.c b/src/http/modules/ngx_http_secure_link_module.c
index 536e09a72..4d4ce6af1 100644
--- a/src/http/modules/ngx_http_secure_link_module.c
+++ b/src/http/modules/ngx_http_secure_link_module.c
@@ -302,11 +302,12 @@ ngx_http_secure_link_create_conf(ngx_conf_t *cf)
/*
* set by ngx_pcalloc():
*
- * conf->variable = NULL;
- * conf->md5 = NULL;
* conf->secret = { 0, NULL };
*/
+ conf->variable = NGX_CONF_UNSET_PTR;
+ conf->md5 = NGX_CONF_UNSET_PTR;
+
return conf;
}
@@ -318,6 +319,9 @@ ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_secure_link_conf_t *conf = child;
if (conf->secret.data) {
+ ngx_conf_init_ptr_value(conf->variable, NULL);
+ ngx_conf_init_ptr_value(conf->md5, NULL);
+
if (conf->variable || conf->md5) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"\"secure_link_secret\" cannot be mixed with "
@@ -328,13 +332,8 @@ ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_OK;
}
- if (conf->variable == NULL) {
- conf->variable = prev->variable;
- }
-
- if (conf->md5 == NULL) {
- conf->md5 = prev->md5;
- }
+ ngx_conf_merge_ptr_value(conf->variable, prev->variable, NULL);
+ ngx_conf_merge_ptr_value(conf->md5, prev->md5, NULL);
if (conf->variable == NULL && conf->md5 == NULL) {
conf->secret = prev->secret;