Support PKINIT NSS deferred identity prompting
authorNalin Dahyabhai <nalin@dahyabhai.net>
Mon, 8 Jul 2013 20:49:16 +0000 (16:49 -0400)
committerGreg Hudson <ghudson@mit.edu>
Wed, 17 Jul 2013 18:57:11 +0000 (14:57 -0400)
commitc5bf0caa8abf2b931f5ad258463d706d3cfd5f5b
tree800a3ba8f20629d2a314b8909f39a1d3ea3f88f9
parente8b63198029c632d097822104d6e17c9a67ef1a5
Support PKINIT NSS deferred identity prompting

The password callback which we usually supply to NSS already gets a
pointer to the pkinit_identity_crypto_context structure, but it needs to
be passed the name of the identity for which it's being called.

If it gets a name, and it's deferring prompting, just add the identity
to the list of deferred identity prompts (the password callback wouldn't
have been called if its result wasn't needed), and either return NULL
(as an indication that we couldn't get a password) or an empty string (a
value which we know is invalid) if that's handier.

Otherwise, check for a password that's been stashed for its use for that
identity, and return a copy of it if one's found.  If none of that
works, try to use the prompter callback to ask for the password.

ticket: 7680
src/plugins/preauth/pkinit/pkinit_crypto_nss.c