diff options
author | garbeam@gmail.com <unknown> | 2012-01-24 22:10:02 +0100 |
---|---|---|
committer | garbeam@gmail.com <unknown> | 2012-01-24 22:10:02 +0100 |
commit | f013cb264e654125c043ed637b7f47692376f967 (patch) | |
tree | 4f37c3521eafd30b9175e1c76a07447da85958f8 | |
parent | 5a5c581285e86fe53c9602c7e0fb7e19ec742391 (diff) |
applied Michaels patch
-rw-r--r-- | slock.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -50,9 +50,9 @@ getpw(void) { /* only run as root */ | |||
50 | const char *rval; | 50 | const char *rval; |
51 | struct passwd *pw; | 51 | struct passwd *pw; |
52 | 52 | ||
53 | if(geteuid() != 0) | ||
54 | die("cannot retrieve password entry (make sure to suid slock)"); | ||
55 | pw = getpwuid(getuid()); | 53 | pw = getpwuid(getuid()); |
54 | if(!pw) | ||
55 | die("cannot retrieve password entry (make sure to suid or sgid slock)"); | ||
56 | endpwent(); | 56 | endpwent(); |
57 | rval = pw->pw_passwd; | 57 | rval = pw->pw_passwd; |
58 | 58 | ||
@@ -60,6 +60,8 @@ getpw(void) { /* only run as root */ | |||
60 | { | 60 | { |
61 | struct spwd *sp; | 61 | struct spwd *sp; |
62 | sp = getspnam(getenv("USER")); | 62 | sp = getspnam(getenv("USER")); |
63 | if(!sp) | ||
64 | die("slock: cannot retrieve shadow entry (make sure to suid or sgid slock)\n"); | ||
63 | endspent(); | 65 | endspent(); |
64 | rval = sp->sp_pwdp; | 66 | rval = sp->sp_pwdp; |
65 | } | 67 | } |