aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authorbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-09 18:51:52 +0000
committerbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-09 18:51:52 +0000
commit722eb3c4c3cfa1c0cee915c949c5f95199ee24dd (patch)
tree25683963c5e51bdedd6211cd0ea92a85639505c3 /pbx
parent815b5b09da5e555add7bba3d8fca588e7611248a (diff)
Merged revisions 285710 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r285710 | bbryant | 2010-09-09 14:50:13 -0400 (Thu, 09 Sep 2010) | 8 lines Fixes an issue with dialplan pattern matching where the specificity for pattern ranges and pattern special characters was inconsistent. (closes issue #16903) Reported by: Nick_Lewis Patches: pbx.c-specificity.patch uploaded by Nick Lewis (license 657) Tested by: Nick_Lewis ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@285711 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_config.c34
-rw-r--r--pbx/pbx_dundi.c1
-rw-r--r--pbx/pbx_loopback.c1
-rw-r--r--pbx/pbx_realtime.c4
-rw-r--r--pbx/pbx_spool.c15
5 files changed, 38 insertions, 17 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index ed1a2cd8c..0baa8e17c 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1456,15 +1456,15 @@ process_extension:
*cidmatch++ = '\0';
ast_shrink_phone_number(cidmatch);
}
- pri = S_OR(strsep(&stringp, ","), "");
- pri = ast_skip_blanks(pri);
- pri = ast_trim_blanks(pri);
+ pri = ast_strip(S_OR(strsep(&stringp, ","), ""));
if ((label = strchr(pri, '('))) {
*label++ = '\0';
if ((end = strchr(label, ')'))) {
*end = '\0';
} else {
ast_log(LOG_WARNING, "Label missing trailing ')' at line %d\n", v->lineno);
+ ast_free(tc);
+ continue;
}
}
if ((plus = strchr(pri, '+'))) {
@@ -1477,17 +1477,27 @@ process_extension:
ipri = lastpri + 1;
} else {
ast_log(LOG_WARNING, "Can't use 'next' priority on the first entry at line %d!\n", v->lineno);
+ ast_free(tc);
+ continue;
}
} else if (!strcmp(pri, "same") || !strcmp(pri, "s")) {
if (lastpri > -2) {
ipri = lastpri;
} else {
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry at line %d!\n", v->lineno);
+ ast_free(tc);
+ continue;
}
} else if (sscanf(pri, "%30d", &ipri) != 1 &&
(ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
ipri = 0;
+ ast_free(tc);
+ continue;
+ } else if (ipri < 1) {
+ ast_log(LOG_WARNING, "Invalid priority '%s' at line %d\n", pri, v->lineno);
+ ast_free(tc);
+ continue;
}
appl = S_OR(stringp, "");
/* Find the first occurrence of '(' */
@@ -1497,9 +1507,11 @@ process_extension:
} else {
char *orig_appl = ast_strdup(appl);
- if (!orig_appl)
- return -1;
-
+ if (!orig_appl) {
+ ast_free(tc);
+ continue;
+ }
+
appl = strsep(&stringp, "(");
/* check if there are variables or expressions without an application, like: exten => 100,hint,DAHDI/g0/${GLOBAL(var)} */
@@ -1526,8 +1538,8 @@ process_extension:
ipri += atoi(plus);
}
lastpri = ipri;
- if (!ast_opt_dont_warn && !strcmp(realext, "_.")) {
- ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->lineno);
+ if (!ast_opt_dont_warn && (!strcmp(realext, "_.") || !strcmp(realext, "_!"))) {
+ ast_log(LOG_WARNING, "The use of '%s' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X%c' instead at line %d\n", realext, realext[1], v->lineno);
}
if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), ast_free_ptr, registrar)) {
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
@@ -1737,13 +1749,13 @@ static int pbx_load_module(void)
static int load_module(void)
{
- if (pbx_load_module())
- return AST_MODULE_LOAD_DECLINE;
-
if (static_config && !write_protect_config)
ast_cli_register(&cli_dialplan_save);
ast_cli_register_multiple(cli_pbx_config, ARRAY_LEN(cli_pbx_config));
+ if (pbx_load_module())
+ return AST_MODULE_LOAD_DECLINE;
+
return AST_MODULE_LOAD_SUCCESS;
}
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index aaa30da0c..ef482df2c 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -4880,5 +4880,6 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Distributed Universal Nu
.load = load_module,
.unload = unload_module,
.reload = reload,
+ .nonoptreq = "res_crypto",
);
diff --git a/pbx/pbx_loopback.c b/pbx/pbx_loopback.c
index f51ec8204..9ab146398 100644
--- a/pbx/pbx_loopback.c
+++ b/pbx/pbx_loopback.c
@@ -41,7 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/utils.h"
-#include "asterisk/crypto.h"
#include "asterisk/astdb.h"
diff --git a/pbx/pbx_realtime.c b/pbx/pbx_realtime.c
index 833202af6..f183c867b 100644
--- a/pbx/pbx_realtime.c
+++ b/pbx/pbx_realtime.c
@@ -46,7 +46,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/utils.h"
-#include "asterisk/crypto.h"
#include "asterisk/astdb.h"
#include "asterisk/app.h"
#include "asterisk/astobj2.h"
@@ -349,7 +348,8 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
appdata[0] = 0; /* just in case the substitute var func isn't called */
if(!ast_strlen_zero(tmp))
pbx_substitute_variables_helper(chan, tmp, appdata, sizeof(appdata) - 1);
- ast_verb(3, "Executing %s(\"%s\", \"%s\")\n",
+ ast_verb(3, "Executing [%s@%s:%d] %s(\"%s\", \"%s\")\n",
+ chan->exten, chan->context, chan->priority,
term_color(tmp1, app, COLOR_BRCYAN, 0, sizeof(tmp1)),
term_color(tmp2, chan->name, COLOR_BRMAGENTA, 0, sizeof(tmp2)),
term_color(tmp3, S_OR(appdata, ""), COLOR_BRMAGENTA, 0, sizeof(tmp3)));
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 6c7b449a1..7a76aa84b 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -372,6 +372,7 @@ static void launch_service(struct outgoing *o)
}
}
+/* Called from scan_thread or queue_file */
static int scan_service(const char *fn, time_t now)
{
struct outgoing *o = NULL;
@@ -551,7 +552,7 @@ static void *scan_thread(void *unused)
}
#ifdef HAVE_INOTIFY
- inotify_add_watch(inotify_fd, qdir, IN_CREATE | IN_ATTRIB | IN_MOVED_TO);
+ inotify_add_watch(inotify_fd, qdir, IN_CREATE | IN_MOVED_TO);
#endif
/* First, run through the directory and clear existing entries */
@@ -590,8 +591,16 @@ static void *scan_thread(void *unused)
/* When a file arrives, add it to the queue, in mtime order. */
if ((res = poll(&pfd, 1, waittime)) > 0 && (stage = 1) &&
(res = read(inotify_fd, &buf, sizeof(buf))) >= sizeof(buf.iev)) {
- /* File added to directory, add it to my list */
- queue_file(buf.iev.name, 0);
+ /* File(s) added to directory, add them to my list */
+ do {
+ queue_file(buf.iev.name, 0);
+ res -= sizeof(buf.iev) + buf.iev.len;
+ if (res >= sizeof(buf.iev)) {
+ memmove(&buf.iev, &buf.iev.name[buf.iev.len], res);
+ continue;
+ }
+ break;
+ } while (1);
} else if (res < 0 && errno != EINTR && errno != EAGAIN) {
ast_debug(1, "Got an error back from %s(2): %s\n", stage ? "read" : "poll", strerror(errno));
}