Fix certificate deletion for array type certificates
Previously, the certificate deletion only handled string type certificates, causing issues when certificates were specified as an array in the configuration. Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
parent
d67d350142
commit
3621352278
1 changed files with 22 additions and 5 deletions
|
@ -1908,9 +1908,9 @@ nxt_controller_process_cert_save(nxt_task_t *task, nxt_port_recv_msg_t *msg,
|
|||
static nxt_bool_t
|
||||
nxt_controller_cert_in_use(nxt_str_t *name)
|
||||
{
|
||||
uint32_t next;
|
||||
uint32_t i, n, next;
|
||||
nxt_str_t str;
|
||||
nxt_conf_value_t *listeners, *listener, *value;
|
||||
nxt_conf_value_t *listeners, *listener, *value, *element;
|
||||
|
||||
static const nxt_str_t listeners_path = nxt_string("/listeners");
|
||||
static const nxt_str_t certificate_path = nxt_string("/tls/certificate");
|
||||
|
@ -1931,6 +1931,22 @@ nxt_controller_cert_in_use(nxt_str_t *name)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (nxt_conf_type(value) == NXT_CONF_ARRAY) {
|
||||
n = nxt_conf_array_elements_count(value);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
element = nxt_conf_get_array_element(value, i);
|
||||
|
||||
nxt_conf_get_string(element, &str);
|
||||
|
||||
if (nxt_strstr_eq(&str, name)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* NXT_CONF_STRING */
|
||||
|
||||
nxt_conf_get_string(value, &str);
|
||||
|
||||
if (nxt_strstr_eq(&str, name)) {
|
||||
|
@ -1938,6 +1954,7 @@ nxt_controller_cert_in_use(nxt_str_t *name)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue