[Samba] Memory Leak in 2.2.6rc2??

Gerald (Jerry) Carter jerry at samba.org
Mon Oct 14 03:00:02 GMT 2002


> On Sat, 12 Oct 2002, Gerald (Jerry) Carter wrote:
> 
> > Hmmm... can you run "getent group" and see if it keeps looping
> > over the same domain groups?  Make sure that "winbind enum [user|group]"
> > are both enable (are by default).

OK.  Please try this patch against 2.2.6rc3 (or rc2).  This fixes the
problem that caused winbind's getgrent() function to infinitely loop over
the same set of domain groups.

If it works for you, i'll cut an rc4 tomorrow.

btw... if "getent group" is only showing local UNIX groups, but "getent
passwd" correctly lists domain groups, .....  I dunno.  Strange....
Need more information.... probably a winbindd level 10 log of the failed
group enumeration.




cheers, jerry
 ---------------------------------------------------------------------
 Hewlett-Packard                                     http://www.hp.com
 SAMBA Team                                       http://www.samba.org
 --                                            http://www.plainjoe.org
 "SAMS Teach Yourself Samba in 24 Hours" 2ed.       ISBN 0-672-32269-2
 --"I never saved anything for the swim back." Ethan Hawk in Gattaca--

-------------- next part --------------
Index: nsswitch/winbindd_group.c
===================================================================
RCS file: /data/cvs/samba/source/nsswitch/winbindd_group.c,v
retrieving revision 1.3.4.24
diff -u -b -r1.3.4.24 winbindd_group.c
--- nsswitch/winbindd_group.c	13 Sep 2002 23:46:27 -0000	1.3.4.24
+++ nsswitch/winbindd_group.c	14 Oct 2002 02:53:32 -0000
@@ -505,10 +505,22 @@
 			   ent->sam_entry_index, ent->num_sam_entries));
 
 		if (ent->num_sam_entries == ent->sam_entry_index) {
-
-			while(ent && !get_sam_group_entries(ent, NULL)) {
 				struct getent_state *next_ent;
 
+			/* is this the beginning ( == 0 ) or the end ? */
+			
+			if ( ent->sam_entry_index > 0 ) {
+				DEBUG(10, ("end of getgrent: freeing state info for domain %s\n", ent->domain_name)); 
+				SAFE_FREE(ent->sam_entries);
+				next_ent = ent->next;
+				DLIST_REMOVE(state->getgrent_state, ent);
+				SAFE_FREE(ent);
+				ent = next_ent;
+			}
+
+			/* find the next domain's group entries */
+
+			while(ent && !get_sam_group_entries(ent, NULL)) {
 				DEBUG(10, ("freeing state info for domain %s\n", ent->domain_name)); 
 
 				/* Free state information for this domain */
Index: nsswitch/winbindd_user.c
===================================================================
RCS file: /data/cvs/samba/source/nsswitch/winbindd_user.c,v
retrieving revision 1.3.4.16
diff -u -b -r1.3.4.16 winbindd_user.c
--- nsswitch/winbindd_user.c	13 Sep 2002 23:46:27 -0000	1.3.4.16
+++ nsswitch/winbindd_user.c	14 Oct 2002 02:53:33 -0000
@@ -458,9 +458,30 @@
 		/* Do we need to fetch another chunk of users? */
 
 		if (ent->num_sam_entries == ent->sam_entry_index) {
+			struct getent_state *next_ent;
+
+			/* is this the beginning ( == 0 ) or the end ? */
+
+			/* 
+			 * for some reason this check is not needed here, but is
+			 * in winbindd_getgrent().  I'm putting it in but ifdef'd 
+			 * out for posterity   --jerry 
+			 */
+#if 0 	/* NOT NEEDED APPARENTLY */
+			
+			if ( ent->sam_entry_index > 0 ) {
+				DEBUG(10, ("end of getpwent: freeing state info for domain %s\n", ent->domain_name));
+				SAFE_FREE(ent->sam_entries);
+				next_ent = ent->next;
+				DLIST_REMOVE(state->getgrent_state, ent);
+				SAFE_FREE(ent);
+				ent = next_ent;
+			}
+#endif	/* NOT NEEDED APPARENTLY */
+
+			/* find the next domain's group entries */
 
 			while(ent && !get_sam_user_entries(ent)) {
-				struct getent_state *next_ent;
 
 				/* Free state information for this domain */
 


More information about the samba mailing list