mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Correct ip/network/hostname parsing in ACLs
This commit is contained in:
parent
37c380f4f7
commit
041134007d
10
src/conf.c
10
src/conf.c
@ -868,9 +868,11 @@ struct ace * make_ace (int argc, unsigned char ** argv){
|
|||||||
do {
|
do {
|
||||||
int arglen;
|
int arglen;
|
||||||
unsigned char *pattern;
|
unsigned char *pattern;
|
||||||
|
struct iplist tmpip={NULL};
|
||||||
|
|
||||||
arglen = (int)strlen((char *)arg);
|
arglen = (int)strlen((char *)arg);
|
||||||
if(arglen > 0 && (arg[arglen-1] < '0' || arg[arglen-1] > '9')){
|
if(scanipl(arg, &tmpip)){
|
||||||
|
if(!arglen) continue;
|
||||||
if(!acl->dstnames) {
|
if(!acl->dstnames) {
|
||||||
acl->dstnames = hostnamel = myalloc(sizeof(struct hostname));
|
acl->dstnames = hostnamel = myalloc(sizeof(struct hostname));
|
||||||
}
|
}
|
||||||
@ -914,11 +916,7 @@ struct ace * make_ace (int argc, unsigned char ** argv){
|
|||||||
fprintf(stderr, "No memory for ACL entry, line %d\n", linenum);
|
fprintf(stderr, "No memory for ACL entry, line %d\n", linenum);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ipl, 0, sizeof(struct iplist));
|
*ipl = tmpip;
|
||||||
if (scanipl(arg, ipl)) {
|
|
||||||
fprintf(stderr, "Invalid IP, IP range or CIDR, line %d\n", linenum);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}while((arg = (unsigned char *)strtok((char *)NULL, ",")));
|
}while((arg = (unsigned char *)strtok((char *)NULL, ",")));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user