[asterisk-commits] dvossel: branch 1.6.2 r213636 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 21 16:12:19 CDT 2009


Author: dvossel
Date: Fri Aug 21 16:12:14 2009
New Revision: 213636

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213636
Log:
Merged revisions 213635 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r213635 | dvossel | 2009-08-21 16:02:50 -0500 (Fri, 21 Aug 2009) | 5 lines
  
  fixes sip register parsing when user at domain is used
  
  (issue #15008)
  (issue #15672)
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/channels/chan_sip.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=213636&r1=213635&r2=213636
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Fri Aug 21 16:12:14 2009
@@ -7093,12 +7093,9 @@
 	char buf[256] = "";
 	char *username = NULL;
 	char *tmp = NULL, *transport_str = NULL;
+	char *userpart = NULL, *hostpart = NULL;
 	char *peername = NULL;
 	/* register => [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] */
-	AST_DECLARE_APP_ARGS(parts,
-		AST_APP_ARG(userpart);
-		AST_APP_ARG(hostpart);
-	);
 	AST_DECLARE_APP_ARGS(user1,
 		AST_APP_ARG(userpart);
 		AST_APP_ARG(secret);
@@ -7123,17 +7120,26 @@
 
 	/*! register => [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry]
 	 * becomes
-	 *   parts.userpart => [peer?][transport://]user[@domain][:secret[:authuser]]
-	 *   parts.hostpart => host[:port][/extension][~expiry]
+	 *   userpart => [peer?][transport://]user[@domain][:secret[:authuser]]
+	 *   hostpart => host[:port][/extension][~expiry]
 	 */
-	AST_NONSTANDARD_RAW_ARGS(parts, buf, '@');
+	if ((hostpart = strrchr(buf, '@'))) {
+		*hostpart++ = '\0';
+		userpart = buf;
+	}
+
+	if (ast_strlen_zero(userpart) || ast_strlen_zero(hostpart)) {
+		ast_log(LOG_WARNING, "Format for registration is [transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] at line %d\n", lineno);
+		return -1;
+	}
+
 	/*!
 	 * user1.userpart => [peer?][transport://]user[@domain]
 	 * user1.secret => secret
 	 * user1.authuser => authuser
-	 * parts.hostpart => host[:port][/extension][~expiry]
+	 * hostpart => host[:port][/extension][~expiry]
 	 */
-	AST_NONSTANDARD_RAW_ARGS(user1, parts.userpart, ':');
+	AST_NONSTANDARD_RAW_ARGS(user1, userpart, ':');
 
 	/*!
 	 * user1.userpart => [peer?][transport://]user[@domain]
@@ -7142,7 +7148,7 @@
 	 * host1.hostpart => host[:port][/extension]
 	 * host1.expiry => [expiry]
 	 */
-	AST_NONSTANDARD_RAW_ARGS(host1, parts.hostpart, '~');
+	AST_NONSTANDARD_RAW_ARGS(host1, hostpart, '~');
 
 	/*!
 	 * user1.userpart => [peer?][transport://]user[@domain]
@@ -7152,7 +7158,7 @@
 	 * host2.extension => [extension]
 	 * host1.expiry => [expiry]
 	 */
-	AST_NONSTANDARD_RAW_ARGS(host2, parts.hostpart, '/');
+	AST_NONSTANDARD_RAW_ARGS(host2, hostpart, '/');
 
 	/*!
 	 * user1.userpart => [peer?][transport://]user[@domain]
@@ -7163,7 +7169,7 @@
 	 * host2.extension => extension
 	 * host1.expiry => expiry
 	 */
-	AST_NONSTANDARD_RAW_ARGS(host3, parts.hostpart, ':');
+	AST_NONSTANDARD_RAW_ARGS(host3, hostpart, ':');
 
 	if ((tmp = strchr(user1.userpart, '?'))) {
 		*tmp = '\0';




More information about the asterisk-commits mailing list