applied Michaels patch
This commit is contained in:
parent
5a5c581285
commit
f013cb264e
6
slock.c
6
slock.c
|
@ -50,9 +50,9 @@ getpw(void) { /* only run as root */
|
||||||
const char *rval;
|
const char *rval;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
if(geteuid() != 0)
|
|
||||||
die("cannot retrieve password entry (make sure to suid slock)");
|
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
|
if(!pw)
|
||||||
|
die("cannot retrieve password entry (make sure to suid or sgid slock)");
|
||||||
endpwent();
|
endpwent();
|
||||||
rval = pw->pw_passwd;
|
rval = pw->pw_passwd;
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ getpw(void) { /* only run as root */
|
||||||
{
|
{
|
||||||
struct spwd *sp;
|
struct spwd *sp;
|
||||||
sp = getspnam(getenv("USER"));
|
sp = getspnam(getenv("USER"));
|
||||||
|
if(!sp)
|
||||||
|
die("slock: cannot retrieve shadow entry (make sure to suid or sgid slock)\n");
|
||||||
endspent();
|
endspent();
|
||||||
rval = sp->sp_pwdp;
|
rval = sp->sp_pwdp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue