diff options
author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-11-22 10:27:16 +0000 |
---|---|---|
committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-11-22 10:27:16 +0000 |
commit | 7cdd3cb70b238654bf6bee85fceb7340a584ad23 (patch) | |
tree | 761752608003a0d6690559b5a816636472acd377 /libexec/ftpd/ftpd.c | |
parent | 04683b2c3564b9adf076a9ee8b3f221fbfab6bd7 (diff) | |
download | src-7cdd3cb70b238654bf6bee85fceb7340a584ad23.tar.gz src-7cdd3cb70b238654bf6bee85fceb7340a584ad23.zip |
Always log remote IP.
PR: bin/59773
Notes
Notes:
svn path=/head/; revision=137984
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r-- | libexec/ftpd/ftpd.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 66c66eb8353f..d6e3806e650b 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); } } |