slackbuilds_ponce/desktop/slock/slock-use_shadow_group.patch
2010-05-12 23:28:21 +02:00

23 lines
798 B
Diff

Patch by Robby Workman <rworkman@slackbuilds.org>
This is trivial, and not really ideal, because it hardcodes our
shadow group's guid (43), but oh well, it works for us. :-)
diff -Nur a/slock.c b/slock.c
--- a/slock.c 2008-07-29 13:22:46.000000000 -0500
+++ b/slock.c 2009-01-01 02:51:53.815701828 -0600
@@ -34,12 +34,12 @@
#ifndef HAVE_BSD_AUTH
static const char *
-get_password() { /* only run as root */
+get_password() { /* only run as shadow group - no need for suid root */
const char *rval;
struct passwd *pw;
- if(geteuid() != 0)
- die("slock: cannot retrieve password entry (make sure to suid slock)\n");
+ if(getegid() != 43)
+ die("slock: cannot retrieve password entry (make sure slock is sgid shadow)\n");
pw = getpwuid(getuid());
endpwent();
rval = pw->pw_passwd;