pam_ssh: Don't allow a bogus passphrase for unencrypted keys.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sat, 24 Dec 2011 21:00:13 +0000 (13:00 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sat, 24 Dec 2011 21:00:13 +0000 (13:00 -0800)
commit09e61f6cd8073fbb48eab8523b4bcc4f82dac34d
tree7f3887fb825e83519b5e1614255cab9efeddee60
parent3254d1d4c8320754cdc988a79834ef49eeb3a108
pam_ssh:  Don't allow a bogus passphrase for unencrypted keys.

key_load_private() ignores the passphrase argument if the private key
is unencrypted.  This defeats the nullok check, because it means a
non-null passphrase will successfully unlock the key.

To address this, try at first to load the key without a passphrase.
If this succeeds and the user provided a non-empty passphrase *or*
nullok is false, reject the key.

While I'm here: Load the ECDSA key if there is one.

Obtained-from:  FreeBSD 227757, 219426, & 226101
lib/pam_module/pam_ssh/pam_ssh.8
lib/pam_module/pam_ssh/pam_ssh.c