diff options
author | Stef Walter <stefw@collabora.co.uk> | 2010-12-03 02:08:51 +0800 |
---|---|---|
committer | Stef Walter <stefw@collabora.co.uk> | 2010-12-24 21:40:01 +0800 |
commit | 8d72b18028c35d887c2352e3f08aacd9b7096f4c (patch) | |
tree | 773f3615574bc7accead92879416222c9668869b /libempathy/empathy-tls-verifier.c | |
parent | c55c9a4dd8848f7257794dc9fc8f8138f1b47f43 (diff) | |
download | gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.tar gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.tar.gz gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.tar.bz2 gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.tar.lz gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.tar.xz gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.tar.zst gsoc2013-empathy-8d72b18028c35d887c2352e3f08aacd9b7096f4c.zip |
libempathy: Store certificate exceptions in gnome-keyring.
Use libgcr to store certificate trust exceptions properly.
Diffstat (limited to 'libempathy/empathy-tls-verifier.c')
-rw-r--r-- | libempathy/empathy-tls-verifier.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libempathy/empathy-tls-verifier.c b/libempathy/empathy-tls-verifier.c index 638b46bb7..3c547fb1c 100644 --- a/libempathy/empathy-tls-verifier.c +++ b/libempathy/empathy-tls-verifier.c @@ -489,3 +489,24 @@ empathy_tls_verifier_verify_finish (EmpathyTLSVerifier *self, return TRUE; } + +void +empathy_tls_verifier_store_exception (EmpathyTLSVerifier *self) +{ + GArray *last_cert; + GcrCertificate *cert; + GPtrArray *certs; + GError *error = NULL; + EmpathyTLSVerifierPriv *priv = GET_PRIV (self); + + g_object_get (priv->certificate, "cert-data", &certs, NULL); + last_cert = g_ptr_array_index (certs, certs->len - 1); + cert = gcr_simple_certificate_new_static ((gpointer)last_cert->data, + last_cert->len); + + if (!gcr_trust_add_certificate_exception (cert, GCR_PURPOSE_CLIENT_AUTH, + priv->hostname, NULL, &error)) + DEBUG ("Can't store the certificate exeption: %s", error->message); + + g_object_unref (cert); +} |