From c1495c19a87199b445e41328eb292f8df439a3f6 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 16 Mar 2000 04:45:13 +0000 Subject: [PATCH] * login.c (update_ref_count): Copy passwd info before calling getuserattr, to 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 | 7 +++++++ src/appl/bsd/login.c | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 9b9c7c8d0..d3314b08d 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,10 @@ +2000-03-15 Ken Raeburn + Mark D. Roth + + * 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 * krlogin.c (main): Don't output debugging messages if debugging diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c index 1832aafb2..40af3ce60 100644 --- a/src/appl/bsd/login.c +++ b/src/appl/bsd/login.c @@ -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) { -- 2.26.2