Support logging for IPv6 remote host.
Approved by: jkh PR: bin/16789 Submitted by: Ben Smithurst <ben@scientia.demon.co.uk
This commit is contained in:
parent
aeb2954d05
commit
7395b85a9e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57313
@ -70,7 +70,7 @@ main(argc, argv)
|
|||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
register int ch;
|
register int ch;
|
||||||
register char *lp;
|
register char *lp;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_storage ss;
|
||||||
int p[2], logging, secure, sval;
|
int p[2], logging, secure, sval;
|
||||||
#define ENTRIES 50
|
#define ENTRIES 50
|
||||||
char **ap, *av[ENTRIES + 1], **comp, line[1024], *prog;
|
char **ap, *av[ENTRIES + 1], **comp, line[1024], *prog;
|
||||||
@ -127,10 +127,11 @@ main(argc, argv)
|
|||||||
for (end = t; *end; end++)
|
for (end = t; *end; end++)
|
||||||
if (*end == '\n' || *end == '\r')
|
if (*end == '\n' || *end == '\r')
|
||||||
*end = ' ';
|
*end = ' ';
|
||||||
sval = sizeof(sin);
|
sval = sizeof(ss);
|
||||||
if (getpeername(0, (struct sockaddr *)&sin, &sval) < 0)
|
if (getpeername(0, (struct sockaddr *)&ss, &sval) < 0)
|
||||||
logerr("getpeername: %s", strerror(errno));
|
logerr("getpeername: %s", strerror(errno));
|
||||||
realhostname(rhost, sizeof rhost - 1, &sin.sin_addr);
|
realhostname_sa(rhost, sizeof rhost - 1,
|
||||||
|
(struct sockaddr *)&ss, sval);
|
||||||
rhost[sizeof(rhost) - 1] = '\0';
|
rhost[sizeof(rhost) - 1] = '\0';
|
||||||
syslog(LOG_NOTICE, "query from %s: `%s'", rhost, t);
|
syslog(LOG_NOTICE, "query from %s: `%s'", rhost, t);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user