From: sunil Date: Wed, 3 Jan 2018 11:12:21 +0000 (+0000) Subject: Use crypt_checkpass(3) instead of crypt(3). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e7d7d40dc59c342bce538139bdf82afdb86eadb4;p=openbsd Use crypt_checkpass(3) instead of crypt(3). Based on a diff from Edgar Pettijohn. Ok gilles@ eric@ --- 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 @@ -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); }