[sudo-workers] Sudo 1.7.1 unclear messages

Anthony R Fletcher arif at mail.nih.gov
Tue May 5 15:12:03 EDT 2009


I have just tried sudo-1.7.1 and have found that some of the errors need
a little more information.

We have 2 groups with the same GID in our /etc/group file and one of
these groups is used in the /etc/sudoers file. The error message is:

	sudo: unable to cache gid, already exists

Of course the underlying duplication issue will be fixed but it took a
while for me to work out which group(s) it was complaining about.

Can we add extra info to the user and group cache complaints? Patch
attached.


		Anthony

-------------- next part --------------
*** pwutil.c.orig	2009-05-05 12:40:51.000000000 -0400
--- pwutil.c	2009-05-05 15:01:13.000000000 -0400
***************
*** 209,224 ****
  	pw->pw_passwd = cp;
  
  	if (rbinsert(pwcache_byname, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache user name, already exists");
  	if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache uid, already exists");
  	return(pw);
      } else {
  	pw = emalloc(sizeof(*pw));
  	zero_bytes(pw, sizeof(*pw));
  	pw->pw_uid = uid;
  	if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache uid, already exists");
  	return(NULL);
      }
  }
--- 209,224 ----
  	pw->pw_passwd = cp;
  
  	if (rbinsert(pwcache_byname, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache user name for uid %u, already exists");
  	if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache uid %d, already exists", uid);
  	return(pw);
      } else {
  	pw = emalloc(sizeof(*pw));
  	zero_bytes(pw, sizeof(*pw));
  	pw->pw_uid = uid;
  	if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache uid %d, already exists", uid);
  	return(NULL);
      }
  }
***************
*** 252,260 ****
  	pw->pw_passwd = cp;
  
  	if (rbinsert(pwcache_byname, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache user name, already exists");
  	if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache uid, already exists");
  	return(pw);
      } else {
  	len = strlen(name) + 1;
--- 252,260 ----
  	pw->pw_passwd = cp;
  
  	if (rbinsert(pwcache_byname, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache user name '%s', already exists", name);
  	if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache uid for '%s', already exists", name);
  	return(pw);
      } else {
  	len = strlen(name) + 1;
***************
*** 266,272 ****
  	pw->pw_name = cp;
  	pw->pw_uid = (uid_t) -1;
  	if (rbinsert(pwcache_byname, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache user name, already exists");
  	return(NULL);
      }
  }
--- 266,272 ----
  	pw->pw_name = cp;
  	pw->pw_uid = (uid_t) -1;
  	if (rbinsert(pwcache_byname, (void *) pw) != NULL)
! 	    errorx(1, "unable to cache user name '%s', already exists", name);
  	return(NULL);
      }
  }
***************
*** 488,503 ****
      if ((gr = getgrgid(gid)) != NULL) {
  	gr = sudo_grdup(gr);
  	if (rbinsert(grcache_byname, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache group name, already exists");
  	if (rbinsert(grcache_bygid, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache gid, already exists");
  	return(gr);
      } else {
  	gr = emalloc(sizeof(*gr));
  	zero_bytes(gr, sizeof(*gr));
  	gr->gr_gid = gid;
  	if (rbinsert(grcache_bygid, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache gid, already exists");
  	return(NULL);
      }
  }
--- 488,503 ----
      if ((gr = getgrgid(gid)) != NULL) {
  	gr = sudo_grdup(gr);
  	if (rbinsert(grcache_byname, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache group name for gid %d, already exists", gid);
  	if (rbinsert(grcache_bygid, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache gid %d, already exists", gid);
  	return(gr);
      } else {
  	gr = emalloc(sizeof(*gr));
  	zero_bytes(gr, sizeof(*gr));
  	gr->gr_gid = gid;
  	if (rbinsert(grcache_bygid, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache gid %d, already exists", gid);
  	return(NULL);
      }
  }
***************
*** 525,533 ****
      if ((gr = getgrnam(name)) != NULL) {
  	gr = sudo_grdup(gr);
  	if (rbinsert(grcache_byname, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache group name, already exists");
  	if (rbinsert(grcache_bygid, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache gid, already exists");
  	return(gr);
      } else {
  	len = strlen(name) + 1;
--- 525,533 ----
      if ((gr = getgrnam(name)) != NULL) {
  	gr = sudo_grdup(gr);
  	if (rbinsert(grcache_byname, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache group name '%s', already exists", name);
  	if (rbinsert(grcache_bygid, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache gid for '%s', already exists", name);
  	return(gr);
      } else {
  	len = strlen(name) + 1;
***************
*** 539,545 ****
  	gr->gr_name = cp;
  	gr->gr_gid = (gid_t) -1;
  	if (rbinsert(grcache_byname, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache group name, already exists");
  	return(NULL);
      }
  }
--- 539,545 ----
  	gr->gr_name = cp;
  	gr->gr_gid = (gid_t) -1;
  	if (rbinsert(grcache_byname, (void *) gr) != NULL)
! 	    errorx(1, "unable to cache group name '%s', already exists", name);
  	return(NULL);
      }
  }


More information about the sudo-workers mailing list