Module Name: src
Committed By: christos
Date: Thu May 9 15:25:44 UTC 2013
Modified Files:
src/external/gpl2/xcvs/dist/src: acl.c
Log Message:
When checking for membership in the system group file don't forget to check
the primary group of the user.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl2/xcvs/dist/src/acl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl2/xcvs/dist/src/acl.c
diff -u src/external/gpl2/xcvs/dist/src/acl.c:1.4 src/external/gpl2/xcvs/dist/src/acl.c:1.5
--- src/external/gpl2/xcvs/dist/src/acl.c:1.4 Wed Oct 3 18:28:20 2012
+++ src/external/gpl2/xcvs/dist/src/acl.c Thu May 9 11:25:44 2013
@@ -30,6 +30,7 @@
*/
#include "cvs.h"
#include "getline.h"
+#include <pwd.h>
#include <grp.h>
static int acl_fileproc (void *callerdat, struct file_info *finfo);
@@ -556,18 +557,24 @@ check_default:
if (debug) fprintf (stderr, "usesystemgroups=%d\n", use_system_groups);
if (use_system_groups) {
struct group *griter;
+ struct passwd *pwd;
+ gid_t gid = (pwd = getpwnam(username)) != NULL ? pwd->pw_gid : -1;
setgrent ();
while (griter = getgrent ())
{
- char **users=griter->gr_mem;
- int index = 0;
- char *userchk = users [index++];
- while(userchk != NULL) {
- if(strcmp (userchk, username) == 0)
- break;
- userchk = users[index++];
+ char *userchk;
+ if (gid == griter->gr_gid) {
+ userchk = username;
+ } else {
+ char **users = griter->gr_mem;
+ int index = 0;
+ userchk = users [index++];
+ while(userchk != NULL) {
+ if(strcmp (userchk, username) == 0)
+ break;
+ userchk = users[index++];
+ }
}
- if (debug) fprintf (stderr, "usercheck=%s\n", userchk);
if (userchk != NULL) {
char *grp;
if ((grp = findusername (part_perms, griter->gr_name)))