diff options
author | Not Zed <NotZed@Ximian.com> | 2004-01-14 10:54:50 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-01-14 10:54:50 +0800 |
commit | aedeb2fd7930d7e0779f2eb34f63f65bcf764ad7 (patch) | |
tree | 0a8820b045577aa4dba7f6fee6f7ff02246e2a58 /camel/camel-smime-context.c | |
parent | 06c8e307cc3a74d963dd680add15134094ae8d5f (diff) | |
download | gsoc2013-evolution-aedeb2fd7930d7e0779f2eb34f63f65bcf764ad7.tar.gz gsoc2013-evolution-aedeb2fd7930d7e0779f2eb34f63f65bcf764ad7.tar.zst gsoc2013-evolution-aedeb2fd7930d7e0779f2eb34f63f65bcf764ad7.zip |
remove debug printf.
2004-01-14 Not Zed <NotZed@Ximian.com>
* providers/local/camel-local-folder.c (local_getv): remove debug
printf.
** See bug #52835.
* camel-smime-context.c (sm_get_passwd): removed debugging. If we
get called multiple times in a row, then forget the old password
and re-prompt - it was a bad password. Zero out password memory
too.
svn path=/trunk/; revision=24208
Diffstat (limited to 'camel/camel-smime-context.c')
-rw-r--r-- | camel/camel-smime-context.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c index 5b29d47681..8b132b6968 100644 --- a/camel/camel-smime-context.c +++ b/camel/camel-smime-context.c @@ -65,6 +65,7 @@ struct _CamelSMIMEContextPrivate { char *encrypt_key; camel_smime_sign_t sign_mode; + int password_tries; unsigned int send_encrypt_key_prefs:1; }; @@ -92,16 +93,23 @@ sm_get_passwd(PK11SlotInfo *info, PRBool retry, void *arg) char *prompt; CamelException *ex; - printf("get passwd called '%s'\n", PK11_GetTokenName(info)); - ex = camel_exception_new(); + + /* we got a password, but its asking again, the password we had was wrong */ + if (context->priv->password_tries > 0) { + camel_session_forget_password(((CamelCipherContext *)context)->session, NULL, PK11_GetTokenName(info), NULL); + context->priv->password_tries = 0; + } + 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); + memset(pass, 0, strlen(pass)); g_free(pass); + context->priv->password_tries++; } return nsspass; @@ -1036,6 +1044,7 @@ camel_smime_context_init(CamelSMIMEContext *context) context->priv = g_malloc0(sizeof(*context->priv)); context->priv->certdb = CERT_GetDefaultCertDB(); context->priv->sign_mode = CAMEL_SMIME_SIGN_CLEARSIGN; + context->priv->password_tries = 0; } static void |