[Commits] socket.c 1.13.2.51 1.13.2.52 socket.h 1.13.2.27 1.13.2.28 ssl.c 1.9.2.57 1.9.2.58 ssl_certificate.c 1.4.2.46 1.4.2.47 ssl_certificate.h 1.1.4.20 1.1.4.21

colin at claws-mail.org colin at claws-mail.org
Fri Nov 23 20:29:18 CET 2012


Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv1449/src/common

Modified Files:
      Tag: gtk2
	socket.c socket.h ssl.c ssl_certificate.c ssl_certificate.h 
Log Message:
2012-11-23 [colin]	3.9.0cvs20

	* src/jpilot.c
	* src/main.c
	* src/mainwindow.c
	* src/matcher.c
	* src/prefs_common.c
	* src/prefs_common.h
	* src/procmsg.c
	* src/common/socket.c
	* src/common/socket.h
	* src/common/ssl.c
	* src/common/ssl_certificate.c
	* src/common/ssl_certificate.h
	* src/etpan/imap-thread.c
	* src/etpan/nntp-thread.c
		Cleanup some warnings and deprecated types. Patch by
		Christian Hesse, fixing bug #2617. Thanks!

Index: ssl.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/ssl.c,v
retrieving revision 1.9.2.57
retrieving revision 1.9.2.58
diff -u -d -r1.9.2.57 -r1.9.2.58
--- ssl.c	19 Sep 2012 14:48:46 -0000	1.9.2.57
+++ ssl.c	23 Nov 2012 19:29:15 -0000	1.9.2.58
@@ -52,21 +52,21 @@
 
 #ifdef USE_PTHREAD
 typedef struct _thread_data {
-	gnutls_session ssl;
+	gnutls_session_t ssl;
 	gboolean done;
 } thread_data;
 #endif
 
-static int gnutls_client_cert_cb(gnutls_session session,
-                               const gnutls_datum *req_ca_rdn, int nreqs,
-                               const gnutls_pk_algorithm *sign_algos,
+static int gnutls_client_cert_cb(gnutls_session_t session,
+                               const gnutls_datum_t *req_ca_rdn, int nreqs,
+                               const gnutls_pk_algorithm_t *sign_algos,
                                int sign_algos_length, gnutls_retr_st *st)
 {
 	SSLClientCertHookData hookdata;
 	SockInfo *sockinfo = (SockInfo *)gnutls_session_get_ptr(session);
-	gnutls_certificate_type type = gnutls_certificate_type_get(session);
-	gnutls_x509_crt crt;
-	gnutls_x509_privkey key;
+	gnutls_certificate_type_t type = gnutls_certificate_type_get(session);
+	gnutls_x509_crt_t crt;
+	gnutls_x509_privkey_t key;
 
 	st->ncerts = 0;
 
@@ -190,7 +190,7 @@
 }
 #endif
 
-static gint SSL_connect_nb(gnutls_session ssl)
+static gint SSL_connect_nb(gnutls_session_t ssl)
 {
 	int result;
 #ifdef USE_PTHREAD
@@ -251,11 +251,11 @@
 
 gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
 {
-	gnutls_session session;
+	gnutls_session_t session;
 	int r;
-	const gnutls_datum *raw_cert_list;
+	const gnutls_datum_t *raw_cert_list;
 	unsigned int raw_cert_list_length;
-	gnutls_x509_crt cert = NULL;
+	gnutls_x509_crt_t cert = NULL;
 	guint status;
 	gnutls_certificate_credentials_t xcred;
 
@@ -285,8 +285,11 @@
 	}
 	gnutls_certificate_set_verify_flags (xcred, GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);
 
-	gnutls_transport_set_ptr(session, (gnutls_transport_ptr) GINT_TO_POINTER(sockinfo->sock));
+	gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) GINT_TO_POINTER(sockinfo->sock));
 	gnutls_session_set_ptr(session, sockinfo);
+	/* TODO: gnutls_certificate_client_set_retrieve_function() is deprecated and should be replaced with
+	 * gnutls_certificate_set_retrieve_function() which was introduced in gnutls 2.12 in March 2011
+	 * getting this right with defines is not easy, so how long do we need compatibility to gntls <= 2.10? */
 	gnutls_certificate_client_set_retrieve_function(xcred, gnutls_client_cert_cb);
 
 	gnutls_dh_set_prime_bits(session, 512);

Index: socket.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/socket.c,v
retrieving revision 1.13.2.51
retrieving revision 1.13.2.52
diff -u -d -r1.13.2.51 -r1.13.2.52
--- socket.c	8 Nov 2012 11:42:26 -0000	1.13.2.51
+++ socket.c	23 Nov 2012 19:29:15 -0000	1.13.2.52
@@ -1388,7 +1388,7 @@
 }
 
 #if USE_GNUTLS
-static gint ssl_read(gnutls_session ssl, gchar *buf, gint len)
+static gint ssl_read(gnutls_session_t ssl, gchar *buf, gint len)
 {
 	gint r;
 
@@ -1453,7 +1453,7 @@
 }
 
 #if USE_GNUTLS
-static gint ssl_write(gnutls_session ssl, const gchar *buf, gint len)
+static gint ssl_write(gnutls_session_t ssl, const gchar *buf, gint len)
 {
 	gint ret;
 
@@ -1522,7 +1522,7 @@
 }
 
 #ifdef USE_GNUTLS
-static gint ssl_write_all(gnutls_session ssl, const gchar *buf, gint len)
+static gint ssl_write_all(gnutls_session_t ssl, const gchar *buf, gint len)
 {
 	gint n, wrlen = 0;
 

Index: ssl_certificate.h
===================================================================
RCS file: /home/claws-mail/claws/src/common/ssl_certificate.h,v
retrieving revision 1.1.4.20
retrieving revision 1.1.4.21
diff -u -d -r1.1.4.20 -r1.1.4.21
--- ssl_certificate.h	9 Aug 2012 11:32:26 -0000	1.1.4.20
+++ ssl_certificate.h	23 Nov 2012 19:29:15 -0000	1.1.4.21
@@ -39,7 +39,7 @@
 
 struct _SSLCertificate
 {
-	gnutls_x509_crt x509_cert;
+	gnutls_x509_crt_t x509_cert;
 	gchar *host;
 	gushort port;
 	gchar *fingerprint;
@@ -57,18 +57,18 @@
 };
 
 SSLCertificate *ssl_certificate_find (const gchar *host, gushort port, const gchar *fingerprint);
-gboolean ssl_certificate_check (gnutls_x509_crt x509_cert, guint status, const gchar *host, gushort port);
+gboolean ssl_certificate_check (gnutls_x509_crt_t x509_cert, guint status, const gchar *host, gushort port);
 void ssl_certificate_destroy(SSLCertificate *cert);
 void ssl_certificate_delete_from_disk(SSLCertificate *cert);
 char * readable_fingerprint(unsigned char *src, int len);
-char *ssl_certificate_check_signer (gnutls_x509_crt cert, guint status);
+char *ssl_certificate_check_signer (gnutls_x509_crt_t cert, guint status);
 
-gnutls_x509_crt ssl_certificate_get_x509_from_pem_file(const gchar *file);
-gnutls_x509_privkey ssl_certificate_get_pkey_from_pem_file(const gchar *file);
+gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file);
+gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file);
 void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file, 
-			const gchar *password, gnutls_x509_crt *crt, gnutls_x509_privkey *key);
-size_t gnutls_i2d_X509(gnutls_x509_crt x509_cert, unsigned char **output);
-size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey pkey, unsigned char **output);
+			const gchar *password, gnutls_x509_crt_t *crt, gnutls_x509_privkey_t *key);
+size_t gnutls_i2d_X509(gnutls_x509_crt_t x509_cert, unsigned char **output);
+size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output);
 gboolean ssl_certificate_check_subject_cn(SSLCertificate *cert);
 gchar *ssl_certificate_get_subject_cn(SSLCertificate *cert);
 #endif /* USE_GNUTLS */

Index: ssl_certificate.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/ssl_certificate.c,v
retrieving revision 1.4.2.46
retrieving revision 1.4.2.47
diff -u -d -r1.4.2.46 -r1.4.2.47
--- ssl_certificate.c	17 Oct 2012 07:52:47 -0000	1.4.2.46
+++ ssl_certificate.c	23 Nov 2012 19:29:15 -0000	1.4.2.47
@@ -88,12 +88,12 @@
 }
 
 #if USE_GNUTLS
-static gnutls_x509_crt x509_crt_copy(gnutls_x509_crt src)
+static gnutls_x509_crt_t x509_crt_copy(gnutls_x509_crt_t src)
 {
     int ret;
     size_t size;
-    gnutls_datum tmp;
-    gnutls_x509_crt dest;
+    gnutls_datum_t tmp;
+    gnutls_x509_crt_t dest;
     size = 0;
     
     if (gnutls_x509_crt_init(&dest) != 0) {
@@ -130,7 +130,7 @@
 }
 #endif
 
-static SSLCertificate *ssl_certificate_new(gnutls_x509_crt x509_cert, const gchar *host, gushort port)
+static SSLCertificate *ssl_certificate_new(gnutls_x509_crt_t x509_cert, const gchar *host, gushort port)
 {
 	SSLCertificate *cert = g_new0(SSLCertificate, 1);
 	size_t n;
@@ -153,7 +153,7 @@
 }
 
 #ifdef USE_GNUTLS
-static void gnutls_i2d_X509_fp(FILE *fp, gnutls_x509_crt x509_cert)
+static void gnutls_i2d_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert)
 {
 	char output[10*1024];
 	size_t cert_size = 10*1024;
@@ -169,7 +169,7 @@
 	}
 }
 
-size_t gnutls_i2d_X509(gnutls_x509_crt x509_cert, unsigned char **output)
+size_t gnutls_i2d_X509(gnutls_x509_crt_t x509_cert, unsigned char **output)
 {
 	size_t cert_size = 10*1024;
 	int r;
@@ -188,7 +188,7 @@
 	return cert_size;
 }
 
-size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey pkey, unsigned char **output)
+size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output)
 {
 	size_t key_size = 10*1024;
 	int r;
@@ -207,10 +207,10 @@
 	return key_size;
 }
 
-static gnutls_x509_crt gnutls_d2i_X509_fp(FILE *fp, int format)
+static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, int format)
 {
-	gnutls_x509_crt cert = NULL;
-	gnutls_datum tmp;
+	gnutls_x509_crt_t cert = NULL;
+	gnutls_datum_t tmp;
 	struct stat s;
 	int r;
 	if (fstat(fileno(fp), &s) < 0) {
@@ -237,10 +237,10 @@
 	return cert;
 }
 
-static gnutls_x509_privkey gnutls_d2i_key_fp(FILE *fp, int format)
+static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, int format)
 {
-	gnutls_x509_privkey key = NULL;
-	gnutls_datum tmp;
+	gnutls_x509_privkey_t key = NULL;
+	gnutls_datum_t tmp;
 	struct stat s;
 	int r;
 	if (fstat(fileno(fp), &s) < 0) {
@@ -270,7 +270,7 @@
 static gnutls_pkcs12_t gnutls_d2i_PKCS12_fp(FILE *fp, int format)
 {
 	gnutls_pkcs12_t p12 = NULL;
-	gnutls_datum tmp;
+	gnutls_datum_t tmp;
 	struct stat s;
 	int r;
 	if (fstat(fileno(fp), &s) < 0) {
@@ -364,7 +364,7 @@
 	gchar *file = NULL;
 	gchar *buf;
 	SSLCertificate *cert = NULL;
-	gnutls_x509_crt tmp_x509;
+	gnutls_x509_crt_t tmp_x509;
 	FILE *fp = NULL;
 	gboolean must_rename = FALSE;
 
@@ -469,12 +469,12 @@
 	return TRUE;
 }
 
-static guint check_cert(gnutls_x509_crt cert)
+static guint check_cert(gnutls_x509_crt_t cert)
 {
-	gnutls_x509_crt *ca_list;
+	gnutls_x509_crt_t *ca_list;
 	unsigned int max = 512;
 	unsigned int flags = 0;
-	gnutls_datum tmp;
+	gnutls_datum_t tmp;
 	struct stat s;
 	int r, i;
 	unsigned int status;
@@ -527,7 +527,7 @@
 
 }
 
-char *ssl_certificate_check_signer (gnutls_x509_crt cert, guint status) 
+char *ssl_certificate_check_signer (gnutls_x509_crt_t cert, guint status) 
 {
 	if (status == (guint)-1) {
 		status = check_cert(cert);
@@ -549,7 +549,7 @@
 	return NULL;
 }
 
-gboolean ssl_certificate_check (gnutls_x509_crt x509_cert, guint status, const gchar *host, gushort port)
+gboolean ssl_certificate_check (gnutls_x509_crt_t x509_cert, guint status, const gchar *host, gushort port)
 {
 	SSLCertificate *current_cert = NULL;
 	SSLCertificate *known_cert;
@@ -647,9 +647,9 @@
 	return TRUE;
 }
 
-gnutls_x509_crt ssl_certificate_get_x509_from_pem_file(const gchar *file)
+gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file)
 {
-	gnutls_x509_crt x509 = NULL;
+	gnutls_x509_crt_t x509 = NULL;
 	if (!file)
 		return NULL;
 	
@@ -670,9 +670,9 @@
 	return NULL;
 }
 
-gnutls_x509_privkey ssl_certificate_get_pkey_from_pem_file(const gchar *file)
+gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file)
 {
-	gnutls_x509_privkey key = NULL;
+	gnutls_x509_privkey_t key = NULL;
 	if (!file)
 		return NULL;
 	
@@ -697,7 +697,7 @@
 static int
 parse_pkcs12 (gnutls_pkcs12_t p12,
 	      const char *password,
-	      gnutls_x509_privkey * key,
+	      gnutls_x509_privkey_t * key,
 	      gnutls_x509_crt_t * cert)
 {
   gnutls_pkcs12_bag_t bag = NULL;
@@ -748,7 +748,7 @@
       for (i = 0; i < elements_in_bag; i++)
 	{
 	  int type;
-	  gnutls_datum data;
+	  gnutls_datum_t data;
 
 	  type = gnutls_pkcs12_bag_get_type (bag, i);
 	  if (type < 0)
@@ -818,7 +818,7 @@
   return ret;
 }
 void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file, const gchar *password,
-			gnutls_x509_crt *x509, gnutls_x509_privkey *pkey)
+			gnutls_x509_crt_t *x509, gnutls_x509_privkey_t *pkey)
 {
 	gnutls_pkcs12_t p12 = NULL;
 

Index: socket.h
===================================================================
RCS file: /home/claws-mail/claws/src/common/socket.h,v
retrieving revision 1.13.2.27
retrieving revision 1.13.2.28
diff -u -d -r1.13.2.27 -r1.13.2.28
--- socket.h	7 Jul 2012 07:30:56 -0000	1.13.2.27
+++ socket.h	23 Nov 2012 19:29:15 -0000	1.13.2.28
@@ -59,10 +59,10 @@
 {
 	gint sock;
 #if USE_GNUTLS
-	gnutls_session ssl;
+	gnutls_session_t ssl;
 	gnutls_certificate_credentials_t xcred;
-	gnutls_x509_crt client_crt;
-	gnutls_x509_privkey client_key;
+	gnutls_x509_crt_t client_crt;
+	gnutls_x509_privkey_t client_key;
 #endif
 	guint g_source;
 	GIOChannel *sock_ch;



More information about the Commits mailing list