<p>The patch looks ok, but I think we can do this a little bit more flexible: instead of having two functions <code>tls_check_from</code> and <code>tls_check_to</code>, why don't we add a single one, i.e. <code>tls_check_username("user")</code>, that can receive a pvar as input, and checks the certificate username against it.</p>

<p>This way you can practically authenticate the client based on its alias, or user-account, instead of simple to or from usernames.</p>

<p>What do you think about this approach?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/pull/716#issuecomment-187761962">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciYwGTzl3p9ga6iVNAZq-WTxi3yXVks5pnHibgaJpZM4Guai8.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSIPS/opensips/pull/716#issuecomment-187761962"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>