summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/res_config_mysql.c66
-rw-r--r--cdr/cdr_pgsql.c42
-rw-r--r--channels/sig_pri.c10
-rw-r--r--res/res_rtp_asterisk.c5
4 files changed, 55 insertions, 68 deletions
diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c
index 640e06ef8..6e6224b8d 100644
--- a/addons/res_config_mysql.c
+++ b/addons/res_config_mysql.c
@@ -1202,38 +1202,44 @@ static int require_mysql(const char *database, const char *tablename, va_list ap
PICK_WHICH_ALTER_ACTION(bigint)
}
}
- } else if (strncmp(column->type, "float", 5) == 0 && !ast_rq_is_int(type) && type != RQ_FLOAT) {
- if (table->database->requirements == RQ_WARN) {
- ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type);
- res = -1;
- } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) {
- table_altered = 1;
- } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) {
- table_altered = 1;
- } else {
- res = -1;
+ } else if (strncmp(column->type, "float", 5) == 0) {
+ if (!ast_rq_is_int(type) && type != RQ_FLOAT) {
+ if (table->database->requirements == RQ_WARN) {
+ ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type);
+ res = -1;
+ } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) {
+ table_altered = 1;
+ } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) {
+ table_altered = 1;
+ } else {
+ res = -1;
+ }
}
- } else if ((strncmp(column->type, "datetime", 8) == 0 || strncmp(column->type, "timestamp", 9) == 0) && type != RQ_DATETIME) {
- if (table->database->requirements == RQ_WARN) {
- ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type);
- res = -1;
- } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) {
- table_altered = 1;
- } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) {
- table_altered = 1;
- } else {
- res = -1;
+ } else if (strncmp(column->type, "datetime", 8) == 0 || strncmp(column->type, "timestamp", 9) == 0) {
+ if (type != RQ_DATETIME) {
+ if (table->database->requirements == RQ_WARN) {
+ ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type);
+ res = -1;
+ } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) {
+ table_altered = 1;
+ } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) {
+ table_altered = 1;
+ } else {
+ res = -1;
+ }
}
- } else if ((strncmp(column->type, "date", 4) == 0) && type != RQ_DATE) {
- if (table->database->requirements == RQ_WARN) {
- ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type);
- res = -1;
- } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) {
- table_altered = 1;
- } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) {
- table_altered = 1;
- } else {
- res = -1;
+ } else if (strncmp(column->type, "date", 4) == 0) {
+ if (type != RQ_DATE) {
+ if (table->database->requirements == RQ_WARN) {
+ ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type);
+ res = -1;
+ } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) {
+ table_altered = 1;
+ } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) {
+ table_altered = 1;
+ } else {
+ res = -1;
+ }
}
} else { /* Other, possibly unsupported types? */
if (table->database->requirements == RQ_WARN) {
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 094a49254..aea56691b 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -670,42 +670,20 @@ static int config_module(int reload)
version = PQserverVersion(conn);
if (version >= 70300) {
- char *schemaname, *tablename;
+ char *schemaname, *tablename, *tmp_schemaname, *tmp_tablename;
if (strchr(table, '.')) {
- schemaname = ast_strdupa(table);
- tablename = strchr(schemaname, '.');
- *tablename++ = '\0';
+ tmp_schemaname = ast_strdupa(table);
+ tmp_tablename = strchr(tmp_schemaname, '.');
+ *tmp_tablename++ = '\0';
} else {
- schemaname = "";
- tablename = table;
+ tmp_schemaname = "";
+ tmp_tablename = table;
}
+ tablename = ast_alloca(strlen(tmp_tablename) * 2 + 1);
+ PQescapeStringConn(conn, tablename, tmp_tablename, strlen(tmp_tablename), NULL);
- /* Escape special characters in schemaname */
- if (strchr(schemaname, '\\') || strchr(schemaname, '\'')) {
- char *tmp = schemaname, *ptr;
-
- ptr = schemaname = ast_alloca(strlen(tmp) * 2 + 1);
- for (; *tmp; tmp++) {
- if (strchr("\\'", *tmp)) {
- *ptr++ = *tmp;
- }
- *ptr++ = *tmp;
- }
- *ptr = '\0';
- }
- /* Escape special characters in tablename */
- if (strchr(tablename, '\\') || strchr(tablename, '\'')) {
- char *tmp = tablename, *ptr;
-
- ptr = tablename = ast_alloca(strlen(tmp) * 2 + 1);
- for (; *tmp; tmp++) {
- if (strchr("\\'", *tmp)) {
- *ptr++ = *tmp;
- }
- *ptr++ = *tmp;
- }
- *ptr = '\0';
- }
+ schemaname = ast_alloca(strlen(tmp_schemaname) * 2 + 1);
+ PQescapeStringConn(conn, schemaname, tmp_schemaname, strlen(tmp_schemaname), NULL);
snprintf(sqlcmd, sizeof(sqlcmd), "SELECT a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc, a.atttypmod FROM (((pg_catalog.pg_class c INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace AND c.relname = '%s' AND n.nspname = %s%s%s) INNER JOIN pg_catalog.pg_attribute a ON (NOT a.attisdropped) AND a.attnum > 0 AND a.attrelid = c.oid) INNER JOIN pg_catalog.pg_type t ON t.oid = a.atttypid) LEFT OUTER JOIN pg_attrdef d ON a.atthasdef AND d.adrelid = a.attrelid AND d.adnum = a.attnum ORDER BY n.nspname, c.relname, attnum",
tablename,
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index a66d16b53..2815dac13 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -7102,10 +7102,11 @@ static void *pri_dchannel(void *vpri)
break;
}
if (pri->pvts[chanpos]->owner) {
- int do_hangup = 0;
-
snprintf(cause_str, sizeof(cause_str), "PRI PRI_EVENT_HANGUP (%d)", e->hangup.cause);
pri_queue_pvt_cause_data(pri, chanpos, cause_str, e->hangup.cause);
+ }
+ if (pri->pvts[chanpos]->owner) {
+ int do_hangup = 0;
/* Queue a BUSY instead of a hangup if our cause is appropriate */
ast_channel_hangupcause_set(pri->pvts[chanpos]->owner, e->hangup.cause);
@@ -7246,10 +7247,11 @@ static void *pri_dchannel(void *vpri)
break;
}
if (pri->pvts[chanpos]->owner) {
- int do_hangup = 0;
-
snprintf(cause_str, sizeof(cause_str), "PRI PRI_EVENT_HANGUP_REQ (%d)", e->hangup.cause);
pri_queue_pvt_cause_data(pri, chanpos, cause_str, e->hangup.cause);
+ }
+ if (pri->pvts[chanpos]->owner) {
+ int do_hangup = 0;
ast_channel_hangupcause_set(pri->pvts[chanpos]->owner, e->hangup.cause);
switch (ast_channel_state(pri->pvts[chanpos]->owner)) {
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index ed7dde01d..b78f6e24e 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -2016,8 +2016,9 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
#ifdef HAVE_OPENSSL_SRTP
dtls_srtp_check_pending(instance, rtp, rtcp);
- /* If this is an SSL packet pass it to OpenSSL for processing */
- if ((*in >= 20) && (*in <= 64)) {
+ /* If this is an SSL packet pass it to OpenSSL for processing. RFC section for first byte value:
+ * https://tools.ietf.org/html/rfc5764#section-5.1.2 */
+ if ((*in >= 20) && (*in <= 63)) {
struct dtls_details *dtls = !rtcp ? &rtp->dtls : &rtp->rtcp->dtls;
int res = 0;