[hackers] [slock] applied Michaels patch || garbeam

From: <hg_AT_suckless.org>
Date: Tue, 24 Jan 2012 22:10:04 +0100 (CET)

changeset: 44:6f1b622597fb
tag: tip
user: garbeam_AT_gmail.com
date: Tue Jan 24 22:10:02 2012 +0100
files: slock.c
description:
applied Michaels patch


diff -r 079717422185 -r 6f1b622597fb slock.c
--- a/slock.c Sun Jan 22 18:58:10 2012 +0100
+++ b/slock.c Tue Jan 24 22:10:02 2012 +0100
_AT_@ -50,9 +50,9 @@
         const char *rval;
         struct passwd *pw;
 
- if(geteuid() != 0)
- die("cannot retrieve password entry (make sure to suid slock)");
         pw = getpwuid(getuid());
+ if(!pw)
+ die("cannot retrieve password entry (make sure to suid or sgid slock)");
         endpwent();
         rval = pw->pw_passwd;
 
_AT_@ -60,6 +60,8 @@
         {
                 struct spwd *sp;
                 sp = getspnam(getenv("USER"));
+ if(!sp)
+ die("slock: cannot retrieve shadow entry (make sure to suid or sgid slock)\n");
                 endspent();
                 rval = sp->sp_pwdp;
         }
Received on Tue Jan 24 2012 - 22:10:04 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 24 2012 - 22:12:07 CET