/pidgin/main: dc133578ccaa: cross-win32: FHS and system-provided...

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Apr 25 08:04:35 EDT 2014


Changeset: dc133578ccaa15963c81af4c8649a815e8502ca2
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-25 14:04 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/dc133578ccaa

Description:

cross-win32: FHS and system-provided certs

diffstat:

 configure.ac               |   8 +++++++-
 libpurple/certificate.c    |   7 ++++++-
 libpurple/win32/win32dep.c |  21 ++++++++++++++++++++-
 libpurple/win32/win32dep.h |   3 +++
 4 files changed, 36 insertions(+), 3 deletions(-)

diffs (102 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -2286,7 +2286,13 @@ if ! test -z "$ssl_certificates_dir" ; t
 		AC_MSG_ERROR([--with-system-ssl-certs requires that a location is specified, eg. --with-system-ssl-certs=/etc/pki/tls/certs])
 	fi
 	if ! test -d "$ssl_certificates_dir" ; then
-		AC_MSG_ERROR([$ssl_certificates_dir does not exist, if this is the correct location please make sure that it exists.])
+		if test "x$is_win32" = "xyes" ; then
+			AC_MSG_WARN([$ssl_certificates_dir does not exist. \
+It may be OK when cross-compiling, but please make sure about it.])
+		else
+			AC_MSG_ERROR([$ssl_certificates_dir does not exist, \
+if this is the correct location please make sure that it exists.])
+		fi
 	fi
 	SSL_CERTIFICATES_DIR="$ssl_certificates_dir"
 fi
diff --git a/libpurple/certificate.c b/libpurple/certificate.c
--- a/libpurple/certificate.c
+++ b/libpurple/certificate.c
@@ -919,9 +919,14 @@ x509_ca_init(void)
 	/* Attempt to point at the appropriate system path */
 	if (NULL == x509_ca_paths) {
 #ifdef SSL_CERTIFICATES_DIR
+#  ifdef USE_WIN32_FHS
+		x509_ca_paths = g_list_append(x509_ca_paths,
+			g_strdup(wpurple_cert_dir()));
+#  else
 		x509_ca_paths = g_list_append(x509_ca_paths,
 			g_strdup(SSL_CERTIFICATES_DIR));
-#endif
+#  endif /* USE_WIN32_FHS */
+#endif /* SSL_CERTIFICATES_DIR */
 #if defined(_WIN32) && !defined(USE_WIN32_FHS)
 		x509_ca_paths = g_list_append(x509_ca_paths, g_build_filename(
 			PURPLE_DATADIR, "ca-certs", NULL));
diff --git a/libpurple/win32/win32dep.c b/libpurple/win32/win32dep.c
--- a/libpurple/win32/win32dep.c
+++ b/libpurple/win32/win32dep.c
@@ -35,7 +35,8 @@
  * LOCALS
  */
 static char *app_data_dir = NULL, *bin_dir = NULL, *data_dir = NULL,
-	*lib_dir = NULL, *locale_dir = NULL, *sysconf_dir = NULL;
+	*lib_dir = NULL, *locale_dir = NULL, *sysconf_dir = NULL,
+	*cert_dir = NULL;
 
 static HINSTANCE libpurpledll_hInstance = NULL;
 
@@ -326,6 +327,22 @@ const char *wpurple_sysconf_dir(void)
 	return sysconf_dir;
 }
 
+#if defined(USE_WIN32_FHS) && defined(SSL_CERTIFICATES_DIR)
+const char *
+wpurple_cert_dir(void)
+{
+	static gboolean initialized = FALSE;
+
+	if (initialized)
+		return sysconf_dir;
+
+	sysconf_dir = wpurple_install_relative_path(SSL_CERTIFICATES_DIR);
+	initialized = TRUE;
+
+	return sysconf_dir;
+}
+#endif
+
 /* Miscellaneous */
 
 gboolean wpurple_write_reg_string(HKEY rootkey, const char *subkey, const char *valname,
@@ -652,6 +669,7 @@ void wpurple_cleanup(void) {
 	g_free(lib_dir);
 	g_free(locale_dir);
 	g_free(sysconf_dir);
+	g_free(cert_dir);
 
 	app_data_dir = NULL;
 	bin_dir = NULL;
@@ -659,6 +677,7 @@ void wpurple_cleanup(void) {
 	lib_dir = NULL;
 	locale_dir = NULL;
 	sysconf_dir = NULL;
+	cert_dir = NULL;
 
 	libpurpledll_hInstance = NULL;
 }
diff --git a/libpurple/win32/win32dep.h b/libpurple/win32/win32dep.h
--- a/libpurple/win32/win32dep.h
+++ b/libpurple/win32/win32dep.h
@@ -75,6 +75,9 @@ const char *wpurple_lib_dir(const char *
 const char *wpurple_locale_dir(void);
 const char *wpurple_home_dir(void);
 const char *wpurple_sysconf_dir(void);
+#if defined(USE_WIN32_FHS) && defined(SSL_CERTIFICATES_DIR)
+const char *wpurple_cert_dir(void);
+#endif
 
 /* init / cleanup */
 void wpurple_init(void);



More information about the Commits mailing list