* login.c (update_ref_count): Copy passwd info before calling getuserattr, to
authorKen Raeburn <raeburn@mit.edu>
Thu, 16 Mar 2000 04:45:13 +0000 (04:45 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 16 Mar 2000 04:45:13 +0000 (04:45 +0000)
keep data from getting clobbered.  Patch from Mark Roth.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12119 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/bsd/ChangeLog
src/appl/bsd/login.c

index 9b9c7c8d020b9aaa431729f8cf98ef7f51ee902e..d3314b08daa29defeebe235b3a848651e527caed 100644 (file)
@@ -1,3 +1,10 @@
+2000-03-15  Ken Raeburn  <raeburn@mit.edu>
+           Mark D. Roth  <roth@uiuc.edu>
+
+       * login.c (update_ref_count): Copy passwd info before calling
+       getuserattr, to keep data from getting clobbered.  Patch from Mark
+       Roth.
+
 2000-02-28  Ken Raeburn  <raeburn@mit.edu>
 
        * krlogin.c (main): Don't output debugging messages if debugging
index 1832aafb2d5a29bcf054194b1d8c4edb24aacd8a..40af3ce60d3b9486df9fd81c19cb7289e33ec598 100644 (file)
@@ -2411,10 +2411,22 @@ char *strsave(sp)
 #ifdef _IBMR2
 update_ref_count(int adj)
 {
+    struct passwd *save_pwd;
     static char *empty = "\0";
     char *grp;
     int i;
 
+    /* save pwd before calling getuserattr() */
+    save_pwd = (struct passwd *)malloc(sizeof(struct passwd));
+    save_pwd->pw_name = strdup(pwd->pw_name);
+    save_pwd->pw_passwd = strdup(pwd->pw_passwd);
+    save_pwd->pw_uid = pwd->pw_uid;
+    save_pwd->pw_gid = pwd->pw_gid;
+    save_pwd->pw_gecos = strdup(pwd->pw_gecos);
+    save_pwd->pw_dir = strdup(pwd->pw_dir);
+    save_pwd->pw_shell = strdup(pwd->pw_shell);
+    pwd = save_pwd;
+
     /* Update reference count on all user's temporary groups */
     setuserdb(S_READ|S_WRITE);
     if (getuserattr(username, S_GROUPS, (void *)&grp, SEC_LIST) == 0) {