diff -r 4d3769ac5d02 -r 69b727153929 slock.c --- a/slock.c Thu Nov 26 12:53:26 2009 +0000 +++ b/slock.c Sat Dec 19 21:15:20 2009 +0100 @@ -44,26 +44,22 @@ exit(EXIT_FAILURE); } -#ifndef HAVE_BSD_AUTH +#ifdef HAVE_SHADOW_H static const char * get_password(void) { /* only run as root */ const char *rval; struct passwd *pw; + struct spwd *sp; if(geteuid() != 0) die("cannot retrieve password entry (make sure to suid slock)"); pw = getpwuid(getuid()); endpwent(); - rval = pw->pw_passwd; + rval = pw->pw_passwd; -#if HAVE_SHADOW_H - { - struct spwd *sp; - sp = getspnam(getenv("USER")); - endspent(); - rval = sp->sp_pwdp; - } -#endif + sp = getspnam(getenv("USER")); + endspent(); + rval = sp->sp_pwdp; /* drop privileges */ if(setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) @@ -73,11 +69,7 @@ #endif static void -#ifdef HAVE_BSD_AUTH -read_password(Display *dpy) -#else read_password(Display *dpy, const char *pws) -#endif { char buf[32], passwd[256]; int num; @@ -215,9 +207,7 @@ int main(int argc, char **argv) { -#ifndef HAVE_BSD_AUTH - const char *pws; -#endif + const char *pws = NULL; Display *dpy; int nscreens, screen; @@ -247,11 +237,7 @@ XSync(dpy, False); /* Everything is now blank. Now wait for the correct password. */ -#ifdef HAVE_BSD_AUTH - read_password(dpy); -#else read_password(dpy, pws); -#endif /* Password ok, unlock everything and quit. */ for (screen = 0; screen < nscreens; screen++)