[asterisk-commits] rizzo: branch rizzo/astobj2 r45806 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Oct 20 15:04:41 MST 2006


Author: rizzo
Date: Fri Oct 20 17:04:40 2006
New Revision: 45806

URL: http://svn.digium.com/view/asterisk?rev=45806&view=rev
Log:
experimental code to match incoming calls with the
"username" field in auth info, so that even if we mismatch
the peer entry on the invite-without-auth, we still do
the right thing and don't refuse the call when the auth
info is available.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?rev=45806&r1=45805&r2=45806&view=diff
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Oct 20 17:04:40 2006
@@ -8909,6 +8909,22 @@
 	}
 	if (ast_strlen_zero(of))
 		return AUTH_SUCCESSFUL;
+
+	if (1) {
+		/*
+		 * XXX This is experimental code to grab the search key from the
+		 * Auth header's username instead of the 'From' name, if available.
+		 * Do not enable this block unless you understand the side effects (if any!)
+		 * Note, the search for "username" should be done in a more robust way.
+		 */
+		const char *hdr = (sipmethod == SIP_REGISTER || sipmethod == SIP_SUBSCRIBE) ?
+			"Authorization" : "Proxy-Authorization";
+		if ( (hdr = get_header(req, hdr)) && (hdr = strstr(hdr, "username=\"")) ) {
+			ast_copy_string(from, hdr + strlen("username=\""), sizeof(from));
+			of = from;
+			of = strsep(&of, "\"");
+		}
+	}
 
 	if (!authpeer)	/* If we are looking for a peer, don't check the user objects (or realtime) */
 		user = find_user(of, 1);



More information about the asterisk-commits mailing list