summaryrefslogtreecommitdiff
path: root/desktop/slock/slock-use_shadow_group.patch
blob: 62bc1b8c033871ca972e6187ed445a166a437cd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;