1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Don't call setusercontext() to change uid unless uid == 0; found by mpech@

This commit is contained in:
millert 2003-05-06 15:34:08 +00:00
parent 7ee9a4fdec
commit 3b08765c1d

View File

@ -1,4 +1,4 @@
/* $OpenBSD: skeyaudit.c,v 1.18 2003/05/06 10:45:49 mpech Exp $ */ /* $OpenBSD: skeyaudit.c,v 1.19 2003/05/06 15:34:08 millert Exp $ */
/* /*
* Copyright (c) 1997, 2000, 2003 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 1997, 2000, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@ -209,7 +209,8 @@ runsendmail(struct passwd *pw, pid_t *pidp)
(void)close(pfd[0]); (void)close(pfd[0]);
/* Run sendmail as target user not root */ /* Run sendmail as target user not root */
if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) != 0) { if (getuid() == 0 &&
setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) != 0) {
warn("cannot set user context"); warn("cannot set user context");
_exit(127); _exit(127);
} }