Hello, working on su/login in ubase, I removed my /etc/shadow-file with "pwunconv" and noticed that slock didn't work any more. It turned out to be an invalid check in slock for shadow-passwords, which, after correcting it, turned out to solve the problem instantly.
I don't know who got the idea to check the length of the hash, given a shadow-password is easy to identify with 'x','\0'. My patch is attached; I'd be glad to see it applied for all people who know that shadow-passwords only give a false sense of security. Cheers FRIGN -- FRIGN <d...@frign.de>
>From 994304dd04d3e6619851295f9542f3fec111a814 Mon Sep 17 00:00:00 2001 From: FRIGN <d...@frign.de> Date: Tue, 3 Jun 2014 19:19:10 +0200 Subject: [PATCH] Add /etc/passwd support Fix slock to work with /etc/passwd without /etc/shadow. while we're at it, remove an occurence of trailing whitespace. --- slock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slock.c b/slock.c index 506231e..aedee2e 100644 --- a/slock.c +++ b/slock.c @@ -75,7 +75,7 @@ getpw(void) { /* only run as root */ rval = pw->pw_passwd; #if HAVE_SHADOW_H - if (strlen(rval) >= 1) { /* kludge, assumes pw placeholder entry has len >= 1 */ + if (rval[0] == 'x' && rval[1] == '\0') { struct spwd *sp; sp = getspnam(getenv("USER")); if(!sp) @@ -147,7 +147,7 @@ readpw(Display *dpy, const char *pws) --len; break; default: - if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) { + if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) { memcpy(passwd + len, buf, num); len += num; } -- 1.8.5.5