summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-07-20 17:43:18 +0000
committermillert <millert@openbsd.org>2002-07-20 17:43:18 +0000
commit48366c1ddd639cbcb6892134290e449c07ed090c (patch)
tree6eee0cd7cc11ec8aefb0df7bd36cf6750b625794
parentFix up WANT_LIBMILTER stuff for people who want to use it; downsj@downsj.com (diff)
downloadwireguard-openbsd-48366c1ddd639cbcb6892134290e449c07ed090c.tar.xz
wireguard-openbsd-48366c1ddd639cbcb6892134290e449c07ed090c.zip
Exit if setusercontext() fails to set resources/priority and suidwarn
is true. This is consistent with sendmail's behavior when things like initgroups() fail.
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/deliver.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gnu/usr.sbin/sendmail/sendmail/deliver.c b/gnu/usr.sbin/sendmail/sendmail/deliver.c
index ae35358f334..bd6c6bd2024 100644
--- a/gnu/usr.sbin/sendmail/sendmail/deliver.c
+++ b/gnu/usr.sbin/sendmail/sendmail/deliver.c
@@ -2357,10 +2357,13 @@ tryhost:
pwd = sm_getpwnam(contextaddr->q_ruser);
else
pwd = sm_getpwnam(contextaddr->q_user);
- if (pwd != NULL)
- (void) setusercontext(NULL,
- pwd, pwd->pw_uid,
- LOGIN_SETRESOURCES|LOGIN_SETPRIORITY);
+ if (pwd != NULL && setusercontext(NULL, pwd,
+ pwd->pw_uid, LOGIN_SETRESOURCES |
+ LOGIN_SETPRIORITY) == -1 && suidwarn)
+ {
+ syserr("openmailer: setusercontext() failed");
+ exit(EX_TEMPFAIL);
+ }
}
# endif /* HASSETUSERCONTEXT */