[asterisk-bugs] [JIRA] (ASTERISK-20561) URI-Encoding within from-header for special character "#"

Walter Doekes (JIRA) noreply at issues.asterisk.org
Tue Oct 16 02:23:34 CDT 2012


    [ https://issues.asterisk.org/jira/browse/ASTERISK-20561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=198470#comment-198470 ] 

Walter Doekes edited comment on ASTERISK-20561 at 10/16/12 2:21 AM:
--------------------------------------------------------------------

You're right:
{noformat}
alphanum	=  ALPHA / DIGIT
mark		=  "-" / "_" / "." / "!" / "~" / "*" / "'"
                       / "(" / ")"
unreserved	=  alphanum / mark
user-unreserved	=  "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"

user		=  1*( unreserved / escaped / user-unreserved )
{noformat}

However, this is already fixed in asterisk 10 and higher.

Compare:
{noformat}
char *ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_flags spec)
{
        const char *ptr  = string;      /* Start with the string */
        char *out = outbuf;
        const char *mark = "-_.!~*'()"; /* no encode set, RFC 2396 section 2.3, RFC 3261 sec 25 */
        const char *user_unreserved = "&=+$,;?/"; /* user-unreserved set, RFC 3261 sec 25 */
{noformat}
with 1.8:
{noformat}
char *ast_uri_encode(const char *string, char *outbuf, int buflen, int do_special_char)
{
        const char *ptr  = string;      /* Start with the string */
        char *out = outbuf;
        const char *mark = "-_.!~*'()"; /* no encode set, RFC 2396 section 2.3, RFC 3261 sec 25 */
{noformat}

The easiest fix is to upgrade.

This change wasn't included in 1.8 for a reason, which I guess goes something like this:
/people expect their URIs in a certain way now, you can't change that mid-branch/

A quick glance through UPGRADE.txt does not show this change though. Perhaps that needs to be addressed.
                
      was (Author: wdoekes):
    You're right:
{noformat}
alphanum	=  ALPHA / DIGIT
mark		=  "-" / "_" / "." / "!" / "~" / "*" / "'"
                       / "(" / ")"
unreserved	=  alphanum / mark
user-unreserved	=  "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"

user		=  1*( unreserved / escaped / user-unreserved )
{noformat}

However, this is already fixed in asterisk 10 and higher.

Compare:
{noformat}
char *ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_flags spec)
{
        const char *ptr  = string;      /* Start with the string */
        char *out = outbuf;
        const char *mark = "-_.!~*'()"; /* no encode set, RFC 2396 section 2.3, RFC 3261 sec 25 */
        const char *user_unreserved = "&=+$,;?/"; /* user-unreserved set, RFC 3261 sec 25 */
{noformat}
with 1.8:
{noformat}
char *ast_uri_encode(const char *string, char *outbuf, int buflen, int do_special_char)
{
        const char *ptr  = string;      /* Start with the string */
        char *out = outbuf;
        const char *mark = "-_.!~*'()"; /* no encode set, RFC 2396 section 2.3, RFC 3261 sec 25 */
{noformat}

The easiest fix is to upgrade.

This change wasn't included in 1.8 for a reason, which I guess goes something like this:
/people expect their URIs in a certain way now, you can't change that mid-branch/

A quick glance through UPGRADE-1.8.txt does not show this change though. Perhaps that needs to be addressed.
                  
> URI-Encoding within from-header for special character "#"
> ---------------------------------------------------------
>
>                 Key: ASTERISK-20561
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20561
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/General
>    Affects Versions: 1.8.17.0
>            Reporter: Deniz
>
> When setting CALLERID(num)=#0012345678 asterisk is generating from-header:
> from: <sip:#0012345678 at 192.168.110.12>
> My understanding of RFC 3261 usernames are just allowed to contain alphanumeric characters, escape-sequences and some special characters (which do not include #).
> RFC 3261 refers to rfc2396 for more details which describes # as delimiter and not allowed to be part of URI.
> So, this character has to be replaced by "%23".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list