diff options
| author | Milan Crha <mcrha@redhat.com> | 2022-05-18 14:55:18 +0200 |
|---|---|---|
| committer | Milan Crha <mcrha@redhat.com> | 2022-05-18 14:55:18 +0200 |
| commit | c6e74c6d9f77f26e0e37d0ded98b0ae0e2ee98b5 (patch) | |
| tree | e583a306fe3e85cb20f7f90a650b678a4c9e61f9 /src/modules | |
| parent | fb20021a55120b9633f4245fe1964be49c739f6d (diff) | |
| download | evolution-data-server-c6e74c6d9f77f26e0e37d0ded98b0ae0e2ee98b5.tar.gz | |
goa-ews: Handle certificate errors during autodiscover
If there was any certificate error during autodiscover on the GOA side,
the user explicitly ignored the error when creating the account, thus
the repeated autodiscover on the eds side can also ignore it.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/gnome-online-accounts/goaewsclient.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/modules/gnome-online-accounts/goaewsclient.c b/src/modules/gnome-online-accounts/goaewsclient.c index 4db6bcfc2..fa3c3e346 100644 --- a/src/modules/gnome-online-accounts/goaewsclient.c +++ b/src/modules/gnome-online-accounts/goaewsclient.c @@ -378,6 +378,34 @@ ews_post_restarted_cb (SoupMessage *msg, buf_content, buf_size); } +static gboolean +go_ews_client_accept_certificate_cb (GTlsConnection *conn, + GTlsCertificate *peer_cert, + GTlsCertificateFlags errors, + gpointer user_data) +{ + /* As much as EDS is interested, any certificate error during + autodiscover is ignored, because it had been allowed during + the GOA account creation. */ + + return TRUE; +} + +static void +goa_ews_client_network_event_cb (SoupMessage *msg, + GSocketClientEvent event, + GIOStream *connection, + gpointer user_data) +{ + /* It's either a GTlsConnection or a GTcpConnection */ + if (event == G_SOCKET_CLIENT_TLS_HANDSHAKING && + G_IS_TLS_CONNECTION (connection)) { + g_signal_connect ( + G_TLS_CONNECTION (connection), "accept-certificate", + G_CALLBACK (go_ews_client_accept_certificate_cb), NULL); + } +} + static SoupMessage * ews_create_msg_for_url (const gchar *url, xmlOutputBuffer *buf) @@ -390,6 +418,9 @@ ews_create_msg_for_url (const gchar *url, soup_message_headers_append ( msg->request_headers, "User-Agent", "libews/0.1"); + g_signal_connect (msg, "network-event", + G_CALLBACK (goa_ews_client_network_event_cb), NULL); + if (buf != NULL) { buf_content = compat_libxml_output_buffer_get_content (buf, &buf_size); soup_message_set_request ( |
