[PATCH] Add /etc/passwd support

From: FRIGN <dev_AT_frign.de>
Date: Tue, 3 Jun 2014 19:19:10 +0200

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
_AT_@ -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)
_AT_@ -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
--Multipart=_Tue__3_Jun_2014_19_28_37_+0200_guh3WrH_OyjqZUkF--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 03 2014 - 19:36:06 CEST