[Xfce4-commits] <midori:master> get_tls_info: don't ref NULL, no error on tls_flags 0
Christian Dywan
noreply at xfce.org
Thu Apr 11 23:10:02 CEST 2013
Updating branch refs/heads/master
to cdc01c0ad8be0202ee25d26ed58e9f95bd343d42 (commit)
from a8cdf86cdca57e3b0672a9704d631b568952bdf9 (commit)
commit cdc01c0ad8be0202ee25d26ed58e9f95bd343d42
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Apr 11 22:35:29 2013 +0200
get_tls_info: don't ref NULL, no error on tls_flags 0
midori/midori-locationaction.c | 21 ++++++++++-----------
midori/midori-view.c | 8 +++++---
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index c956fef..b1016c2 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -1361,24 +1361,23 @@ midori_location_action_cert_response_cb (GtkWidget* dialog,
const gchar*
midori_location_action_tls_flags_to_string (GTlsCertificateFlags tls_flags)
{
- const gchar* tls_error;
if (tls_flags & G_TLS_CERTIFICATE_UNKNOWN_CA)
- tls_error = _("The signing certificate authority is not known.");
+ return _("The signing certificate authority is not known.");
else if (tls_flags & G_TLS_CERTIFICATE_BAD_IDENTITY)
- tls_error = _("The certificate does not match the expected identity of the site that it was retrieved from.");
+ return _("The certificate does not match the expected identity of the site that it was retrieved from.");
else if(tls_flags & G_TLS_CERTIFICATE_NOT_ACTIVATED)
- tls_error = _("The certificate's activation time is still in the future.");
+ return _("The certificate's activation time is still in the future.");
else if (tls_flags & G_TLS_CERTIFICATE_EXPIRED)
- tls_error = _("The certificate has expired");
+ return _("The certificate has expired");
else if (tls_flags & G_TLS_CERTIFICATE_REVOKED)
- tls_error = _("The certificate has been revoked according to the GTlsConnection's certificate revocation list.");
+ return _("The certificate has been revoked according to the GTlsConnection's certificate revocation list.");
else if (tls_flags & G_TLS_CERTIFICATE_INSECURE)
- tls_error = _("The certificate's algorithm is considered insecure.");
+ return _("The certificate's algorithm is considered insecure.");
else if (tls_flags & G_TLS_CERTIFICATE_GENERIC_ERROR)
- tls_error = _("Some other error occurred validating the certificate.");
- else
- tls_error = "Unknown GTLSCertificateFlags value";
- return tls_error;
+ return _("Some other error occurred validating the certificate.");
+ else if (tls_flags == 0)
+ g_return_val_if_reached ("GTLSCertificateFlags is 0");
+ g_return_val_if_reached ("Unknown GTLSCertificateFlags value");
}
void
diff --git a/midori/midori-view.c b/midori/midori-view.c
index f807fda..1d300c3 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -737,7 +737,8 @@ midori_view_get_tls_info (MidoriView* view,
WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
*hostname = midori_uri_parse_hostname (webkit_web_view_get_uri (web_view), NULL);
gboolean success = webkit_web_view_get_tls_info (web_view, tls_cert, tls_flags);
- g_object_ref (*tls_cert);
+ if (*tls_cert != NULL)
+ g_object_ref (*tls_cert);
return success;
#else
SoupMessage* message = midori_map_get_message (webkit_network_request_get_message (request));
@@ -746,8 +747,9 @@ midori_view_get_tls_info (MidoriView* view,
SoupURI* uri = soup_message_get_uri (message);
*hostname = uri ? g_strdup (uri->host) : NULL;
g_object_get (message, "tls-certificate", tls_cert, "tls-errors", tls_flags, NULL);
- return tls_flags == 0
- && soup_message_get_flags (message) & SOUP_MESSAGE_CERTIFICATE_TRUSTED;
+ if (soup_message_get_flags (message) & SOUP_MESSAGE_CERTIFICATE_TRUSTED)
+ return TRUE;
+ return tls_flags == 0;
}
*tls_cert = NULL;
*tls_flags = 0;
More information about the Xfce4-commits
mailing list