[asterisk-commits] wdoekes: trunk r343394 - in /trunk: ./ res/res_config_sqlite.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 3 15:37:56 CDT 2011


Author: wdoekes
Date: Thu Nov  3 15:37:50 2011
New Revision: 343394

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=343394
Log:
Fix sqlite config driver segfault and broken queries

The sqlite realtime handler assumed you had a static config configured
as well. The realtime multientry handler assumed that you weren't using
dynamic realtime.

(closes issue ASTERISK-18354)
(closes issue ASTERISK-18355)

Review: https://reviewboard.asterisk.org/r/1561
........

Merged revisions 343375 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 343393 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/res/res_config_sqlite.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/res/res_config_sqlite.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_config_sqlite.c?view=diff&rev=343394&r1=343393&r2=343394
==============================================================================
--- trunk/res/res_config_sqlite.c (original)
+++ trunk/res/res_config_sqlite.c Thu Nov  3 15:37:50 2011
@@ -1055,7 +1055,7 @@
 #define QUERY "SELECT * FROM '%q' WHERE%s %q%s '%q'"
 /* \endcond */
 
-	query = sqlite_mprintf(QUERY, table, !strcmp(config_table, table) ? " commented = 0 AND" : "", params[0], op, vals[0]);
+	query = sqlite_mprintf(QUERY, table, (config_table && !strcmp(config_table, table)) ? " commented = 0 AND" : "", params[0], op, vals[0]);
 
 	if (!query) {
 		ast_log(LOG_WARNING, "Unable to allocate SQL query\n");
@@ -1216,10 +1216,10 @@
 
 /* \cond DOXYGEN_CAN_PARSE_THIS */
 #undef QUERY
-#define QUERY "SELECT * FROM '%q' WHERE commented = 0 AND %q%s '%q'"
+#define QUERY "SELECT * FROM '%q' WHERE%s %q%s '%q'"
 /* \endcond */
 
-	if (!(query = sqlite_mprintf(QUERY, table, params[0], op, tmp_str))) {
+	if (!(query = sqlite_mprintf(QUERY, table, (config_table && !strcmp(config_table, table)) ? " commented = 0 AND" : "", params[0], op, tmp_str))) {
 		ast_log(LOG_WARNING, "Unable to allocate SQL query\n");
 		ast_config_destroy(cfg);
 		ast_free(params);




More information about the asterisk-commits mailing list