aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-09-27 20:22:05 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-09-27 22:45:01 +0800
commit2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68 (patch)
tree1c248eec355592a0a8544e58de313bceb4a0860a
parent6d68c41da73744865afb2ddcdf6b0c82ce9fc6fb (diff)
downloadgsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.tar
gsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.tar.gz
gsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.tar.bz2
gsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.tar.lz
gsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.tar.xz
gsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.tar.zst
gsoc2013-evolution-2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68.zip
Adapt to CamelSession trust_prompt() changes.
-rw-r--r--libemail-engine/e-mail-session.c49
-rw-r--r--mail/e-mail-ui-session.c12
-rw-r--r--mail/e-mail-ui-session.h8
3 files changed, 35 insertions, 34 deletions
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 0dfa7ed2dc..c68a10ee3a 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -1404,42 +1404,48 @@ mail_session_alert_user (CamelSession *session,
static CamelCertTrust
mail_session_trust_prompt (CamelSession *session,
- const gchar *host,
- const gchar *certificate,
- guint32 certificate_errors,
- GList *issuers,
- GCancellable *cancellable)
+ CamelService *service,
+ GTlsCertificate *certificate,
+ GTlsCertificateFlags errors)
{
EUserPrompter *prompter;
ENamedParameters *parameters;
+ CamelSettings *settings;
CamelCertTrust response;
- gchar *errors_code;
- GList *iter;
+ GByteArray *der = NULL;
+ gchar *base64;
+ gchar *errhex;
+ gchar *host;
gint button_index;
- gint ii;
prompter = e_user_prompter_new ();
parameters = e_named_parameters_new ();
- errors_code = g_strdup_printf ("%x", certificate_errors);
- e_named_parameters_set (parameters, "host", host);
- e_named_parameters_set (parameters, "certificate", certificate);
- e_named_parameters_set (parameters, "certificate-errors", errors_code);
+ settings = camel_service_ref_settings (service);
+ g_return_val_if_fail (CAMEL_IS_NETWORK_SETTINGS (settings), 0);
+ host = camel_network_settings_dup_host (
+ CAMEL_NETWORK_SETTINGS (settings));
+ g_object_unref (settings);
- for (ii = 1, iter = issuers; iter; ii++, iter = iter->next) {
- gchar *name;
+ /* XXX No accessor function for this property. */
+ g_object_get (certificate, "certificate", &der, NULL);
+ g_return_val_if_fail (der != NULL, 0);
+ base64 = g_base64_encode (der->data, der->len);
+ g_byte_array_unref (der);
- if (!iter->data)
- break;
+ errhex = g_strdup_printf ("%x", (gint) errors);
- name = g_strdup_printf ("issuer-%d", ii);
- e_named_parameters_set (parameters, name, iter->data);
- g_free (name);
- }
+ e_named_parameters_set (parameters, "host", host);
+ e_named_parameters_set (parameters, "certificate", base64);
+ e_named_parameters_set (parameters, "certificate-errors", errhex);
+
+ g_free (host);
+ g_free (base64);
+ g_free (errhex);
button_index = e_user_prompter_extension_prompt_sync (
prompter, "ETrustPrompt::trust-prompt",
- parameters, NULL, cancellable, NULL);
+ parameters, NULL, NULL, NULL);
switch (button_index) {
case 0:
@@ -1456,7 +1462,6 @@ mail_session_trust_prompt (CamelSession *session,
break;
}
- g_free (errors_code);
e_named_parameters_free (parameters);
g_object_unref (prompter);
diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c
index b9e2690744..f76b94c142 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -678,16 +678,14 @@ e_mail_ui_session_alert_user (CamelSession *session,
CamelCertTrust
e_mail_ui_session_trust_prompt (CamelSession *session,
- const gchar *host,
- const gchar *certificate,
- guint32 certificate_errors,
- GList *issuers,
- GCancellable *cancellable)
+ CamelService *service,
+ GTlsCertificate *certificate,
+ GTlsCertificateFlags errors)
{
g_type_ensure (E_TYPE_MAIL_UI_SESSION);
- return CAMEL_SESSION_CLASS (e_mail_ui_session_parent_class)->trust_prompt (
- session, host, certificate, certificate_errors, issuers, cancellable);
+ return CAMEL_SESSION_CLASS (e_mail_ui_session_parent_class)->
+ trust_prompt (session, service, certificate, errors);
}
static CamelFilterDriver *
diff --git a/mail/e-mail-ui-session.h b/mail/e-mail-ui-session.h
index 9950219728..c73338c987 100644
--- a/mail/e-mail-ui-session.h
+++ b/mail/e-mail-ui-session.h
@@ -92,11 +92,9 @@ gint e_mail_ui_session_alert_user (CamelSession *session,
GList *button_captions,
GCancellable *cancellable);
CamelCertTrust e_mail_ui_session_trust_prompt (CamelSession *session,
- const gchar *host,
- const gchar *certificate,
- guint32 certificate_errors,
- GList *issuers,
- GCancellable *cancellable);
+ CamelService *service,
+ GTlsCertificate *certificate,
+ GTlsCertificateFlags errors);
gboolean e_mail_ui_session_check_known_address_sync
(EMailUISession *session,
CamelInternetAddress *addr,