Author: jerry
Date: 2005-08-26 19:15:19 +0000 (Fri, 26 Aug 2005)
New Revision: 9661

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9661

Log:
fallback to cn attribubte if displayName is not available
Modified:
   branches/SAMBA_3_0/source/passdb/pdb_ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/pdb_ldap.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/pdb_ldap.c 2005-08-26 18:57:32 UTC (rev 
9660)
+++ branches/SAMBA_3_0/source/passdb/pdb_ldap.c 2005-08-26 19:15:19 UTC (rev 
9661)
@@ -3692,24 +3692,24 @@
                return False;
        }
 
-       /* verify that the 'cn' attribute exists */
+       /* display name is the NT group name */
 
-       vals = ldap_get_values(ld, entry, "cn");
+       vals = ldap_get_values(ld, entry, "displayName");
        if ((vals == NULL) || (vals[0] == NULL)) {
-               DEBUG(5, ("\"cn\" not found\n"));
-               return False;
+               DEBUG(8, ("\"displayName\" not found\n"));
+
+               /* fallback to the 'cn' attribute */
+               vals = ldap_get_values(ld, entry, "cn");
+               if ((vals == NULL) || (vals[0] == NULL)) {
+                       DEBUG(5, ("\"cn\" not found\n"));
+                       return False;
+               }
+               pull_utf8_talloc(mem_ctx, CONST_DISCARD(char **, 
&result->account_name), vals[0]);
        }
-       ldap_value_free(vals);
+       else {
+               pull_utf8_talloc(mem_ctx, CONST_DISCARD(char **, 
&result->account_name), vals[0]);
+       }
 
-       /* display name is the NT group name */
-
-       vals = ldap_get_values(ld, entry, "displayName");
-       if ((vals == NULL) || (vals[0] == NULL))
-               DEBUG(8, ("\"displayName\" not found\n"));
-       else
-               pull_utf8_talloc(mem_ctx,
-                                CONST_DISCARD(char **, &result->account_name),
-                                vals[0]);
        ldap_value_free(vals);
 
        vals = ldap_get_values(ld, entry, "description");

Reply via email to