summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgiovanni <giovanni@openbsd.org>2014-09-03 07:42:47 +0000
committergiovanni <giovanni@openbsd.org>2014-09-03 07:42:47 +0000
commita5038ba7566eb1de3d2438b3bd78cfcb2cc56212 (patch)
treedf0eb09463eb806b1ef9a45bf8d62067295ee98a
parentImplement the traditional -h option for man(1): show the SYNOPSIS only. (diff)
downloadwireguard-openbsd-a5038ba7566eb1de3d2438b3bd78cfcb2cc56212.tar.xz
wireguard-openbsd-a5038ba7566eb1de3d2438b3bd78cfcb2cc56212.zip
if crypt(3) fails return an authentication error
ok gilles@
-rw-r--r--usr.sbin/smtpd/lka.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index 752f4c99c8d..d6c4664a910 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.172 2014/07/10 15:54:55 eric Exp $ */
+/* $OpenBSD: lka.c,v 1.173 2014/09/03 07:42:47 giovanni Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -522,6 +522,7 @@ static int
lka_authenticate(const char *tablename, const char *user, const char *password)
{
struct table *table;
+ char *cpass;
union lookup lk;
log_debug("debug: lka: authenticating for %s:%s", tablename, user);
@@ -540,7 +541,10 @@ lka_authenticate(const char *tablename, const char *user, const char *password)
case 0:
return (LKA_PERMFAIL);
default:
- if (!strcmp(lk.creds.password, crypt(password, lk.creds.password)))
+ cpass = crypt(password, lk.creds.password);
+ if (cpass == NULL)
+ return (LKA_PERMFAIL);
+ if (!strcmp(lk.creds.password, cpass))
return (LKA_OK);
return (LKA_PERMFAIL);
}