[BACK]Return to pwutil.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Diff for /src/usr.bin/sudo/Attic/pwutil.c between version 1.1 and 1.2

version 1.1, 2008/11/14 11:58:08 version 1.2, 2009/06/21 14:48:42
Line 1 
Line 1 
 /*  /*
  * Copyright (c) 1996, 1998-2005, 2007-2008   * Copyright (c) 1996, 1998-2005, 2007-2009
  *      Todd C. Miller <Todd.Miller@courtesan.com>   *      Todd C. Miller <Todd.Miller@courtesan.com>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 53 
Line 53 
 #include "redblack.h"  #include "redblack.h"
   
 #ifndef lint  #ifndef lint
 __unused static const char rcsid[] = "$Sudo: pwutil.c,v 1.21 2008/11/09 14:13:12 millert Exp $";  __unused static const char rcsid[] = "$Sudo: pwutil.c,v 1.23 2009/05/25 12:02:41 millert Exp $";
 #endif /* lint */  #endif /* lint */
   
 #ifdef MYPW  #ifdef MYPW
Line 207 
Line 207 
         if (pw->pw_passwd != NULL)          if (pw->pw_passwd != NULL)
             zero_bytes(pw->pw_passwd, strlen(pw->pw_passwd));              zero_bytes(pw->pw_passwd, strlen(pw->pw_passwd));
         pw->pw_passwd = cp;          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)          if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
             errorx(1, "unable to cache uid, already exists");              errorx(1, "unable to cache uid %lu (%s), already exists",
                   uid, pw->pw_name);
         return(pw);          return(pw);
     } else {      } else {
         pw = emalloc(sizeof(*pw));          pw = emalloc(sizeof(*pw));
         zero_bytes(pw, sizeof(*pw));          zero_bytes(pw, sizeof(*pw));
         pw->pw_uid = uid;          pw->pw_uid = uid;
         if (rbinsert(pwcache_byuid, (void *) pw) != NULL)          if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
             errorx(1, "unable to cache uid, already exists");              errorx(1, "unable to cache uid %lu, already exists", uid);
         return(NULL);          return(NULL);
     }      }
 }  }
Line 250 
Line 248 
         if (pw->pw_passwd != NULL)          if (pw->pw_passwd != NULL)
             zero_bytes(pw->pw_passwd, strlen(pw->pw_passwd));              zero_bytes(pw->pw_passwd, strlen(pw->pw_passwd));
         pw->pw_passwd = cp;          pw->pw_passwd = cp;
   
         if (rbinsert(pwcache_byname, (void *) pw) != NULL)          if (rbinsert(pwcache_byname, (void *) pw) != NULL)
             errorx(1, "unable to cache user name, already exists");              errorx(1, "unable to cache user %s, already exists", name);
         if (rbinsert(pwcache_byuid, (void *) pw) != NULL)  
             errorx(1, "unable to cache uid, already exists");  
         return(pw);          return(pw);
     } else {      } else {
         len = strlen(name) + 1;          len = strlen(name) + 1;
Line 266 
Line 261 
         pw->pw_name = cp;          pw->pw_name = cp;
         pw->pw_uid = (uid_t) -1;          pw->pw_uid = (uid_t) -1;
         if (rbinsert(pwcache_byname, (void *) pw) != NULL)          if (rbinsert(pwcache_byname, (void *) pw) != NULL)
             errorx(1, "unable to cache user name, already exists");              errorx(1, "unable to cache user %s, already exists", name);
         return(NULL);          return(NULL);
     }      }
 }  }
Line 487 
Line 482 
      */       */
     if ((gr = getgrgid(gid)) != NULL) {      if ((gr = getgrgid(gid)) != NULL) {
         gr = sudo_grdup(gr);          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)          if (rbinsert(grcache_bygid, (void *) gr) != NULL)
             errorx(1, "unable to cache gid, already exists");              errorx(1, "unable to cache gid %lu (%s), already exists",
                   gid, gr->gr_name);
         return(gr);          return(gr);
     } else {      } else {
         gr = emalloc(sizeof(*gr));          gr = emalloc(sizeof(*gr));
         zero_bytes(gr, sizeof(*gr));          zero_bytes(gr, sizeof(*gr));
         gr->gr_gid = gid;          gr->gr_gid = gid;
         if (rbinsert(grcache_bygid, (void *) gr) != NULL)          if (rbinsert(grcache_bygid, (void *) gr) != NULL)
             errorx(1, "unable to cache gid, already exists");              errorx(1, "unable to cache gid %lu, already exists, gid");
         return(NULL);          return(NULL);
     }      }
 }  }
Line 525 
Line 519 
     if ((gr = getgrnam(name)) != NULL) {      if ((gr = getgrnam(name)) != NULL) {
         gr = sudo_grdup(gr);          gr = sudo_grdup(gr);
         if (rbinsert(grcache_byname, (void *) gr) != NULL)          if (rbinsert(grcache_byname, (void *) gr) != NULL)
             errorx(1, "unable to cache group name, already exists");              errorx(1, "unable to cache group %s, already exists", name);
         if (rbinsert(grcache_bygid, (void *) gr) != NULL)  
             errorx(1, "unable to cache gid, already exists");  
         return(gr);          return(gr);
     } else {      } else {
         len = strlen(name) + 1;          len = strlen(name) + 1;
Line 539 
Line 531 
         gr->gr_name = cp;          gr->gr_name = cp;
         gr->gr_gid = (gid_t) -1;          gr->gr_gid = (gid_t) -1;
         if (rbinsert(grcache_byname, (void *) gr) != NULL)          if (rbinsert(grcache_byname, (void *) gr) != NULL)
             errorx(1, "unable to cache group name, already exists");              errorx(1, "unable to cache group %s, already exists", name);
         return(NULL);          return(NULL);
     }      }
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2