mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2026-05-19 05:46:50 -04:00
Lets try this TCPAddr option parsing in clamdscan one more time
This commit is contained in:
@@ -100,13 +100,9 @@ static int isremote(const struct optstruct *opts) {
|
||||
|
||||
opt = optget(clamdopts, "TCPAddr");
|
||||
while (opt) {
|
||||
if (strcmp(opt->name, "TCPAddr"))
|
||||
break;
|
||||
|
||||
if (opt->enabled)
|
||||
ipaddr = NULL;
|
||||
if (opt->strarg)
|
||||
ipaddr = (!strcmp(opt->strarg, "any") ? NULL : opt->strarg);
|
||||
else
|
||||
ipaddr = NULL;
|
||||
|
||||
memset(&hints, 0x00, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
@@ -115,7 +111,7 @@ static int isremote(const struct optstruct *opts) {
|
||||
|
||||
if ((res = getaddrinfo(ipaddr, port, &hints, &info))) {
|
||||
logg("!Can't lookup clamd hostname: %s\n", gai_strerror(res));
|
||||
opt = opt->next;
|
||||
opt = opt->nextarg;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -158,7 +154,7 @@ static int isremote(const struct optstruct *opts) {
|
||||
|
||||
freeaddrinfo(info);
|
||||
|
||||
opt = opt->next;
|
||||
opt = opt->nextarg;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -77,6 +77,7 @@ int dconnect() {
|
||||
const struct optstruct *opt;
|
||||
struct addrinfo hints, *info, *p;
|
||||
char port[10];
|
||||
char *ipaddr;
|
||||
|
||||
#ifndef _WIN32
|
||||
opt = optget(clamdopts, "LocalSocket");
|
||||
@@ -94,16 +95,17 @@ int dconnect() {
|
||||
|
||||
opt = optget(clamdopts, "TCPAddr");
|
||||
while (opt) {
|
||||
if (strcmp(opt->name, "TCPAddr"))
|
||||
break;
|
||||
ipaddr = NULL;
|
||||
if (opt->strarg)
|
||||
ipaddr = (!strcmp(opt->strarg, "any") ? NULL : opt->strarg);
|
||||
|
||||
memset(&hints, 0x00, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
if ((res = getaddrinfo(opt->strarg, port, &hints, &info))) {
|
||||
opt = opt->next;
|
||||
if ((res = getaddrinfo(ipaddr, port, &hints, &info))) {
|
||||
opt = opt->nextarg;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -124,7 +126,7 @@ int dconnect() {
|
||||
|
||||
freeaddrinfo(info);
|
||||
|
||||
opt = opt->next;
|
||||
opt = opt->nextarg;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user