Require alcf->server array to be non-empty before using it

main
Rinat Ibragimov 8 years ago
parent b809421604
commit d516b0dd41
  1. 7
      ngx_http_auth_ldap_module.c

@ -1756,6 +1756,13 @@ ngx_http_auth_ldap_handler(ngx_http_request_t *r)
return NGX_DECLINED; return NGX_DECLINED;
} }
if (alcf->servers == NULL || alcf->servers->nelts == 0) {
/* No LDAP servers for the location. */
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "http_auth_ldap: \"auth_ldap\" requires "
"one or more \"auth_ldap_servers\" in the same location");
return ngx_http_auth_ldap_set_realm(r, &alcf->realm);
}
ctx = ngx_http_get_module_ctx(r, ngx_http_auth_ldap_module); ctx = ngx_http_get_module_ctx(r, ngx_http_auth_ldap_module);
if (ctx == NULL) { if (ctx == NULL) {
rc = ngx_http_auth_basic_user(r); rc = ngx_http_auth_basic_user(r);

Loading…
Cancel
Save