aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-01 00:32:49 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-01 00:32:49 +0000
commit6b5164ab9d18d325656c8bb5d23eed400c7bf468 (patch)
tree965f2e3b40f63f7a6e6751bcb9c198410df1d3fd /channels
parentece4b1195387d81ba0aea1a381450ad4d5aa53f0 (diff)
Add some more sanity checking on IAX2 dial strings for the case that no peer
or hostname was provided, which is the one part of the dial string that is absolutely required. If it's not there, bail out. (closes issue #11897) Reported by sokhapkin Patch by me git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@101693 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index ca5c12fdc..efe3d6c00 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -3107,6 +3107,11 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
tmpstr = ast_strdupa(dest);
parse_dial_string(tmpstr, &pds);
+ if (ast_strlen_zero(pds.peer)) {
+ ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", dest);
+ return -1;
+ }
+
if (!pds.exten)
pds.exten = defaultrdest;
@@ -8695,16 +8700,15 @@ static struct ast_channel *iax2_request(const char *type, int format, void *data
tmpstr = ast_strdupa(data);
parse_dial_string(tmpstr, &pds);
+ if (ast_strlen_zero(pds.peer)) {
+ ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data);
+ return NULL;
+ }
+
memset(&cai, 0, sizeof(cai));
cai.capability = iax2_capability;
ast_copy_flags(&cai, &globalflags, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
-
- if (!pds.peer) {
- ast_log(LOG_WARNING, "No peer given\n");
- return NULL;
- }
-
/* Populate our address from the given */
if (create_addr(pds.peer, NULL, &sin, &cai)) {
@@ -10018,6 +10022,11 @@ static int cache_get_callno_locked(const char *data)
tmpstr = ast_strdupa(data);
parse_dial_string(tmpstr, &pds);
+ if (ast_strlen_zero(pds.peer)) {
+ ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", data);
+ return -1;
+ }
+
/* Populate our address from the given */
if (create_addr(pds.peer, NULL, &sin, &cai))
return -1;
@@ -10425,8 +10434,11 @@ static int iax2_devicestate(void *data)
memset(&pds, 0, sizeof(pds));
parse_dial_string(tmp, &pds);
- if (ast_strlen_zero(pds.peer))
+
+ if (ast_strlen_zero(pds.peer)) {
+ ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data);
return res;
+ }
if (option_debug > 2)
ast_log(LOG_DEBUG, "Checking device state for device %s\n", pds.peer);