From d497949e68083c89123b1f38682f8613c283588e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 20 Jul 2002 12:30:45 +0000 Subject: [PATCH] Error out if setusercontext() fails and the runas user is not root. --- set_perms.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/set_perms.c b/set_perms.c index ac07eabbc..45374eb07 100644 --- a/set_perms.c +++ b/set_perms.c @@ -318,8 +318,12 @@ runas_setup() perror("cannot set gid to runas gid"); error = setusercontext(lc, runas_pw, runas_pw->pw_uid, flags); - if (error) - perror("unable to set user context"); + if (error) { + if (runas_pw->pw_gid != 0) + fatal("unable to set user context", 1); + else + perror("unable to set user context"); + } } else #endif /* HAVE_LOGIN_CAP_H */ { -- 2.40.0