summaryrefslogtreecommitdiff
path: root/slock.c
diff options
context:
space:
mode:
authorgarbeam@gmail.com <unknown>2012-01-24 22:10:02 +0100
committergarbeam@gmail.com <unknown>2012-01-24 22:10:02 +0100
commitf013cb264e654125c043ed637b7f47692376f967 (patch)
tree4f37c3521eafd30b9175e1c76a07447da85958f8 /slock.c
parent5a5c581285e86fe53c9602c7e0fb7e19ec742391 (diff)
downloadslock-f013cb264e654125c043ed637b7f47692376f967.tar.gz
slock-f013cb264e654125c043ed637b7f47692376f967.tar.xz
applied Michaels patch
Diffstat (limited to 'slock.c')
-rw-r--r--slock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/slock.c b/slock.c
index 2dce109..d150009 100644
--- a/slock.c
+++ b/slock.c
@@ -50,9 +50,9 @@ getpw(void) { /* only run as root */
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;
@@ -60,6 +60,8 @@ getpw(void) { /* only run as root */
{
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;
}