diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2019-06-01 07:15:39 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2019-06-01 07:15:39 +0000 |
| commit | 72cbe13635b07cf120488bb4e4bd1106243876bd (patch) | |
| tree | 5d4bb8654d9551e2d1f0ac702c4e67e50fa4d51f /lib/libpam/modules | |
| parent | 0429b7877cb4c0e48d37d0f809e99c65d567d0d0 (diff) | |
Fix key loading logic and add log message when rejecting an unencrypted key.
Diffstat (limited to 'lib/libpam/modules')
| -rw-r--r-- | lib/libpam/modules/pam_ssh/pam_ssh.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libpam/modules/pam_ssh/pam_ssh.c b/lib/libpam/modules/pam_ssh/pam_ssh.c index 5e9dbe77ecf..fb26fa77611 100644 --- a/lib/libpam/modules/pam_ssh/pam_ssh.c +++ b/lib/libpam/modules/pam_ssh/pam_ssh.c @@ -1,4 +1,4 @@ -/* $NetBSD: pam_ssh.c,v 1.26 2018/08/26 08:54:03 christos Exp $ */ +/* $NetBSD: pam_ssh.c,v 1.27 2019/06/01 07:15:39 mlelstv Exp $ */ /*- * Copyright (c) 2003 Networks Associates Technology, Inc. @@ -38,7 +38,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ssh/pam_ssh.c,v 1.40 2004/02/10 10:13:21 des Exp $"); #else -__RCSID("$NetBSD: pam_ssh.c,v 1.26 2018/08/26 08:54:03 christos Exp $"); +__RCSID("$NetBSD: pam_ssh.c,v 1.27 2019/06/01 07:15:39 mlelstv Exp $"); #endif #include <sys/param.h> @@ -119,13 +119,14 @@ pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase, * accept only an empty passphrase. */ r = sshkey_load_private(fn, "", &key, &comment); - if (r && !(*passphrase == '\0' && nullok)) { + if (r == 0 && !(*passphrase == '\0' && nullok)) { + openpam_log(PAM_LOG_DEBUG, "rejected unencrypted key from %s", fn); sshkey_free(key); free(comment); return (NULL); } if (r) - sshkey_load_private(fn, passphrase, &key, &comment); + r = sshkey_load_private(fn, passphrase, &key, &comment); if (r) { openpam_log(PAM_LOG_DEBUG, "failed to load key from %s", fn); if (comment != NULL) |
