syslogd: Minor coding style cleanups
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@ -185,7 +185,7 @@ static int addpeer(struct peer *pe0)
|
|||||||
*pe = *pe0;
|
*pe = *pe0;
|
||||||
SIMPLEQ_INSERT_TAIL(&pqueue, pe, pe_link);
|
SIMPLEQ_INSERT_TAIL(&pqueue, pe, pe_link);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usage(int code)
|
int usage(int code)
|
||||||
@ -2868,12 +2868,12 @@ static int allowaddr(char *s)
|
|||||||
printf("port = %d\n", ap->port);
|
printf("port = %d\n", ap->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
err:
|
err:
|
||||||
if (res != NULL)
|
if (res != NULL)
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
free(ap);
|
free(ap);
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2890,13 +2890,13 @@ static int validate(struct sockaddr *sa, const char *hname)
|
|||||||
u_short sport;
|
u_short sport;
|
||||||
int i, num = 0;
|
int i, num = 0;
|
||||||
|
|
||||||
SIMPLEQ_FOREACH(ap, &aphead, next) {
|
SIMPLEQ_FOREACH(ap, &aphead, next)
|
||||||
num++;
|
num++;
|
||||||
}
|
|
||||||
logit("# of validation rule: %d\n", num);
|
logit("# of validation rule: %d\n", num);
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
/* traditional behaviour, allow everything */
|
/* traditional behaviour, allow everything */
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
(void)strlcpy(name, hname, sizeof(name));
|
(void)strlcpy(name, hname, sizeof(name));
|
||||||
hints = (struct addrinfo){
|
hints = (struct addrinfo){
|
||||||
@ -2921,7 +2921,8 @@ static int validate(struct sockaddr *sa, const char *hname)
|
|||||||
#endif
|
#endif
|
||||||
if (getnameinfo(sa, len, ip, sizeof(ip), port, sizeof(port),
|
if (getnameinfo(sa, len, ip, sizeof(ip), port, sizeof(port),
|
||||||
NI_NUMERICHOST | NI_NUMERICSERV) != 0)
|
NI_NUMERICHOST | NI_NUMERICSERV) != 0)
|
||||||
return (0); /* for safety, should not occur */
|
return 0; /* for safety, should not occur */
|
||||||
|
|
||||||
logit("validate: dgram from IP %s, port %s, name %s;\n", ip, port, name);
|
logit("validate: dgram from IP %s, port %s, name %s;\n", ip, port, name);
|
||||||
sport = atoi(port);
|
sport = atoi(port);
|
||||||
|
|
||||||
@ -2970,10 +2971,12 @@ static int validate(struct sockaddr *sa, const char *hname)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logit("accepted in rule %d.\n", i);
|
logit("accepted in rule %d.\n", i);
|
||||||
return (1); /* hooray! */
|
return 1; /* hooray! */
|
||||||
}
|
}
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logit(char *fmt, ...)
|
static void logit(char *fmt, ...)
|
||||||
|
Reference in New Issue
Block a user