[svn-commits] dvossel: branch 1.6.2 r223133 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 9 12:09:24 CDT 2009


Author: dvossel
Date: Fri Oct  9 12:09:19 2009
New Revision: 223133

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223133
Log:
Merged revisions 223132 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r223132 | dvossel | 2009-10-09 11:54:02 -0500 (Fri, 09 Oct 2009) | 9 lines
  
  'auth=' did not parse md5 secret correctly
  
  (closes issue #15949)
  Reported by: ebroad
  Patches:
        authparsefix.patch uploaded by ebroad (license 878)
        15949_trunk.diff uploaded by dvossel (license 671)
  Tested by: ebroad
........

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://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=223133&r1=223132&r2=223133
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Fri Oct  9 12:09:19 2009
@@ -22939,7 +22939,6 @@
 {
 	char authcopy[256];
 	char *username=NULL, *realm=NULL, *secret=NULL, *md5secret=NULL;
-	char *stringp;
 	struct sip_auth *a, *b, *auth;
 
 	if (ast_strlen_zero(configuration))
@@ -22948,25 +22947,24 @@
 	ast_debug(1, "Auth config ::  %s\n", configuration);
 
 	ast_copy_string(authcopy, configuration, sizeof(authcopy));
-	stringp = authcopy;
-
-	username = stringp;
-	realm = strrchr(stringp, '@');
+	username = authcopy;
+
+	/* split user[:secret] and relm */
+	realm = strrchr(username, '@');
 	if (realm)
 		*realm++ = '\0';
 	if (ast_strlen_zero(username) || ast_strlen_zero(realm)) {
 		ast_log(LOG_WARNING, "Format for authentication entry is user[:secret]@realm at line %d\n", lineno);
 		return authlist;
 	}
-	stringp = username;
-	username = strsep(&stringp, ":");
-	if (username) {
-		secret = strsep(&stringp, ":");
-		if (!secret) {
-			stringp = username;
-			md5secret = strsep(&stringp, "#");
-		}
-	}
+
+	/* parse username at ':' for secret, or '#" for md5secret */
+	if ((secret = strchr(username, ':'))) {
+		*secret++ = '\0';
+	} else if ((md5secret = strchr(username, '#'))) {
+		*md5secret++ = '\0';
+	}
+
 	if (!(auth = ast_calloc(1, sizeof(*auth))))
 		return authlist;
 




More information about the svn-commits mailing list