[Commits] [SCM] claws branch, master, updated. 3.9.3-89-g47f156e

colin at claws-mail.org colin at claws-mail.org
Thu Apr 24 21:04:36 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  47f156eaaf407c46d7a34e93825d034ae5e82d7a (commit)
       via  39aa02d472461db2016ebb24c049774184049506 (commit)
       via  a38471fabadd6ff276435ae49c229512e870bee6 (commit)
       via  60be97e97f77ce37e789e0dc9ca491c3e7dc4ead (commit)
       via  a91b40b01b77afd7b9d933733455e845c630267b (commit)
      from  4d0f2b9b14819b26fbaa72ad129ec0c03e41400f (commit)


- Log -----------------------------------------------------------------
commit 47f156eaaf407c46d7a34e93825d034ae5e82d7a
Author: Colin Leroy <colin at colino.net>
Date:   Thu Apr 24 21:04:20 2014 +0200

    More cleanup

diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index 6155fe3..1381aa1 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -152,7 +152,6 @@ static SSLCertificate *ssl_certificate_new(gnutls_x509_crt_t x509_cert, const gc
 	return cert;
 }
 
-#ifdef USE_GNUTLS
 static void gnutls_export_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert, gnutls_x509_crt_fmt_t format)
 {
 	char output[10*1024];
@@ -163,9 +162,10 @@ static void gnutls_export_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert, gnutls_
 		g_warning("couldn't export cert %s (%zd)\n", gnutls_strerror(r), cert_size);
 		return;
 	}
+
 	debug_print("writing %zd bytes\n",cert_size);
 	if (fwrite(&output, 1, cert_size, fp) < cert_size) {
-		g_warning("failed to write cert\n");
+		g_warning("failed to write cert: %d %s\n", errno, strerror(errno));
 	}
 }
 
@@ -298,7 +298,7 @@ static gnutls_x509_privkey_t gnutls_import_key_fp(FILE *fp, gnutls_x509_crt_fmt_
 	}
 
 	gnutls_x509_privkey_init(&key);
-	if ((r = gnutls_x509_privkey_import(key, &tmp, (format == 0)?GNUTLS_X509_FMT_DER:GNUTLS_X509_FMT_PEM)) < 0) {
+	if ((r = gnutls_x509_privkey_import(key, &tmp, format)) < 0) {
 		debug_print("key import failed: %s\n", gnutls_strerror(r));
 		gnutls_x509_privkey_deinit(key);
 		key = NULL;
@@ -331,7 +331,7 @@ static gnutls_pkcs12_t gnutls_import_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t f
 
 	gnutls_pkcs12_init(&p12);
 
-	if ((r = gnutls_pkcs12_import(p12, &tmp, (format == 0)?GNUTLS_X509_FMT_DER:GNUTLS_X509_FMT_PEM,0)) < 0) {
+	if ((r = gnutls_pkcs12_import(p12, &tmp, format, 0)) < 0) {
 		log_error(LOG_PROTOCOL, _("Cannot import P12 certificate file (%s)\n"),
 				  gnutls_strerror(r));
 		gnutls_pkcs12_deinit(p12);
@@ -342,8 +342,6 @@ static gnutls_pkcs12_t gnutls_import_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t f
 	return p12;
 }
 
-#endif
-
 static void ssl_certificate_save (SSLCertificate *cert)
 {
 	gchar *file, *port;
@@ -438,6 +436,7 @@ SSLCertificate *ssl_certificate_find (const gchar *host, gushort port, const gch
 		debug_print("got cert %p\n", cert);
 		gnutls_x509_crt_deinit(tmp_x509);
 	}
+
 	fclose(fp);
 	g_free(file);
 	

commit 39aa02d472461db2016ebb24c049774184049506
Author: Colin Leroy <colin at colino.net>
Date:   Thu Apr 24 20:45:45 2014 +0200

    Rename i2d/d2i internal functions to clearer import/export.

diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index e5c9f0a..6155fe3 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -153,13 +153,13 @@ static SSLCertificate *ssl_certificate_new(gnutls_x509_crt_t x509_cert, const gc
 }
 
 #ifdef USE_GNUTLS
-static void gnutls_i2d_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert)
+static void gnutls_export_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert, gnutls_x509_crt_fmt_t format)
 {
 	char output[10*1024];
 	size_t cert_size = 10*1024;
 	int r;
 	
-	if ((r = gnutls_x509_crt_export(x509_cert, GNUTLS_X509_FMT_DER, output, &cert_size)) < 0) {
+	if ((r = gnutls_x509_crt_export(x509_cert, format, output, &cert_size)) < 0) {
 		g_warning("couldn't export cert %s (%zd)\n", gnutls_strerror(r), cert_size);
 		return;
 	}
@@ -207,7 +207,7 @@ size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output)
 	return key_size;
 }
 
-static int gnutls_d2i_X509_list_fp(FILE *fp, gnutls_x509_crt_fmt_t format,
+static int gnutls_import_X509_list_fp(FILE *fp, gnutls_x509_crt_fmt_t format,
 				   gnutls_x509_crt_t **cert_list, gint *num_certs)
 {
 	gnutls_x509_crt_t *crt_list;
@@ -256,13 +256,13 @@ static int gnutls_d2i_X509_list_fp(FILE *fp, gnutls_x509_crt_fmt_t format,
 }
 
 /* return one certificate, read from file */
-static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
+static gnutls_x509_crt_t gnutls_import_X509_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
 {
 	gnutls_x509_crt_t *certs = NULL;
 	gnutls_x509_crt_t cert = NULL;
 	int i, ncerts, r;
 
-	if ((r = gnutls_d2i_X509_list_fp(fp, format, &certs, &ncerts)) < 0) {
+	if ((r = gnutls_import_X509_list_fp(fp, format, &certs, &ncerts)) < 0) {
 		return NULL;
 	}
 
@@ -278,7 +278,7 @@ static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, gnutls_x509_crt_fmt_t form
 	return cert;
 }
 
-static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
+static gnutls_x509_privkey_t gnutls_import_key_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
 {
 	gnutls_x509_privkey_t key = NULL;
 	gnutls_datum_t tmp;
@@ -308,7 +308,7 @@ static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, gnutls_x509_crt_fmt_t f
 	return key;
 }
 
-static gnutls_pkcs12_t gnutls_d2i_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
+static gnutls_pkcs12_t gnutls_import_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
 {
 	gnutls_pkcs12_t p12 = NULL;
 	gnutls_datum_t tmp;
@@ -367,7 +367,7 @@ static void ssl_certificate_save (SSLCertificate *cert)
 		return;
 	}
 
-	gnutls_i2d_X509_fp(fp, cert->x509_cert);
+	gnutls_export_X509_fp(fp, cert->x509_cert, GNUTLS_X509_FMT_DER);
 
 	g_free(file);
 	fclose(fp);
@@ -433,7 +433,7 @@ SSLCertificate *ssl_certificate_find (const gchar *host, gushort port, const gch
 		return NULL;
 	}
 	
-	if ((tmp_x509 = gnutls_d2i_X509_fp(fp, GNUTLS_X509_FMT_DER)) != NULL) {
+	if ((tmp_x509 = gnutls_import_X509_fp(fp, GNUTLS_X509_FMT_DER)) != NULL) {
 		cert = ssl_certificate_new(tmp_x509, host, port);
 		debug_print("got cert %p\n", cert);
 		gnutls_x509_crt_deinit(tmp_x509);
@@ -522,7 +522,7 @@ static guint check_cert(gnutls_x509_crt_t cert)
 	else
 		return (guint)-1;
 
-	if ((r = gnutls_d2i_X509_list_fp(fp, GNUTLS_X509_FMT_PEM, &ca_list, &max)) < 0) {
+	if ((r = gnutls_import_X509_list_fp(fp, GNUTLS_X509_FMT_PEM, &ca_list, &max)) < 0) {
 		debug_print("cert import failed: %s\n", gnutls_strerror(r));
 		fclose(fp);
 		return (guint)-1;
@@ -676,7 +676,7 @@ gboolean ssl_certificate_check_chain(gnutls_x509_crt_t *certs, gint chain_len, c
 		int r = -errno;
 
 		if (fp) {
-			r = gnutls_d2i_X509_list_fp(fp, GNUTLS_X509_FMT_PEM, &cas, &ncas);
+			r = gnutls_import_X509_list_fp(fp, GNUTLS_X509_FMT_PEM, &cas, &ncas);
 			fclose(fp);
 		}
 
@@ -714,7 +714,7 @@ gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file)
 	if (is_file_exist(file)) {
 		FILE *fp = g_fopen(file, "r");
 		if (fp) {
-			x509 = gnutls_d2i_X509_fp(fp, GNUTLS_X509_FMT_PEM);
+			x509 = gnutls_import_X509_fp(fp, GNUTLS_X509_FMT_PEM);
 			fclose(fp);
 			return x509;
 		} else {
@@ -737,7 +737,7 @@ gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file)
 	if (is_file_exist(file)) {
 		FILE *fp = g_fopen(file, "r");
 		if (fp) {
-			key = gnutls_d2i_key_fp(fp, GNUTLS_X509_FMT_PEM);
+			key = gnutls_import_key_fp(fp, GNUTLS_X509_FMT_PEM);
 			fclose(fp);
 			return key;
 		} else {
@@ -890,7 +890,7 @@ void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file, const gc
 	if (is_file_exist(file)) {
 		FILE *fp = g_fopen(file, "r");
 		if (fp) {
-			p12 = gnutls_d2i_PKCS12_fp(fp, GNUTLS_X509_FMT_DER);
+			p12 = gnutls_import_PKCS12_fp(fp, GNUTLS_X509_FMT_DER);
 			fclose(fp);
 			if (!p12) {
 				log_error(LOG_PROTOCOL, _("Failed to read P12 certificate file %s\n"), file);

commit a38471fabadd6ff276435ae49c229512e870bee6
Author: Colin Leroy <colin at colino.net>
Date:   Thu Apr 24 20:36:32 2014 +0200

    Fix using ints for gnutls_x509_crt_fmt_t.

diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index ea8cd8e..e5c9f0a 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -207,7 +207,8 @@ size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output)
 	return key_size;
 }
 
-static int gnutls_d2i_X509_list_fp(FILE *fp, int format, gnutls_x509_crt_t **cert_list, gint *num_certs)
+static int gnutls_d2i_X509_list_fp(FILE *fp, gnutls_x509_crt_fmt_t format,
+				   gnutls_x509_crt_t **cert_list, gint *num_certs)
 {
 	gnutls_x509_crt_t *crt_list;
 	unsigned int max = 512;
@@ -255,7 +256,7 @@ static int gnutls_d2i_X509_list_fp(FILE *fp, int format, gnutls_x509_crt_t **cer
 }
 
 /* return one certificate, read from file */
-static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, int format)
+static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
 {
 	gnutls_x509_crt_t *certs = NULL;
 	gnutls_x509_crt_t cert = NULL;
@@ -277,7 +278,7 @@ static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, int format)
 	return cert;
 }
 
-static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, int format)
+static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
 {
 	gnutls_x509_privkey_t key = NULL;
 	gnutls_datum_t tmp;
@@ -307,7 +308,7 @@ static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, int format)
 	return key;
 }
 
-static gnutls_pkcs12_t gnutls_d2i_PKCS12_fp(FILE *fp, int format)
+static gnutls_pkcs12_t gnutls_d2i_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t format)
 {
 	gnutls_pkcs12_t p12 = NULL;
 	gnutls_datum_t tmp;
@@ -432,7 +433,7 @@ SSLCertificate *ssl_certificate_find (const gchar *host, gushort port, const gch
 		return NULL;
 	}
 	
-	if ((tmp_x509 = gnutls_d2i_X509_fp(fp, 0)) != NULL) {
+	if ((tmp_x509 = gnutls_d2i_X509_fp(fp, GNUTLS_X509_FMT_DER)) != NULL) {
 		cert = ssl_certificate_new(tmp_x509, host, port);
 		debug_print("got cert %p\n", cert);
 		gnutls_x509_crt_deinit(tmp_x509);
@@ -713,7 +714,7 @@ gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file)
 	if (is_file_exist(file)) {
 		FILE *fp = g_fopen(file, "r");
 		if (fp) {
-			x509 = gnutls_d2i_X509_fp(fp, 1);
+			x509 = gnutls_d2i_X509_fp(fp, GNUTLS_X509_FMT_PEM);
 			fclose(fp);
 			return x509;
 		} else {
@@ -736,7 +737,7 @@ gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file)
 	if (is_file_exist(file)) {
 		FILE *fp = g_fopen(file, "r");
 		if (fp) {
-			key = gnutls_d2i_key_fp(fp, 1);
+			key = gnutls_d2i_key_fp(fp, GNUTLS_X509_FMT_PEM);
 			fclose(fp);
 			return key;
 		} else {
@@ -889,7 +890,7 @@ void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file, const gc
 	if (is_file_exist(file)) {
 		FILE *fp = g_fopen(file, "r");
 		if (fp) {
-			p12 = gnutls_d2i_PKCS12_fp(fp, 0);
+			p12 = gnutls_d2i_PKCS12_fp(fp, GNUTLS_X509_FMT_DER);
 			fclose(fp);
 			if (!p12) {
 				log_error(LOG_PROTOCOL, _("Failed to read P12 certificate file %s\n"), file);

commit 60be97e97f77ce37e789e0dc9ca491c3e7dc4ead
Author: Colin Leroy <colin at colino.net>
Date:   Thu Apr 24 20:30:08 2014 +0200

    Remove dead code from OpenSSL days

diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index 48e55c9..ea8cd8e 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -365,11 +365,9 @@ static void ssl_certificate_save (SSLCertificate *cert)
 		debug_print("Can't save certificate !\n");
 		return;
 	}
-#ifdef USE_GNUTLS
+
 	gnutls_i2d_X509_fp(fp, cert->x509_cert);
-#else
-	i2d_X509_fp(fp, cert->x509_cert);
-#endif
+
 	g_free(file);
 	fclose(fp);
 

commit a91b40b01b77afd7b9d933733455e845c630267b
Author: Colin Leroy <colin at colino.net>
Date:   Thu Apr 24 20:21:45 2014 +0200

    Fix claws exports for windows

diff --git a/src/plugins/libravatar/claws.def b/src/plugins/libravatar/claws.def
index e7533f6..eb48bb6 100644
--- a/src/plugins/libravatar/claws.def
+++ b/src/plugins/libravatar/claws.def
@@ -1,15 +1,19 @@
 LIBRARY CLAWS-MAIL.EXE
 EXPORTS
+extract_address
 get_locale_dir
 check_plugin_version
 conv_codeset_strdup
 conv_get_locale_charset_str_no_utf8
 debug_print_real
 debug_srcname
+file_exist
 get_rc_dir
 hooks_register_hook
 hooks_unregister_hook
+is_dir_exist
 line_has_quote_char
+make_dir
 pref_get_escaped_pref
 pref_get_unescaped_pref
 prefs_common
@@ -23,3 +27,6 @@ prefs_set_default
 prefs_write_open
 prefs_write_param
 prefs_common_get_prefs
+procmsg_msginfo_add_avatar
+procmsg_msginfo_get_avatar
+md5_hex_digest

-----------------------------------------------------------------------

Summary of changes:
 src/common/ssl_certificate.c     |   46 ++++++++++++++++++--------------------
 src/plugins/libravatar/claws.def |    7 ++++++
 2 files changed, 29 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list