- return result in a more sensible way

- add first goo to be able to unlock screen as root without needing
setuid (wip: does not work yet)
This commit is contained in:
ajacoutot 2008-11-04 15:28:41 +00:00
parent 76e693807e
commit 69a97f507b
2 changed files with 23 additions and 7 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.50 2008/11/03 23:18:41 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.51 2008/11/04 15:28:41 ajacoutot Exp $
COMMENT= screen saver and locker for the X Window System
DISTNAME= xscreensaver-5.07
PKGNAME= ${DISTNAME}p1
PKGNAME= ${DISTNAME}p2
CATEGORIES= x11
HOMEPAGE= http://www.jwz.org/xscreensaver/

View File

@ -1,4 +1,4 @@
/* $OpenBSD: passwd-bsd_auth.c,v 1.2 2008/11/03 23:18:42 ajacoutot Exp $
/* $OpenBSD: passwd-bsd_auth.c,v 1.3 2008/11/04 15:28:41 ajacoutot Exp $
* passwd-bsd_auth.c --- verifying typed passwords with bsd_auth(3)
*
* Copyright (c) 2008 Antoine Jacoutot <ajacoutot@openbsd.org>
@ -48,16 +48,32 @@ extern int bsdauth_passwd_valid_p (const char *typed_passwd, int verbose_p);
int
bsdauth_passwd_valid_p (const char *typed_passwd, int verbose_p)
{
int res;
struct passwd *pw;
pw = getpwuid(getuid());
if (pw != NULL) {
block_sigchld();
if (auth_userokay(pw->pw_name, NULL, "auth-xscreensaver", typed_passwd))
return 1;
else
return 0;
/*
XXX It should be possible to specify an authentication style by
appending it to the user's name with a single colon (`:') as a separator
but xscreensaver does not allow to modify username (yet?).
*/
#ifdef ALLOW_ROOT_PASSWD
res = (auth_userokay(pw->pw_name, NULL, "auth-xscreensaver", typed_passwd)) ||
(auth_userokay("root", "passwd", "auth-xscreensaver", typed_passwd));
#else
res = (auth_userokay(pw->pw_name, NULL, "auth-xscreensaver", typed_passwd));
#endif
unblock_sigchld();
if (res)
return 1;
else
return 0;
} else {
fprintf(stderr, "getpwuid: couldn't get user ID.\n");
return 0;