summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2004-11-22 10:27:16 +0000
committeryar <yar@FreeBSD.org>2004-11-22 10:27:16 +0000
commit87abae189ed17de9fffde0722e247245c3815fcf (patch)
tree761752608003a0d6690559b5a816636472acd377 /libexec/ftpd
parent806e7b8b99df75b38de645e1f2e7124bb9056b76 (diff)
downloadFreeBSD-src-87abae189ed17de9fffde0722e247245c3815fcf.zip
FreeBSD-src-87abae189ed17de9fffde0722e247245c3815fcf.tar.gz
Always log remote IP.
PR: bin/59773
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 66c66eb..d6e3806 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -2577,10 +2577,14 @@ renamecmd(char *from, char *to)
static void
dolog(struct sockaddr *who)
{
- int error;
+ char who_name[NI_MAXHOST];
realhostname_sa(remotehost, sizeof(remotehost) - 1, who, who->sa_len);
remotehost[sizeof(remotehost) - 1] = 0;
+ if (getnameinfo(who, who->sa_len,
+ who_name, sizeof(who_name) - 1, NULL, 0, NI_NUMERICHOST))
+ *who_name = 0;
+ who_name[sizeof(who_name) - 1] = 0;
#ifdef SETPROCTITLE
#ifdef VIRTUAL_HOSTING
@@ -2597,20 +2601,12 @@ dolog(struct sockaddr *who)
if (logging) {
#ifdef VIRTUAL_HOSTING
if (thishost != firsthost)
- syslog(LOG_INFO, "connection from %s (to %s)",
- remotehost, hostname);
+ syslog(LOG_INFO, "connection from %s (%s) to %s",
+ remotehost, who_name, hostname);
else
#endif
- {
- char who_name[NI_MAXHOST];
-
- error = getnameinfo(who, who->sa_len,
- who_name, sizeof(who_name) - 1,
- NULL, 0, NI_NUMERICHOST);
- who_name[sizeof(who_name) - 1] = 0;
- syslog(LOG_INFO, "connection from %s (%s)", remotehost,
- error == 0 ? who_name : "");
- }
+ syslog(LOG_INFO, "connection from %s (%s)",
+ remotehost, who_name);
}
}
OpenPOWER on IntegriCloud