Whitespace
This commit is contained in:
23
src/acl.c
23
src/acl.c
@@ -27,18 +27,18 @@ static int is_included_in_acl(int list_length, struct ip_and_mask (*list)[], uni
|
||||
NULLCHECK( test );
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0; i < list_length; i++) {
|
||||
struct ip_and_mask *entry = &(*list)[i];
|
||||
int testbits;
|
||||
unsigned char *raw_address1, *raw_address2;
|
||||
|
||||
|
||||
debug("checking acl entry %d (%d/%d)", i, test->generic.sa_family, entry->ip.family);
|
||||
|
||||
|
||||
if (test->generic.sa_family != entry->ip.family) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (test->generic.sa_family == AF_INET) {
|
||||
debug("it's an AF_INET");
|
||||
raw_address1 = (unsigned char*) &test->v4.sin_addr;
|
||||
@@ -49,9 +49,9 @@ static int is_included_in_acl(int list_length, struct ip_and_mask (*list)[], uni
|
||||
raw_address1 = (unsigned char*) &test->v6.sin6_addr;
|
||||
raw_address2 = (unsigned char*) &entry->ip.v6.sin6_addr;
|
||||
}
|
||||
|
||||
|
||||
debug("testbits=%d", entry->mask);
|
||||
|
||||
|
||||
for (testbits = entry->mask; testbits > 0; testbits -= 8) {
|
||||
debug("testbits=%d, c1=%02x, c2=%02x", testbits, raw_address1[0], raw_address2[0]);
|
||||
if (testbits >= 8) {
|
||||
@@ -63,17 +63,17 @@ static int is_included_in_acl(int list_length, struct ip_and_mask (*list)[], uni
|
||||
(raw_address2[0] & testmasks[testbits%8]) )
|
||||
goto no_match;
|
||||
}
|
||||
|
||||
|
||||
raw_address1++;
|
||||
raw_address2++;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
no_match: ;
|
||||
debug("no match");
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ int acl_includes( struct acl * acl, union mysockaddr * addr )
|
||||
|
||||
if ( 0 == acl->len ) {
|
||||
return !( acl->default_deny );
|
||||
}
|
||||
}
|
||||
else {
|
||||
return is_included_in_acl( acl->len, acl->entries, addr );
|
||||
}
|
||||
@@ -97,3 +97,4 @@ void acl_destroy( struct acl * acl )
|
||||
acl->entries = NULL;
|
||||
free( acl );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user