lib/system_smbd.c‏: call it only once with max

Yannick Bergeron burgergold at hotmail.com
Mon Jul 13 07:49:30 MDT 2009


This is fixing an issue on AIX 5.3 and 6.1, the same issue reported a few years ago on this post:
http://lists.samba.org/archive/samba-technical/2006-September/049234.html

AIX seems to coredump when calling initgroups() or getgrset() twice. The stack trace show the behavior in getgrset_r()

Please let me know if there is a purpose with the orignal code

Regards,


@@ -146,39 +146,30 @@ static int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grp
 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
              gid_t primary_gid,
              gid_t **ret_groups, size_t *p_ngroups)
 {
     size_t ngrp;
     int max_grp;
     gid_t *temp_groups;
     gid_t *groups;
     int i;
 
-    max_grp = MIN(32, groups_max());
+    max_grp = groups_max();
     temp_groups = SMB_MALLOC_ARRAY(gid_t, max_grp);
     if (! temp_groups) {
         return False;
     }
 
     if (sys_getgrouplist(user, primary_gid, temp_groups, &max_grp) == -1) {
-        temp_groups = SMB_REALLOC_ARRAY(temp_groups, gid_t, max_grp);
-        if (!temp_groups) {
-            return False;
-        }
-        
-        if (sys_getgrouplist(user, primary_gid,
-                     temp_groups, &max_grp) == -1) {
-            DEBUG(0, ("get_user_groups: failed to get the unix "
-                  "group list\n"));
-            SAFE_FREE(temp_groups);
-            return False;
-        }
+        DEBUG(0, ("get_user_groups: failed to get the unix "group list\n"));
+        SAFE_FREE(temp_groups);
+        return False;
     }
     
     ngrp = 0;
     groups = NULL;
 
     /* Add in primary group first */
     if (!add_gid_to_array_unique(mem_ctx, primary_gid, &groups, &ngrp)) {
         SAFE_FREE(temp_groups);
         return False;
     }
_________________________________________________________________
Create a cool, new character for your Windows Live™ Messenger. 
http://go.microsoft.com/?linkid=9656621


More information about the samba-technical mailing list