[Asterisk-cvs] asterisk acl.c,1.15,1.15.2.1

markster at lists.digium.com markster at lists.digium.com
Sat Mar 20 14:13:07 CST 2004


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

Modified Files:
      Tag: v1-0_stable
	acl.c 
Log Message:
Fix ACL for bizarre routing cases


Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- acl.c	2 Feb 2004 06:39:23 -0000	1.15
+++ acl.c	20 Mar 2004 19:08:45 -0000	1.15.2.1
@@ -279,7 +279,7 @@
 	fgets(line,sizeof(line),PROC);
 
 	while (!feof(PROC)) {
-		char iface[8];
+		char iface[256];
 		unsigned int dest, gateway, mask;
 		int i,fieldnum;
 		char *fields[40];
@@ -303,18 +303,20 @@
 				i = offset - line;
 			}
 		}
+		if (fieldnum >= 8) {
 
-		sscanf(fields[0],"%s",iface);
-		sscanf(fields[1],"%x",&dest);
-		sscanf(fields[2],"%x",&gateway);
-		sscanf(fields[7],"%x",&mask);
+			sscanf(fields[0],"%s",iface);
+			sscanf(fields[1],"%x",&dest);
+			sscanf(fields[2],"%x",&gateway);
+			sscanf(fields[7],"%x",&mask);
 #if 0
-		printf("Addr: %s %08x Dest: %08x Mask: %08x\n", inet_ntoa(*them), remote_ip, dest, mask);
+			printf("Addr: %s %08x Dest: %08x Mask: %08x\n", inet_ntoa(*them), remote_ip, dest, mask);
 #endif		
-		/* Looks simple, but here is the magic */
-		if (((remote_ip & mask) ^ dest) == 0) {
-			res = ast_lookup_iface(iface,us);
-			break;
+			/* Looks simple, but here is the magic */
+			if (((remote_ip & mask) ^ dest) == 0) {
+				res = ast_lookup_iface(iface,us);
+				break;
+			}
 		}
 	}
 	fclose(PROC);




More information about the svn-commits mailing list