diff options
author | FRIGN <dev@frign.de> | 2014-06-03 19:19:10 +0200 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-06-09 19:14:31 +0100 |
commit | 9db14b10dd09336c6a8fe283f99108c9acc4667a (patch) | |
tree | 2715c291963a7869545d46cd07395b61bc2ff067 | |
parent | 6a5512835485ac501d983161ca15b311a95c5649 (diff) | |
download | slock-9db14b10dd09336c6a8fe283f99108c9acc4667a.tar.gz slock-9db14b10dd09336c6a8fe283f99108c9acc4667a.tar.xz |
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.
-rw-r--r-- | slock.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |