summaryrefslogtreecommitdiff
path: root/src/setuid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/setuid.c')
-rw-r--r--src/setuid.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/setuid.c b/src/setuid.c
index 80e4659..0a065d9 100644
--- a/src/setuid.c
+++ b/src/setuid.c
@@ -209,6 +209,15 @@ hack_uid (char **nolock_reason,
if (uid != euid || gid != egid)
{
+#ifdef HAVE_BSDAUTH /* we need to setgid auth to run the bsd_auth(3) login_* helpers */
+ struct group *authg = getgrnam("auth");
+ if (!authg || !authg->gr_name || !*authg->gr_name) {
+ reason = g_strdup ("no such group as \"auth\" for bsdauth.");
+ ret = FALSE;
+ goto out;
+ }
+ gid = authg->gr_gid;
+#endif /* !HAVE_BSDAUTH */
if (! set_ids_by_number (uid, gid, uid_message))
{
reason = g_strdup ("unable to discard privileges.");