return (PK11SymKey *)arg;
}
-static char *
-sm_get_passwd(PK11SlotInfo *info, PRBool retry, void *arg)
-{
- CamelSMIMEContext *context = arg;
- char *pass, *nsspass = NULL;
- char *prompt;
- CamelException *ex;
-
- 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, 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, NULL, NULL, prompt,
- PK11_GetTokenName(info), CAMEL_SESSION_PASSWORD_SECRET|CAMEL_SESSION_PASSWORD_STATIC, 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;
-}
-
/**
* camel_smime_context_new:
* @session: session
dec = NSS_CMSDecoder_Start(NULL,
NULL, NULL,
- sm_get_passwd, context, /* password callback */
+ NULL, NULL, /* password callback */
NULL, NULL); /* decrypt key callback */
NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len);
enc = NSS_CMSEncoder_Start(cmsg,
sm_write_stream, ostream, /* DER output callback */
- NULL, NULL, /* destination storage */
- sm_get_passwd, context, /* password callback */
+ NULL, NULL, /* destination storage */
+ NULL, NULL, /* password callback */
NULL, NULL, /* decrypt key callback */
NULL, NULL ); /* detached digests */
if (!enc) {
dec = NSS_CMSDecoder_Start(NULL,
NULL, NULL, /* content callback */
- sm_get_passwd, context, /* password callback */
+ NULL, NULL, /* password callback */
NULL, NULL); /* decrypt key callback */
camel_data_wrapper_decode_to_stream(camel_medium_get_content_object((CamelMedium *)sigpart), (CamelStream *)mem);
enc = NSS_CMSEncoder_Start(cmsg,
sm_write_stream, ostream,
NULL, NULL,
- sm_get_passwd, context,
+ NULL, NULL,
sm_decrypt_key, bulkkey,
NULL, NULL);
if (enc == NULL) {
dec = NSS_CMSDecoder_Start(NULL,
sm_write_stream, ostream, /* content callback */
- sm_get_passwd, context, /* password callback */
+ NULL, NULL,
NULL, NULL); /* decrypt key callback */
if (NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len) != SECSuccess) {
{
/* say hello to the server */
char *name = NULL, *cmdbuf = NULL, *respbuf = NULL;
- const char *token;
- int numeric = FALSE;
+ const char *token, *numeric = NULL;
/* these are flags that we set, so unset them in case we
are being called a second time (ie, after a STARTTLS) */
if (camel_getnameinfo(transport->localaddr, transport->localaddrlen, &name, NULL, NI_NAMEREQD, NULL) != 0) {
if (camel_getnameinfo(transport->localaddr, transport->localaddrlen, &name, NULL, NI_NUMERICHOST, NULL) != 0)
name = g_strdup("localhost.localdomain");
- else
- numeric = TRUE;
+ else {
+ if (transport->localaddr->sa_family == AF_INET6)
+ numeric = "IPv6:";
+ else
+ numeric = "";
+ }
}
/* hiya server! how are you today? */
token = (transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP) ? "EHLO" : "HELO";
- cmdbuf = g_strdup_printf(numeric ? "%s [%s]\r\n" : "%s %s\r\n", token, name);
+ if (numeric)
+ cmdbuf = g_strdup_printf("%s [%s%s]\r\n", token, numeric, name);
+ else
+ cmdbuf = g_strdup_printf("%s %s\r\n", token, name);
g_free (name);
d(fprintf (stderr, "sending : %s", cmdbuf));