aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-25 18:23:06 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-25 18:23:06 +0000
commit50a1f5c0c9d66d025f5ff4f585ab534fbaa8c8b3 (patch)
tree0d1d0997cceda0799317057aa833a7ecec56dd9e /channels
parentffc897aa1caf2e9da067041b0da11b43a8726c20 (diff)
Handle URL encoded stuff in pedantic checking
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3303 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index cf7462a82..d66ffd1d7 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -866,6 +866,30 @@ static int send_request(struct sip_pvt *p, struct sip_request *req, int reliable
return res;
}
+static void url_decode(char *s)
+{
+ char *o = s;
+ unsigned int tmp;
+ while(*s) {
+ switch(*s) {
+ case '%':
+ if (strlen(s) > 2) {
+ if (sscanf(s + 1, "%2x", &tmp) == 1) {
+ *o = tmp;
+ s += 2; /* Will be incremented once more when we break out */
+ break;
+ }
+ }
+ /* Fall through if something wasn't right with the formatting */
+ default:
+ *o = *s;
+ }
+ s++;
+ o++;
+ }
+ *o = '\0';
+}
+
/*--- ditch_braces: Pick out text in braces from character string ---*/
static char *ditch_braces(char *tmp)
{
@@ -1600,8 +1624,8 @@ static int hangup_sip2cause(int cause)
switch(cause) {
case 404: /* Not found */
return AST_CAUSE_UNALLOCATED;
- case 483: /* Too many hops */
- return AST_CAUSE_FAILURE;
+ case 483: /* Too many hops */
+ return AST_CAUSE_FAILURE;
case 486:
return AST_CAUSE_BUSY;
default:
@@ -4656,6 +4680,8 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
} else
strncpy(p->fromdomain, fr, sizeof(p->fromdomain) - 1);
}
+ if (pedanticsipchecking)
+ url_decode(c);
if (sip_debug_test_pvt(p))
ast_verbose("Looking for %s in %s\n", c, p->context);
if (ast_exists_extension(NULL, p->context, c, 1, fr) ||