Patch attached.<div><br></div><div>Should this be cross posted to [sr-dev] if it contains a patch?</div><div><br></div><div>Richard<br><br><div class="gmail_quote">On 7 January 2013 01:10, Richard Brady <span dir="ltr"><<a href="mailto:rnbrady@gmail.com" target="_blank">rnbrady@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Agreed, doesn't make sense to me either.<div><br></div><div>The code is in the decode2format function in siputils/contact_ops.c:</div>
<div><br></div><div><div> if (((*pos) == '>')||(*pos == ';'))</div>
<div> {</div><div> /* invalid chars inside username part */</div><div> return -5;</div><div> }</div>
<div><br></div><div>The ABNF in RFC3261 makes it clear that a semicolon is ok in the user-info field:</div><div><br></div><div><div>userinfo = ( user / telephone-subscriber ) [ ":" password ] "@"</div>
<div>user = 1*( unreserved / escaped / user-unreserved )</div><div>user-unreserved = "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"</div>
</div><div><br></div><div>The code might be to check for the end of a URI (both those characters terminate a URI under certain circumstances), perhaps for fault tolerance and/or security but I don't think it's been done in a way that makes sense, for the following reasons:</div>
<div><br></div><div>1. An angle bracket is not legal in or surrounding a request URI, so it should be picked up by the parser and/or sanity check. </div><div>2. A semicolon is totally legal in the userinfo part, as per ABNF and also as explained in RFC3261:</div>
<div><br></div><div> ...</div><div> sip:alice;day=<a href="mailto:tuesday@atlanta.com" target="_blank">tuesday@atlanta.com</a></div><div><br></div><div> The last sample URI above has a user field value of</div><div>
"alice;day=tuesday". The escaping rules defined above allow a</div>
<div> semicolon to appear unescaped in this field. For the purposes of</div><div> this protocol, the field is opaque. The structure of that value is</div><div> only useful to the SIP element responsible for the resource.</div>
<div><br></div><div>So I have raised bug FS#263: <a href="http://sip-router.org/tracker/index.php?do=details&task_id=263" target="_blank">http://sip-router.org/tracker/index.php?do=details&task_id=263</a></div><div>
<br></div><div>
Richard</div><div><br></div><div><br></div><div class="gmail_quote"><div><div class="h5">On 3 January 2013 13:28, Gareth Rylance <span dir="ltr"><<a href="mailto:gareth@rylance.me.uk" target="_blank">gareth@rylance.me.uk</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Anyone?<div><br></div><div>If no one objects I will submit a patch with it removed.</div>
</div><div>
<div><div class="gmail_extra"><br><br><div class="gmail_quote">On 18 December 2012 09:11, Gareth Rylance <span dir="ltr"><<a href="mailto:gareth@rylance.me.uk" target="_blank">gareth@rylance.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>When using the siputils function encode_contact() on a message that contains a user parameter e.g.</div>
<div><br></div><div><sip:XXXXX00015;phone-context=national@10.YYY.1.92;user=phone>;tag=88930</div>
</div><div><br></div><div>it encodes fine e.g.</div><div><br></div><div><sip:natted_ua*sip:XXXXX00015;phone-context=national**192.168.242.102*5080*udp@10.YYY.70.100><br></div><div><br></div><div>but decode_contact() errors due to the ";" (there is an explicit check for it in the code)</div>
<div><br></div><div>I am currently working round this using</div><div><br></div><div>$rU = $(rU{s.replace,;,:});</div><div><br></div><div>to remove the ; as the user part is not needed for my application.</div>
<div><br></div><div>Would it be safe to remove the check for ";" ?</div><span><font color="#888888"><div><br></div><div>Gareth</div><div><br></div><div><br></div><div> </div><div><span style="white-space:pre-wrap">                        </span></div>
<div><br></div></font></span></div>
</blockquote></div><br></div>
</div></div><br></div></div>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>