Always log remote IP.

PR:		bin/59773
This commit is contained in:
Yaroslav Tykhiy 2004-11-22 10:27:16 +00:00
parent 04683b2c35
commit 7cdd3cb70b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137984

View file

@ -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);
}
}