From 552172a0e2b51d67886eaaa07a2612e7b9f5fc15 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 30 Oct 2003 10:04:42 +0000 Subject: implement something basic. 2003-10-30 Not Zed * camel-smime-context.c (sm_get_passwd): implement something basic. svn path=/trunk/; revision=23130 --- camel/camel-smime-context.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'camel/camel-smime-context.c') diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c index ea6a73760d..9fad5a1f11 100644 --- a/camel/camel-smime-context.c +++ b/camel/camel-smime-context.c @@ -149,9 +149,22 @@ sm_decrypt_key(void *arg, SECAlgorithmID *algid) static char * sm_get_passwd(PK11SlotInfo *info, PRBool retry, void *arg) { - printf("Password requested for '%s'\n", PK11_GetTokenName(info)); + CamelSMIMEContext *context = arg; + char *pass, *nsspass = NULL; + char *prompt; + CamelException *ex; + + ex = camel_exception_new(); + prompt = g_strdup_printf(_("Enter security pass-phrase for `%s'"), PK11_GetTokenName(info)); + pass = camel_session_get_password(((CamelCipherContext *)context)->session, prompt, FALSE, TRUE, NULL, PK11_GetTokenName(info), ex); + camel_exception_free(ex); + g_free(prompt); + if (pass) { + nsspass = PORT_Strdup(pass); + g_free(pass); + } - return NULL; + return nsspass; } static NSSCMSMessage * -- cgit