<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/1005/">https://reviewboard.asterisk.org/r/1005/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On November 9th, 2010, 12:33 p.m., <b>Olle E Johansson</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I think it&#39;s very dangerous to disable the verification of the auth. There has to be another way of fixing this. The retransmit should hit the same dialog and we still have the nonce. Why does the auth fail?</pre>
 </blockquote>




 <p>On November 9th, 2010, 1:27 p.m., <b>David Vossel</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The auth fails because the nonce can only be responded to once...  When a retransmission comes in check_auth() sees that the nonce has already been responded to and issues a new challenge. I don&#39;t think this is correct behavior.  In the case of a retransmit the current nonce probably shouldn&#39;t be treated as a stale nonce.</pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">We do the same thing in handle_request_invite.

    if (!p-&gt;lastinvite &amp;&amp; !ast_test_flag(req, SIP_PKT_IGNORE) &amp;&amp; !p-&gt;owner) {
        /* This is a new invite */
        /* Handle authentication if this is our first invite */
        res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin);

It is only disabling verification for retransmissions (unless I have messed up somewhere) and I checked that retransmissions that weren&#39;t authed aren&#39;t accepted. 

It fails the verification with &quot;Duplicate authentication received from ...&quot; because the auth request has already been responded to and we treat the nonce as stale. We then re-generate a 401, which is what breaks the polycom implementation.</pre>
<br />








<p>- Terry</p>


<br />
<p>On November 9th, 2010, 12:21 p.m., Terry Wilson wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers and David Vossel.</div>
<div>By Terry Wilson.</div>


<p style="color: grey;"><i>Updated 2010-11-09 12:21:48</i></p>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">From the issue:
0018075: Asterisk fails to recognize SUBSCRIBE retransmissions and tries to re-authenticate them, which breaks presence on polycom phones
Description         Here&#39;s what happens from asterisk point of view:
-&gt; SUBSCRIBE
&lt;- 401 Unauthorized
-&gt; SUBSCRIBE with auth
&lt;- 200 OK (lost)
&lt;- NOTIFY
-&gt; 200 OK for NOTIFY
-&gt; SUBSCRIBE with auth retransmission
&lt;- 401 Unauthorized
At this point polycom phone received 2 &quot;401 Unauthorized&quot; in a row and it completely gives up on resubscribing to this hint until reboot. While polycom behavior is questionable, I believe asterisk should recognize retransmission and resubmit 200OK in this case</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I created a sipp scenario mimicking the issue, it now re-sends a 200 OK when an authed retransmission occurs. I also tested a scenario that sent a retransmission without authentication to ensure that we didn&#39;t accept un-authed retransmissions.</pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/view.php?id=18075">18075</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/1.4/channels/chan_sip.c <span style="color: grey">(294120)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/1005/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>