Blame SOURCES/0124-PROXY-Use-right-name-in-ldap-filter.patch

b2d430
From d2636b0f34d6e4ff7cf99a44db8317fd485a3783 Mon Sep 17 00:00:00 2001
b2d430
From: Lukas Slebodnik <lslebodn@redhat.com>
b2d430
Date: Fri, 26 Aug 2016 14:57:22 +0200
b2d430
Subject: [PATCH 124/126] PROXY: Use right name in ldap filter
b2d430
b2d430
We used internal fq name in ldap filter
b2d430
with id_provider proxy to files and auth provider
b2d430
ldap
b2d430
b2d430
[sssd[be[LDAP]]] [sdap_get_generic_ext_step]
b2d430
    (0x0400): calling ldap_search_ext with
b2d430
    [(&(uid=testuser1@ldap)(objectclass=posixAccount))][dc=example,dc=com].
b2d430
b2d430
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
b2d430
---
b2d430
 src/providers/ldap/ldap_auth.c | 11 ++++++++---
b2d430
 1 file changed, 8 insertions(+), 3 deletions(-)
b2d430
b2d430
diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
b2d430
index 35f16b0d4a6f8e566b0cf63b65ba46f31e7c1bcd..00d38284e428eea42254820fd08ee4fb125235a6 100644
b2d430
--- a/src/providers/ldap/ldap_auth.c
b2d430
+++ b/src/providers/ldap/ldap_auth.c
b2d430
@@ -361,7 +361,7 @@ shadow_fail:
b2d430
 
b2d430
 /* ==Get-User-DN========================================================== */
b2d430
 struct get_user_dn_state {
b2d430
-    const char *username;
b2d430
+    char *username;
b2d430
 
b2d430
     char *orig_dn;
b2d430
 };
b2d430
@@ -386,9 +386,14 @@ static struct tevent_req *get_user_dn_send(TALLOC_CTX *memctx,
b2d430
     req = tevent_req_create(memctx, &state, struct get_user_dn_state);
b2d430
     if (!req) return NULL;
b2d430
 
b2d430
-    state->username = username;
b2d430
+    ret = sss_parse_internal_fqname(state, username,
b2d430
+                                    &state->username, NULL);
b2d430
+    if (ret != EOK) {
b2d430
+        DEBUG(SSSDBG_OP_FAILURE, "Cannot parse %s\n", username);
b2d430
+        goto done;
b2d430
+    }
b2d430
 
b2d430
-    ret = sss_filter_sanitize(state, username, &clean_name);
b2d430
+    ret = sss_filter_sanitize(state, state->username, &clean_name);
b2d430
     if (ret != EOK) {
b2d430
         goto done;
b2d430
     }
b2d430
-- 
b2d430
2.4.11
b2d430