summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@cvs.openbsd.org>2018-01-03 11:12:22 +0000
committerSunil Nimmagadda <sunil@cvs.openbsd.org>2018-01-03 11:12:22 +0000
commit186f3acdfb8db5f887e8da72944f8d0117ee2bb9 (patch)
tree75630af9d87faf5f6ca67a8128c051e34a419278 /usr.sbin
parent12a51798093b01e65c50ac1fac7b5882ee6a876d (diff)
Use crypt_checkpass(3) instead of crypt(3).
Based on a diff from Edgar Pettijohn. Ok gilles@ eric@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/lka.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index b73bd0131e6..210d41a7b0f 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.201 2017/11/27 08:35:59 sunil Exp $ */
+/* $OpenBSD: lka.c,v 1.202 2018/01/03 11:12:21 sunil Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -436,7 +436,6 @@ 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);
@@ -455,10 +454,7 @@ lka_authenticate(const char *tablename, const char *user, const char *password)
case 0:
return (LKA_PERMFAIL);
default:
- cpass = crypt(password, lk.creds.password);
- if (cpass == NULL)
- return (LKA_PERMFAIL);
- if (!strcmp(lk.creds.password, cpass))
+ if (crypt_checkpass(password, lk.creds.password) == 0)
return (LKA_OK);
return (LKA_PERMFAIL);
}