r22646: segfault fix in idmap_ldap.c from 3_0_25
authorSimo Sorce <idra@samba.org>
Thu, 3 May 2007 12:28:25 +0000 (12:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:52 +0000 (12:19 -0500)
(This used to be commit 565d7d0b18f18ba11f186667df95bc608a179efa)

source3/nsswitch/idmap_ldap.c

index 2fb9a17d3f51635b8f1f8b3828350ddca18dbddf..45d2b344afa7fb7660cc92948ce1fad6e40a2ca4 100644 (file)
@@ -80,11 +80,17 @@ static NTSTATUS get_credentials( TALLOC_CTX *mem_ctx,
        tmp = lp_parm_const_string(-1, config_option, "ldap_user_dn", NULL);
 
        if ( tmp ) {
-               secret = idmap_fetch_secret("ldap", false, dom->name, tmp);
+               if (!dom) {
+                       /* only the alloc backend is allowed to pass in a NULL dom */
+                       secret = idmap_fetch_secret("ldap", true, NULL, tmp);
+               } else {
+                       secret = idmap_fetch_secret("ldap", false, dom->name, tmp);
+               } 
+
                if (!secret) {
                        DEBUG(0, ("get_credentials: Unable to fetch "
                                  "auth credentials for %s in %s\n",
-                                 tmp, dom->name));
+                                 tmp, (dom==NULL)?"ALLOC":dom->name));
                        ret = NT_STATUS_ACCESS_DENIED;
                        goto done;
                }