[asterisk-commits] bbryant: branch bbryant/ssl-tcp-tls r72743 - /team/bbryant/ssl-tcp-tls/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 29 17:04:53 CDT 2007


Author: bbryant
Date: Fri Jun 29 17:04:52 2007
New Revision: 72743

URL: http://svn.digium.com/view/asterisk?view=rev&rev=72743
Log:
Oops. Fixed string manipulation.

Modified:
    team/bbryant/ssl-tcp-tls/channels/chan_sip.c

Modified: team/bbryant/ssl-tcp-tls/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bbryant/ssl-tcp-tls/channels/chan_sip.c?view=diff&rev=72743&r1=72742&r2=72743
==============================================================================
--- team/bbryant/ssl-tcp-tls/channels/chan_sip.c (original)
+++ team/bbryant/ssl-tcp-tls/channels/chan_sip.c Fri Jun 29 17:04:52 2007
@@ -5019,10 +5019,12 @@
 	trans = strstr(username, "://");
 
 	if (trans) {
+		*trans = '\0';
+
 		if (trans - username == 3 && 
-		  strncasecmp(username, "udp", 3) &&
-		  strncasecmp(username, "tcp", 3) &&
-		  strncasecmp(username, "tls", 3)) {
+			(!strncasecmp(username, "udp", 3) ||
+		  	 !strncasecmp(username, "tcp", 3) ||
+		   	 !strncasecmp(username, "tls", 3))) {
 			switch(username[1] + ((username[1] < 97) ? 32 : 0)) { // Ensure lowercase
 				case 'c':
 					transport = SIP_TRANSPORT_TCP;
@@ -5032,10 +5034,10 @@
 					break;
 			}
 		} else {
-			*trans = '\0';
 		    ast_log(LOG_WARNING, "Invalid transport type '%s' given at line %d\n", username, lineno);
-			ast_copy_string(username, trans + 3, sizeof(username));
-		}
+		}
+
+		ast_copy_string(username, trans + 3, sizeof(username));
 	}
 
 	ast_log(LOG_DEBUG, "Transport type is '%d' for register URI '%s'\n", transport, username);
@@ -15867,7 +15869,6 @@
 {
 	struct sip_request req;
 	struct sockaddr_in sin = { 0, };
-	struct sip_pvt *p;
 	int res;
 	socklen_t len = sizeof(sin);
 




More information about the asterisk-commits mailing list