From c2c3d5ea49191275da680b5e86108d6ad49b0aef Mon Sep 17 00:00:00 2001 From: Valery Komarov Date: Wed, 16 Nov 2011 13:25:35 +0300 Subject: [PATCH] fix Issue 8 --- ngx_http_auth_ldap_module.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ngx_http_auth_ldap_module.c b/ngx_http_auth_ldap_module.c index b06d4d7..6cdb782 100644 --- a/ngx_http_auth_ldap_module.c +++ b/ngx_http_auth_ldap_module.c @@ -359,7 +359,7 @@ static ngx_int_t ngx_http_auth_ldap_handler(ngx_http_request_t *r) { ctx = ngx_http_get_module_ctx(r, ngx_http_auth_ldap_module); if (ctx) { - return ngx_http_auth_ldap_authenticate(r, ctx, &ctx->passwd, alcf); + return ngx_http_auth_ldap_authenticate(r, ctx, &ctx->passwd, alcf); } rc = ngx_http_auth_basic_user(r); @@ -437,6 +437,11 @@ static ngx_int_t ngx_http_auth_ldap_authenticate(ngx_http_request_t *r, ngx_http return NGX_HTTP_INTERNAL_SERVER_ERROR; } + if (uinfo->password.len == 0) + { + return ngx_http_auth_ldap_set_realm(r, &conf->realm); + } + /// Set LDAP version to 3 and set connection timeout. ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &version); ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeOut);