diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-02-17 23:46:28 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-02-17 23:46:28 +0000 |
commit | bc7234bb1453b6a5a59ce6a7450af16c91a45997 (patch) | |
tree | 797fd154f125a8a65c020cb650363debef2afb21 | |
parent | 51392753a0b6190a3755880cf473903a4752884e (diff) |
Use LOGIN_SETLOGIN flag to setsuercontext() so the user name gets
set properly to the user commands will be run on behalf of.
Bug report and different patch from Peter Philipp.
-rw-r--r-- | gnu/usr.sbin/sendmail/sendmail/deliver.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gnu/usr.sbin/sendmail/sendmail/deliver.c b/gnu/usr.sbin/sendmail/sendmail/deliver.c index b1d33f6ad15..98cc8ea0707 100644 --- a/gnu/usr.sbin/sendmail/sendmail/deliver.c +++ b/gnu/usr.sbin/sendmail/sendmail/deliver.c @@ -2330,7 +2330,7 @@ tryhost: # if HASSETUSERCONTEXT /* - ** Set user resources. + ** Set user resources and login name. */ if (contextaddr != NULL) @@ -2344,9 +2344,20 @@ tryhost: if (pwd != NULL) (void) setusercontext(NULL, pwd, pwd->pw_uid, - LOGIN_SETRESOURCES|LOGIN_SETPRIORITY); + LOGIN_SETRESOURCES|LOGIN_SETPRIORITY|LOGIN_SETLOGIN); } # endif /* HASSETUSERCONTEXT */ +# if HASSETLOGIN && !HASSETUSERCONTEXT + /* set login name */ + if (ctladdr != NULL) + { + user = ctladdr->q_ruser; + if (user == NULL) + user = ctladdr->q_user; + (void)setlogin(user); + + } +# endif /* HASSETLOGIN && !!HASSETUSERCONTEXT*/ #if HASNICE /* tweak niceness */ |