openbsd-ports/x11/gnome/screensaver/patches/patch-src_setuid_c
2011-09-12 07:28:52 +00:00

37 lines
1.4 KiB
Plaintext

$OpenBSD: patch-src_setuid_c,v 1.2 2011/09/12 07:28:54 jasper Exp $
https://bugzilla.gnome.org/show_bug.cgi?id=651554
--- src/setuid.c.orig Wed Apr 30 04:30:08 2008
+++ src/setuid.c Fri May 15 12:15:54 2009
@@ -194,6 +194,21 @@ hack_uid (char **nolock_reason,
*orig_uid = uid_gid_string (euid, 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 = ("no such group as \"auth\" for bsdauth.\n");
+
+ ret = FALSE;
+ goto out;
+ }
+ if (! set_ids_by_number (uid, authg->gr_gid, uid_message)) {
+ reason = ("cannot setgid \"auth\" for bsdauth.");
+
+ ret = FALSE;
+ goto out;
+ }
+#else /* !HAVE_BSDAUTH */
if (uid != euid || gid != egid) {
if (! set_ids_by_number (uid, gid, uid_message)) {
reason = g_strdup ("unable to discard privileges.");
@@ -202,6 +217,7 @@ hack_uid (char **nolock_reason,
goto out;
}
}
+#endif
}