Skip to content

Commit 4e6f698

Browse files
committed
Revert "Merge pull request kvspb#199 from AVENTER-UG/issue_180"
This reverts commit bf64cf2, reversing changes made to f022103. This change isn't right -- it an LDAP setup when `group_attribute_is_dn on` is enabled, which is what this section of code (kvspb@bf64cf2#diff-c05c0daefb48996cbf510b81002b49bcR2230) is conditionally targeting. This original PR kvspb#199 changed the underlying LDAP query (eg `user_val`) from looking up the user's DN as a group attribute in LDAP (eg set via the `group_attribute` directive in nginx) to looking up the _group's_ DN, which isn't right and won't work. This PR reverts the previous change to make this work correctly again. Fwiw, the originally-referenced issue kvspb#180 seems to be a completely different issue, relating to escaping and parentheses.
1 parent bf64cf2 commit 4e6f698

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ngx_http_auth_ldap_module.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,7 +2216,6 @@ ngx_http_auth_ldap_check_group(ngx_http_request_t *r, ngx_http_auth_ldap_ctx_t *
22162216
ngx_memcpy(gr, val.data, val.len);
22172217
gr[val.len] = '\0';
22182218
tail_gr = ngx_strchr(gr, ',');
2219-
22202219
if (tail_gr == NULL) {
22212220
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "http_auth_ldap: Incorrect group DN: \"%s\"", gr);
22222221
ctx->outcome = OUTCOME_ERROR;
@@ -2230,9 +2229,9 @@ ngx_http_auth_ldap_check_group(ngx_http_request_t *r, ngx_http_auth_ldap_ctx_t *
22302229
if (ctx->server->group_attribute_dn == 1) {
22312230
user_val = ngx_pcalloc(
22322231
r->pool,
2233-
ctx->dn.len + 1);
2234-
ngx_memcpy(user_val, ctx->dn.data, ctx->dn.len);
2235-
user_val[ctx->dn.len] = '\0';
2232+
ctx->user_dn.len + 1);
2233+
ngx_memcpy(user_val, ctx->user_dn.data, ctx->user_dn.len);
2234+
user_val[ctx->user_dn.len] = '\0';
22362235
} else {
22372236
user_val = ngx_pcalloc(
22382237
r->pool,

0 commit comments

Comments
 (0)