diff -r 69b727153929 -r 2984d3edbdfd config.mk --- a/config.mk Sat Dec 19 21:15:20 2009 +0100 +++ b/config.mk Sat Dec 19 21:21:34 2009 +0100 @@ -3,6 +3,11 @@ # Customize below to fit your system +# password to use instead of system one +PASSWORD = 123 +#AUTHMODE = -DHAVE_SHADOW_H +#AUTHMODE = -DHAVE_BSD_AUTH + # paths PREFIX = /usr/local @@ -14,13 +19,10 @@ LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext # flags -CPPFLAGS = -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H +CPPFLAGS = -DVERSION=\"${VERSION}\" -DPASSWORD=\"${PASSWORD}\" ${AUTHMODE} CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} LDFLAGS = -s ${LIBS} -# On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS and add -DHAVE_BSD_AUTH -# On OpenBSD and Darwin remove -lcrypt from LIBS - # compiler and linker CC = cc diff -r 69b727153929 -r 2984d3edbdfd slock.c --- a/slock.c Sat Dec 19 21:15:20 2009 +0100 +++ b/slock.c Sat Dec 19 21:21:34 2009 +0100 @@ -106,8 +106,10 @@ passwd[len] = 0; #ifdef HAVE_BSD_AUTH running = !auth_userokay(getlogin(), NULL, "auth-xlock", passwd); +#elif HAVE_SHADOW_H + running = strcmp(crypt(passwd, pws), pws); #else - running = strcmp(crypt(passwd, pws), pws); + running = strcmp(passwd, pws); #endif if (running != 0) XBell(dpy, 100); @@ -207,7 +209,7 @@ int main(int argc, char **argv) { - const char *pws = NULL; + const char *pws = PASSWORD; Display *dpy; int nscreens, screen; @@ -218,7 +220,7 @@ else if(argc != 1) usage(); -#ifndef HAVE_BSD_AUTH +#ifdef HAVE_SHADOW_H pws = get_password(); #endif