Author: jerry
Date: 2005-08-17 13:34:23 +0000 (Wed, 17 Aug 2005)
New Revision: 9361

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

Log:
patch from Ed Plese to fix a faulty error in winbindd
caused by users with no supplementary groups.


Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c
   branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
   branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_ads.c
   trunk/source/nsswitch/winbindd_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c   2005-08-17 13:14:40 UTC 
(rev 9360)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c   2005-08-17 13:34:23 UTC 
(rev 9361)
@@ -499,28 +499,27 @@
        }
        
        count = ads_count_replies(ads, res);
-       if (count == 0) {
-               DEBUG(5,("lookup_usergroups: No supp groups found\n"));
-               
-               status = ads_ntstatus(rc);
-               goto done;
-       }
        
        *user_sids = NULL;
        *num_groups = 0;
 
+       /* always add the primary group to the sid array */
        add_sid_to_array(mem_ctx, primary_group, user_sids, num_groups);
 
-       for (msg = ads_first_entry(ads, res); msg;
-            msg = ads_next_entry(ads, msg)) {
-               DOM_SID group_sid;
+       if (count > 0) {
+               for (msg = ads_first_entry(ads, res); msg;
+                    msg = ads_next_entry(ads, msg)) {
+                       DOM_SID group_sid;
                
-               if (!ads_pull_sid(ads, msg, "objectSid", &group_sid)) {
-                       DEBUG(1,("No sid for this group ?!?\n"));
-                       continue;
+                       if (!ads_pull_sid(ads, msg, "objectSid", &group_sid)) {
+                               DEBUG(1,("No sid for this group ?!?\n"));
+                               continue;
+                       }
+
+                       add_sid_to_array(mem_ctx, &group_sid, user_sids,
+                                        num_groups);
                }
 
-               add_sid_to_array(mem_ctx, &group_sid, user_sids, num_groups);
        }
 
        status = (user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;

Modified: branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
===================================================================
--- branches/SAMBA_3_0_RELEASE/WHATSNEW.txt     2005-08-17 13:14:40 UTC (rev 
9360)
+++ branches/SAMBA_3_0_RELEASE/WHATSNEW.txt     2005-08-17 13:34:23 UTC (rev 
9361)
@@ -93,7 +93,12 @@
     * BUG 2314: Fix const compiler warnings in the quota code.
 
 
+o   Ed Plese <[EMAIL PROTECTED]>
+    * Fix faulty logic which caused winbindd to return failure 
+      when a user passessed no supplementary groups.
 
+
+
 Release Notes for older release follow:
 
       --------------------------------------------------

Modified: branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_ads.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_ads.c   2005-08-17 
13:14:40 UTC (rev 9360)
+++ branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_ads.c   2005-08-17 
13:34:23 UTC (rev 9361)
@@ -499,28 +499,27 @@
        }
        
        count = ads_count_replies(ads, res);
-       if (count == 0) {
-               DEBUG(5,("lookup_usergroups: No supp groups found\n"));
-               
-               status = ads_ntstatus(rc);
-               goto done;
-       }
        
        *user_sids = NULL;
        *num_groups = 0;
 
+       /* always add the primary group to the sid array */
        add_sid_to_array(mem_ctx, primary_group, user_sids, num_groups);
 
-       for (msg = ads_first_entry(ads, res); msg;
-            msg = ads_next_entry(ads, msg)) {
-               DOM_SID group_sid;
+       if (count > 0) {
+               for (msg = ads_first_entry(ads, res); msg;
+                    msg = ads_next_entry(ads, msg)) {
+                       DOM_SID group_sid;
                
-               if (!ads_pull_sid(ads, msg, "objectSid", &group_sid)) {
-                       DEBUG(1,("No sid for this group ?!?\n"));
-                       continue;
+                       if (!ads_pull_sid(ads, msg, "objectSid", &group_sid)) {
+                               DEBUG(1,("No sid for this group ?!?\n"));
+                               continue;
+                       }
+
+                       add_sid_to_array(mem_ctx, &group_sid, user_sids,
+                                        num_groups);
                }
 
-               add_sid_to_array(mem_ctx, &group_sid, user_sids, num_groups);
        }
 
        status = (user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;

Modified: trunk/source/nsswitch/winbindd_ads.c
===================================================================
--- trunk/source/nsswitch/winbindd_ads.c        2005-08-17 13:14:40 UTC (rev 
9360)
+++ trunk/source/nsswitch/winbindd_ads.c        2005-08-17 13:34:23 UTC (rev 
9361)
@@ -499,28 +499,27 @@
        }
        
        count = ads_count_replies(ads, res);
-       if (count == 0) {
-               DEBUG(5,("lookup_usergroups: No supp groups found\n"));
-               
-               status = ads_ntstatus(rc);
-               goto done;
-       }
        
        *user_sids = NULL;
        *num_groups = 0;
 
+       /* always add the primary group to the sid array */
        add_sid_to_array(mem_ctx, primary_group, user_sids, num_groups);
 
-       for (msg = ads_first_entry(ads, res); msg;
-            msg = ads_next_entry(ads, msg)) {
-               DOM_SID group_sid;
+       if (count > 0) {
+               for (msg = ads_first_entry(ads, res); msg;
+                    msg = ads_next_entry(ads, msg)) {
+                       DOM_SID group_sid;
                
-               if (!ads_pull_sid(ads, msg, "objectSid", &group_sid)) {
-                       DEBUG(1,("No sid for this group ?!?\n"));
-                       continue;
+                       if (!ads_pull_sid(ads, msg, "objectSid", &group_sid)) {
+                               DEBUG(1,("No sid for this group ?!?\n"));
+                               continue;
+                       }
+
+                       add_sid_to_array(mem_ctx, &group_sid, user_sids,
+                                        num_groups);
                }
 
-               add_sid_to_array(mem_ctx, &group_sid, user_sids, num_groups);
        }
 
        status = (user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;

Reply via email to