[Asterisk-cvs] asterisk acl.c,1.10,1.11

markster at lists.digium.com markster at lists.digium.com
Sat Jan 10 15:28:11 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv13010

Modified Files:
	acl.c 
Log Message:
Cleanup ACL parsing, handle properly reload on sip with ACL


Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- acl.c	22 Oct 2003 04:09:28 -0000	1.10
+++ acl.c	10 Jan 2004 21:19:56 -0000	1.11
@@ -69,6 +69,7 @@
 {
 	struct ast_ha *ha = malloc(sizeof(struct ast_ha));
 	char *nm;
+	char tmp[256] = "";
 	struct ast_ha *prev = NULL;
 	struct ast_ha *ret;
 	ret = path;
@@ -77,21 +78,23 @@
 		path = path->next;
 	}
 	if (ha) {
-		char *stringp=NULL;
-		stringp=stuff;
-		strsep(&stringp, "/");
-		nm = strsep(&stringp, "/");
+		strncpy(tmp, stuff, sizeof(tmp) - 1);
+		nm = strchr(tmp, '/');
 		if (!nm)
 			nm = "255.255.255.255";
-		if (!inet_aton(stuff, &ha->netaddr)) {
+		else {
+			*nm = '\0';
+			nm++;
+		}
+		if (!inet_aton(tmp, &ha->netaddr)) {
 			ast_log(LOG_WARNING, "%s not a valid IP\n", stuff);
 			free(ha);
-			return NULL;
+			return path;
 		}
 		if (!inet_aton(nm, &ha->netmask)) {
 			ast_log(LOG_WARNING, "%s not a valid netmask\n", nm);
 			free(ha);
-			return NULL;
+			return path;
 		}
 		ha->netaddr.s_addr &= ha->netmask.s_addr;
 		if (!strncasecmp(sense, "p", 1)) {




More information about the svn-commits mailing list