Author: jerry
Date: 2005-08-26 19:20:04 +0000 (Fri, 26 Aug 2005)
New Revision: 9662

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

Log:
merge ldap group mapping enumeration bugfix from 3.0
Modified:
   trunk/source/passdb/pdb_ldap.c
   trunk/source/rpc_parse/parse_samr.c
   trunk/source/rpc_server/srv_samr_nt.c


Changeset:
Modified: trunk/source/passdb/pdb_ldap.c
===================================================================
--- trunk/source/passdb/pdb_ldap.c      2005-08-26 19:15:19 UTC (rev 9661)
+++ trunk/source/passdb/pdb_ldap.c      2005-08-26 19:20:04 UTC (rev 9662)
@@ -4015,23 +4015,24 @@
                return False;
        }
 
-       vals = ldap_get_values(ld, entry, "cn");
+       /* display name is the NT group name */
+
+       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]);
        }
-       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]);
+       }
 
-       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->fullname),
-                                vals[0]);
        ldap_value_free(vals);
 
        vals = ldap_get_values(ld, entry, "description");

Modified: trunk/source/rpc_parse/parse_samr.c
===================================================================
--- trunk/source/rpc_parse/parse_samr.c 2005-08-26 19:15:19 UTC (rev 9661)
+++ trunk/source/rpc_parse/parse_samr.c 2005-08-26 19:20:04 UTC (rev 9662)
@@ -1718,7 +1718,7 @@
                DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
 
                init_unistr2(&(*sam)->str[i].uni_grp_name,
-                            entries[i].fullname, UNI_FLAGS_NONE);
+                            entries[i].account_name, UNI_FLAGS_NONE);
                init_unistr2(&(*sam)->str[i].uni_grp_desc,
                             entries[i].description, UNI_FLAGS_NONE);
 

Modified: trunk/source/rpc_server/srv_samr_nt.c
===================================================================
--- trunk/source/rpc_server/srv_samr_nt.c       2005-08-26 19:15:19 UTC (rev 
9661)
+++ trunk/source/rpc_server/srv_samr_nt.c       2005-08-26 19:20:04 UTC (rev 
9662)
@@ -669,7 +669,7 @@
                /*
                 * JRA. I think this should include the null. TNG does not.
                 */
-               init_unistr2(&uni_name[i], entries[i].fullname,
+               init_unistr2(&uni_name[i], entries[i].account_name,
                             UNI_STR_TERMINATE);
                init_sam_entry(&sam[i], &uni_name[i], entries[i].rid);
        }

Reply via email to