| 
     
      
      
      From: <ab...@us...> - 2008-12-04 16:59:51
      
     
   | 
Revision: 27
          http://npfs.svn.sourceforge.net/npfs/?rev=27&view=rev
Author:   abbyz9
Date:     2008-12-04 16:59:22 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
np_unix_users->uid2user was not assigning the groups to a user  
properly. this patch fixes the bug.
Signed-off-by: Abhishek Kulkarni <kul...@la...>
Acked-by: Latchesar Ionkov <lu...@io...>
Modified Paths:
--------------
    npfs/trunk/libnpfs/uxusers.c
Modified: npfs/trunk/libnpfs/uxusers.c
===================================================================
--- npfs/trunk/libnpfs/uxusers.c	2008-12-04 16:56:35 UTC (rev 26)
+++ npfs/trunk/libnpfs/uxusers.c	2008-12-04 16:59:22 UTC (rev 27)
@@ -364,10 +364,8 @@
 	pthread_mutex_lock(&grentlock);
 	setgrent(); 
 	
-	if(u->dfltgroup) {
+	if(u->dfltgroup)
 		gids[0] = u->dfltgroup->gid;
-		n++;
-	}
 	
 	while ((g = getgrent()) != NULL) { 
 		for (i = 0; g->gr_mem[i]; i++) { 
@@ -382,15 +380,15 @@
 	endgrent(); 
 	pthread_mutex_unlock(&grentlock);
 
-	grps = np_malloc(sizeof(*grps) * n);
+	grps = np_malloc(sizeof(*grps) * (n+1));
 	if (!grps) {
 		free(gids);
 		return -1;
 	}
 	
-	for(i = 0; i < n; i++) {
+	for(i = 0; i <= n; i++) {
 		grps[i] = u->upool->gid2group(u->upool, gids[i]);
-		if (grps[i]) {
+		if (!grps[i]) {
 			free(grps);
 			return -1;
 		}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |