summaryrefslogtreecommitdiff
path: root/acl.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-03-20 19:08:57 +0000
committerMark Spencer <markster@digium.com>2004-03-20 19:08:57 +0000
commit4ba3ced42f78a3374e052355428737238505bc17 (patch)
treec024d1725230240639e94d21816d9b14810bd5e5 /acl.c
parent21d31939d1d13feedafd41c938b8f99eaeddf8ff (diff)
Fix ACL for bizarre routing cases
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2504 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'acl.c')
-rwxr-xr-xacl.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/acl.c b/acl.c
index 9e1edb414..1ec629f2b 100755
--- a/acl.c
+++ b/acl.c
@@ -279,7 +279,7 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
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 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
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);