mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 22:58:21 +00:00
Merged revisions 126899 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r126899 | oej | 2008-07-01 16:27:33 +0200 (Tis, 01 Jul 2008) | 8 lines Handle escaped URI's in call pickups. Patch by oej and IgorG. Reported by: IgorG Patches: bug12299-11062-v2.patch uploaded by IgorG (license 20) Tested by: IgorG, oej (closes issue #12299) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@126900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -11178,6 +11178,7 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
|
|||||||
char tmpf[256] = "", *from = NULL;
|
char tmpf[256] = "", *from = NULL;
|
||||||
struct sip_request *req;
|
struct sip_request *req;
|
||||||
char *colon;
|
char *colon;
|
||||||
|
char *decoded_uri;
|
||||||
|
|
||||||
req = oreq;
|
req = oreq;
|
||||||
if (!req)
|
if (!req)
|
||||||
@@ -11275,25 +11276,25 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
|
|||||||
char hint[AST_MAX_EXTENSION];
|
char hint[AST_MAX_EXTENSION];
|
||||||
return (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten) ? 0 : -1);
|
return (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten) ? 0 : -1);
|
||||||
} else {
|
} else {
|
||||||
|
decoded_uri = ast_strdupa(uri);
|
||||||
|
ast_uri_decode(decoded_uri);
|
||||||
/* Check the dialplan for the username part of the request URI,
|
/* Check the dialplan for the username part of the request URI,
|
||||||
the domain will be stored in the SIPDOMAIN variable
|
the domain will be stored in the SIPDOMAIN variable
|
||||||
Since extensions.conf can have unescaped characters, try matching a decoded
|
Since extensions.conf can have unescaped characters, try matching a decoded
|
||||||
uri in addition to the non-decoded uri
|
uri in addition to the non-decoded uri
|
||||||
Return 0 if we have a matching extension */
|
Return 0 if we have a matching extension */
|
||||||
char *decoded_uri = ast_strdupa(uri);
|
|
||||||
ast_uri_decode(decoded_uri);
|
|
||||||
if (ast_exists_extension(NULL, p->context, uri, 1, S_OR(p->cid_num, from)) || ast_exists_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from)) ||
|
if (ast_exists_extension(NULL, p->context, uri, 1, S_OR(p->cid_num, from)) || ast_exists_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from)) ||
|
||||||
!strcmp(uri, ast_pickup_ext())) {
|
!strcmp(decoded_uri, ast_pickup_ext())) {
|
||||||
if (!oreq)
|
if (!oreq)
|
||||||
ast_string_field_set(p, exten, uri);
|
ast_string_field_set(p, exten, decoded_uri);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 for pickup extension or overlap dialling support (if we support it) */
|
/* Return 1 for pickup extension or overlap dialling support (if we support it) */
|
||||||
if((ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP) &&
|
if((ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP) &&
|
||||||
ast_canmatch_extension(NULL, p->context, uri, 1, S_OR(p->cid_num, from))) ||
|
ast_canmatch_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from))) ||
|
||||||
!strncmp(uri, ast_pickup_ext(), strlen(uri))) {
|
!strncmp(decoded_uri, ast_pickup_ext(), strlen(decoded_uri))) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17761,10 +17762,13 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
|
|||||||
if (gotdest == 1 && ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWOVERLAP))
|
if (gotdest == 1 && ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWOVERLAP))
|
||||||
transmit_response_reliable(p, "484 Address Incomplete", req);
|
transmit_response_reliable(p, "484 Address Incomplete", req);
|
||||||
else {
|
else {
|
||||||
|
char *decoded_exten = ast_strdupa(p->exten);
|
||||||
|
|
||||||
transmit_response_reliable(p, "404 Not Found", req);
|
transmit_response_reliable(p, "404 Not Found", req);
|
||||||
|
ast_uri_decode(decoded_exten);
|
||||||
ast_log(LOG_NOTICE, "Call from '%s' to extension"
|
ast_log(LOG_NOTICE, "Call from '%s' to extension"
|
||||||
" '%s' rejected because extension not found.\n",
|
" '%s' rejected because extension not found.\n",
|
||||||
S_OR(p->username, p->peername), p->exten);
|
S_OR(p->username, p->peername), decoded_exten);
|
||||||
}
|
}
|
||||||
p->invitestate = INV_COMPLETED;
|
p->invitestate = INV_COMPLETED;
|
||||||
update_call_counter(p, DEC_CALL_LIMIT);
|
update_call_counter(p, DEC_CALL_LIMIT);
|
||||||
|
Reference in New Issue
Block a user