From 951e90c4f1a49a1e9516f1f23996e868867a69ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Groenvall?= Date: Tue, 21 Jan 1997 20:53:38 +0000 Subject: [PATCH] Change the "LOGOUT" password to be managable through X-resources. The password is stored in UNIX crypt format so that it can be stored in a global resource file for sites that whish to keep it a secret. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1180 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/xnlock/xnlock.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/appl/xnlock/xnlock.c b/appl/xnlock/xnlock.c index 7a8f497e4..2d44cec7f 100644 --- a/appl/xnlock/xnlock.c +++ b/appl/xnlock/xnlock.c @@ -80,7 +80,7 @@ static Pixmap left0, left1, right0, right1, left_front, static int state; /* indicates states: walking or getting passwd */ static int ALLOW_LOGOUT = (60*10); /* Allow logout after nn seconds */ -static char LOGOUT_PASSWD[] = "LOGOUT"; /* when given password "xx" */ +#define LOGOUT_PASSWD "enuHDmTo5Lq4g" /* when given password "LOGOUT" */ static time_t locked_at; struct appres_t { @@ -90,7 +90,7 @@ struct appres_t { Boolean ignore_passwd; Boolean do_reverse; Boolean accept_root; - char *text, *text_prog, *file; + char *text, *text_prog, *file, *logoutPasswd; Boolean no_screensaver; } appres; @@ -120,6 +120,9 @@ static XtResource resources[] = { { "file", "File", XtRString, sizeof(String), XtOffsetOf(struct appres_t,file), XtRImmediate, NULL }, + { "logoutPasswd", "logoutPasswd", XtRString, sizeof(String), + XtOffsetOf(struct appres_t, logoutPasswd), XtRString, LOGOUT_PASSWD }, + { "noScreenSaver", "NoScreenSaver", XtRBoolean, sizeof(Boolean), XtOffsetOf(struct appres_t,no_screensaver), XtRImmediate, (XtPointer)True }, }; @@ -535,7 +538,7 @@ verify(char *password) if (getuid() != 0 && geteuid() != 0 && (time(0) - locked_at) > ALLOW_LOGOUT && - strncmp(password, LOGOUT_PASSWD, sizeof(LOGOUT_PASSWD)) == 0) + strcmp(crypt(password, appres.logoutPasswd), appres.logoutPasswd) == 0) { signal(SIGHUP, SIG_IGN); kill(-1, SIGHUP);