Mercurial > hg
changeset 1222:75aee46d3aee
Fix a problem with the ssl_ca{file,path} variables expansion
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 17 May 2007 10:44:01 +0200 |
parents | 0dd5df7eb007 |
children | 591d8b35c881 |
files | mcabber/src/main.c mcabber/src/utils.c |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/main.c Thu May 10 13:22:31 2007 +0200 +++ b/mcabber/src/main.c Thu May 17 10:44:01 2007 +0200 @@ -71,7 +71,7 @@ int ssl; int sslverify = -1; const char *sslvopt = NULL, *cafile = NULL, *capath = NULL, *ciphers = NULL; - char *cafile_xp = NULL, *capath_xp = NULL; + static char *cafile_xp, *capath_xp; unsigned int port; servername = settings_opt_get("server"); @@ -80,6 +80,11 @@ resource = settings_opt_get("resource"); proxy_host = settings_opt_get("proxy_host"); + // Free the ca*_xp strings if they've already been set. + g_free(cafile_xp); + g_free(capath_xp); + cafile_xp = capath_xp = NULL; + if (!servername) { scr_LogPrint(LPRINT_NORMAL, "Server name has not been specified!"); return; @@ -113,11 +118,11 @@ cafile = capath = ciphers = NULL; } #endif - if (cafile) cafile_xp = expand_filename(cafile); - if (capath) capath_xp = expand_filename(capath); + cafile_xp = expand_filename(cafile); + capath_xp = expand_filename(capath); cw_set_ssl_options(sslverify, cafile_xp, capath_xp, ciphers, servername); - g_free(cafile_xp); - g_free(capath_xp); + // We can't free the ca*_xp variables now, because they're not duplicated + // in cw_set_ssl_options(). /* Connect to server */ scr_LogPrint(LPRINT_NORMAL|LPRINT_DEBUG, "Connecting to server: %s",
--- a/mcabber/src/utils.c Thu May 10 13:22:31 2007 +0200 +++ b/mcabber/src/utils.c Thu May 17 10:44:01 2007 +0200 @@ -50,6 +50,8 @@ // The caller must free the string after use. char *expand_filename(const char *fname) { + if (!fname) + return NULL; if (!strncmp(fname, "~/", 2)) { char *homedir = getenv("HOME"); if (homedir)