aboutsummaryrefslogtreecommitdiffstats
path: root/main/kamailio
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-10-31 16:54:33 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-10-31 16:59:16 +0200
commit3bec65c2a515813f60eb25ac55d2d7461d80a4b6 (patch)
tree40e7195a94d3fd58dd466c3f46df4b0e262e11d2 /main/kamailio
parent555633afe58703d75fc3d81343f5d1a6f35850ed (diff)
downloadaports-3bec65c2a515813f60eb25ac55d2d7461d80a4b6.tar.bz2
aports-3bec65c2a515813f60eb25ac55d2d7461d80a4b6.tar.xz
main/kamailio: fix a crash if db module is not loaded first
Diffstat (limited to 'main/kamailio')
-rw-r--r--main/kamailio/APKBUILD4
-rw-r--r--main/kamailio/fix-sql-module-loading-order.patch59
2 files changed, 62 insertions, 1 deletions
diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index b97dd43f2a..ec40384ee3 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=kamailio
pkgver=3.2.0
-pkgrel=0
+pkgrel=1
pkgdesc="Open Source SIP Proxy"
url="http://www.kamailio.org/"
pkgusers="kamailio"
@@ -17,6 +17,7 @@ install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-doc $pkgname-postgres $pkgname-presence $pkgname-pcre
$pkgname-mediaproxy $pkgname-unixodbc $pkgname-mysql $pkgname-sqlite $pkgname-lua"
source="http://www.kamailio.org/pub/kamailio/$pkgver/src/kamailio-${pkgver}_src.tar.gz
+ fix-sql-module-loading-order.patch
kamailio.cfg
kamailio.initd
"
@@ -182,5 +183,6 @@ unixodbc() {
}
md5sums="d2b452e5ec4927b2ec8decdda5966bd9 kamailio-3.2.0_src.tar.gz
+53cca39c47399eb2df20a1044d1e29eb fix-sql-module-loading-order.patch
a3c959ec568c43a905710e7d25cd8c25 kamailio.cfg
c0dc4e13d9e57feb99f016d3ee443c0b kamailio.initd"
diff --git a/main/kamailio/fix-sql-module-loading-order.patch b/main/kamailio/fix-sql-module-loading-order.patch
new file mode 100644
index 0000000000..5ba87e3288
--- /dev/null
+++ b/main/kamailio/fix-sql-module-loading-order.patch
@@ -0,0 +1,59 @@
+diff --git a/lib/srdb1/db_query.c b/lib/srdb1/db_query.c
+index dbde735..8efc15c 100644
+--- a/lib/srdb1/db_query.c
++++ b/lib/srdb1/db_query.c
+@@ -54,6 +54,10 @@ int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ if (!_c) {
+ ret = snprintf(sql_buf, sql_buffer_size, "select * from %.*s ", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+@@ -154,6 +158,10 @@ int db_do_insert_cmd(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ if(mode==1)
+ ret = snprintf(sql_buf, sql_buffer_size, "insert delayed into %.*s (",
+@@ -218,6 +226,10 @@ int db_do_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ ret = snprintf(sql_buf, sql_buffer_size, "delete from %.*s", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+ if (ret < 0 || ret >= sql_buffer_size) goto error;
+@@ -261,6 +273,10 @@ int db_do_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ ret = snprintf(sql_buf, sql_buffer_size, "update %.*s set ", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+ if (ret < 0 || ret >= sql_buffer_size) goto error;
+@@ -306,6 +322,10 @@ int db_do_replace(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ ret = snprintf(sql_buf, sql_buffer_size, "replace %.*s (", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+ if (ret < 0 || ret >= sql_buffer_size) goto error;