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;
{
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;
}