Merge from Samba 3.0:
authorTim Potter <tpot@samba.org>
Mon, 15 Sep 2003 05:03:11 +0000 (05:03 +0000)
committerTim Potter <tpot@samba.org>
Mon, 15 Sep 2003 05:03:11 +0000 (05:03 +0000)
>Fix a nasty mess, and also bug #296. passdb/pdb_ldap.c was not converting
>to/from utf8 for some calls. The libads code gets this right. Wonder why
>the passdb code doesn't use it ?
>Jeremy.
(This used to be commit 258c106e2243f19c77fe35edd6dcba816a8fc8ee)

source3/libads/ldap.c

index e925750e0a05c922dfa322c210cb093e0ff0ba22..48401cc3d803f4c20418e881d32088a3d82ebdcd 100644 (file)
@@ -709,7 +709,16 @@ char *ads_get_dn(ADS_STRUCT *ads, void *msg)
 
        utf8_dn = ldap_get_dn(ads->ld, msg);
 
-       pull_utf8_allocate((void **) &unix_dn, utf8_dn);
+       if (!utf8_dn) {
+               DEBUG (5, ("ads_get_dn: ldap_get_dn failed\n"));
+               return NULL;
+       }
+
+       if (pull_utf8_allocate((void **) &unix_dn, utf8_dn) == (size_t)-1) {
+               DEBUG(0,("ads_get_dn: string conversion failure utf8 [%s]\n",
+                       utf8_dn ));
+               return NULL;
+       }
        ldap_memfree(utf8_dn);
        return unix_dn;
 }