[asterisk-dev] [Code Review] Ensure SIP responses only have one Via header
Mark Michelson
reviewboard at asterisk.org
Thu Nov 18 14:57:18 CST 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1019/#review2937
-----------------------------------------------------------
I think there's an edge case here that's not accounted for. When there are multiple SIP headers of a specific type, they can either be specified like the following:
Via: <blah1>
Via: <blah2>
Via: <blah3>
or they can be specified like the following:
Via: <blah1>,<blah2>,<blah3>
In the second case, I don't *think* that parse_request() will actually treat these as separate Via headers. If you are trying to fail a response due to its having multiple Via headers, then just using __get_header() won't do the trick.
The real fix for this would be to have parse_request recognize the second case as having multiple Via headers, thus allowing you to use __get_header() in order to iterate over each one. A temporary fix would be to use both __get_header() as well as a check to be sure that the Via line you initially found does not have another value on it as well.
Now, given the nature of how Vias are added to requests and removed from responses, it seems like a case where you will never actually see this occur. It's probably safe to just add what you have, especially since it wouldn't be adding any new breakage to the code.
- Mark
On 2010-11-18 14:34:42, Terry Wilson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1019/
> -----------------------------------------------------------
>
> (Updated 2010-11-18 14:34:42)
>
>
> Review request for Asterisk Developers and David Vossel.
>
>
> Summary
> -------
>
> 8.1.3.3 Vias
>
> If more than one Via header field value is present in a response, the
> UAC SHOULD discard the message.
>
> The presence of additional Via header field values that precede
> the originator of the request suggests that the message was
> misrouted or possibly corrupted.
>
>
> Diffs
> -----
>
> /branches/1.4/channels/chan_sip.c 295442
>
> Diff: https://reviewboard.asterisk.org/r/1019/diff
>
>
> Testing
> -------
>
> Used sipp to send a request with an extra via header; it was ignored. Valid responses still passed normally.
>
>
> Thanks,
>
> Terry
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20101118/27082575/attachment.htm
More information about the asterisk-dev
mailing list