[gnio: 3/7] Use certificate credentials instead of anon



commit 48f2ee9745ff76bfb48f689e8ffa11d77f5f38e4
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Mon Mar 23 18:42:25 2009 +0000

    Use certificate credentials instead of anon
---
 gio/gtls.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gio/gtls.c b/gio/gtls.c
index d8ff2a3..8f2c87b 100644
--- a/gio/gtls.c
+++ b/gio/gtls.c
@@ -113,6 +113,8 @@ struct OPAQUE_TYPE__GTLSSession
   GTLSOp           write_op;
 
   gnutls_session_t session;
+
+  gnutls_certificate_credentials gnutls_cert_cred;
 };
 
 typedef struct
@@ -886,7 +888,6 @@ g_tls_session_pull_func (gpointer  user_data,
 static void
 g_tls_session_init (GTLSSession *session)
 {
-  gnutls_anon_client_credentials_t anoncred;
   static gsize initialised;
 
   if G_UNLIKELY (g_once_init_enter (&initialised))
@@ -896,9 +897,12 @@ g_tls_session_init (GTLSSession *session)
     }
 
   gnutls_init (&session->session, GNUTLS_CLIENT);
-  gnutls_anon_allocate_client_credentials (&anoncred);
-  gnutls_priority_set_direct (session->session, "PERFORMANCE:+ANON-DH", NULL);
-  gnutls_credentials_set (session->session, GNUTLS_CRD_ANON, anoncred);
+  gnutls_certificate_allocate_credentials (&session->gnutls_cert_cred);
+
+  gnutls_credentials_set (session->session,
+    GNUTLS_CRD_CERTIFICATE, session->gnutls_cert_cred);
+
+  gnutls_set_default_priority (session->session);
   gnutls_transport_set_push_function (session->session,
                                       g_tls_session_push_func);
   gnutls_transport_set_pull_function (session->session,
@@ -937,6 +941,7 @@ g_tls_session_finalize (GObject *object)
   GTLSSession *session = G_TLS_SESSION (object);
 
   gnutls_deinit (session->session);
+  gnutls_certificate_free_credentials (session->gnutls_cert_cred);
   g_object_unref (session->stream);
 
   G_OBJECT_CLASS (g_tls_session_parent_class)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]