[asterisk-addons-commits] tilghman: branch 1.6.0 r587 - in /branches/1.6.0: ./ cdr/cdr_addon_mysql.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Sun May 4 22:49:49 CDT 2008


Author: tilghman
Date: Sun May  4 22:49:49 2008
New Revision: 587

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=587
Log:
Merged revisions 586 via svnmerge from 
https://origsvn.digium.com/svn/asterisk-addons/trunk

........
r586 | tilghman | 2008-05-04 22:37:10 -0500 (Sun, 04 May 2008) | 9 lines

If you pass NULL as the default to my_load_config_string(), you get a string of
"(null)", which is NOT zero-length, and so things succeed where they should
fail.
(Closes issue #12580)
Reported by: pnlarsson
 Patches: 
       cdr_addon_mysql.c.patch uploaded by pnlarsson (license 79)
 Tested by: mvanbaak

........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/cdr/cdr_addon_mysql.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Sun May  4 22:49:49 2008
@@ -1,1 +1,1 @@
-/trunk:540-559,575,579,583
+/trunk:540-559,575,579,583,586

Modified: branches/1.6.0/cdr/cdr_addon_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/branches/1.6.0/cdr/cdr_addon_mysql.c?view=diff&rev=587&r1=586&r2=587
==============================================================================
--- branches/1.6.0/cdr/cdr_addon_mysql.c (original)
+++ branches/1.6.0/cdr/cdr_addon_mysql.c Sun May  4 22:49:49 2008
@@ -460,13 +460,13 @@
 	res |= my_load_config_string(cfg, "global", "hostname",  &hostname, "localhost");
 	res |= my_load_config_string(cfg, "global", "dbname", &dbname, "astriskcdrdb");
 	res |= my_load_config_string(cfg, "global", "user", &dbuser, "root");
-	res |= my_load_config_string(cfg, "global", "sock", &dbsock, NULL);
+	res |= my_load_config_string(cfg, "global", "sock", &dbsock, "");
 	res |= my_load_config_string(cfg, "global", "table", &dbtable, "cdr");
 	res |= my_load_config_string(cfg, "global", "password", &password, "");
 
-	res |= my_load_config_string(cfg, "global", "ssl_ca", &ssl_ca, NULL);
-	res |= my_load_config_string(cfg, "global", "ssl_cert", &ssl_cert, NULL);
-	res |= my_load_config_string(cfg, "global", "ssl_key", &ssl_key, NULL);
+	res |= my_load_config_string(cfg, "global", "ssl_ca", &ssl_ca, "");
+	res |= my_load_config_string(cfg, "global", "ssl_cert", &ssl_cert, "");
+	res |= my_load_config_string(cfg, "global", "ssl_key", &ssl_key, "");
 
 	res |= my_load_config_number(cfg, "global", "port", &dbport, 0);
 	res |= my_load_config_number(cfg, "global", "timeout", &timeout, 0);
@@ -522,11 +522,11 @@
 	}
 #endif
 
-	if (ssl_ca || ssl_cert || ssl_key) {
+	if ((ssl_ca && !ast_strlen_zero(ssl_ca->str)) || (ssl_cert && !ast_strlen_zero(ssl_cert->str)) || (ssl_key && !ast_strlen_zero(ssl_key->str))) {
 		mysql_ssl_set (&mysql, ssl_key->str, ssl_cert->str, ssl_ca->str, NULL, NULL);
 	}
 	temp = dbsock && !ast_strlen_zero(dbsock->str) ? dbsock->str : NULL;
-	if (!mysql_real_connect(&mysql, hostname->str, dbuser->str, password->str, dbname->str, dbport, temp, ssl_ca ? CLIENT_SSL : 0)) {
+	if (!mysql_real_connect(&mysql, hostname->str, dbuser->str, password->str, dbname->str, dbport, temp, ssl_ca && !ast_strlen_zero(ssl_ca->str) ? CLIENT_SSL : 0)) {
 		ast_log(LOG_ERROR, "Failed to connect to mysql database %s on %s.\n", dbname->str, hostname->str);
 		connected = 0;
 		records = 0;




More information about the asterisk-addons-commits mailing list