summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2004-11-22 10:48:29 +0000
committeryar <yar@FreeBSD.org>2004-11-22 10:48:29 +0000
commit0570780491b2c351d2ca8b7521fa7c496d9ba436 (patch)
tree90b5850167a72130bb4c19e2a95083bf2fe60667 /libexec
parent87abae189ed17de9fffde0722e247245c3815fcf (diff)
downloadFreeBSD-src-0570780491b2c351d2ca8b7521fa7c496d9ba436.zip
FreeBSD-src-0570780491b2c351d2ca8b7521fa7c496d9ba436.tar.gz
Don't log the chroot dir on every command since it's constant for a session.
Log it once at the beginning of the session instead. OTOH, log wd each time for the sake of better auditing and consistent log format. Proposed by: Nick Leuta <skynick -at- mail.sc.ru>
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index d6e3806..c0ac3f3 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1589,6 +1589,8 @@ skip:
syslog(LOG_INFO, "FTP LOGIN FROM %s as %s",
remotehost, pw->pw_name);
}
+ if (guest || dochroot)
+ syslog(LOG_INFO, "session root changed to %s", chrootdir);
#ifdef LOGIN_CAP
login_close(lc);
#endif
@@ -3172,12 +3174,9 @@ logcmd(char *cmd, char *file1, char *file2, off_t cnt)
if (logging <= 1)
return;
- /* If either filename isn't absolute, get current dir for log message. */
- if ((file1 && file1[0] != '/') || (file2 && file2[0] != '/')) {
- if (getcwd(wd, sizeof(wd) - 1) == NULL)
- strcpy(wd, strerror(errno));
- } else
- wd[0] = '\0';
+
+ if (getcwd(wd, sizeof(wd) - 1) == NULL)
+ strcpy(wd, strerror(errno));
appendf(&msg, "%s", cmd);
if (file1)
@@ -3186,10 +3185,10 @@ logcmd(char *cmd, char *file1, char *file2, off_t cnt)
appendf(&msg, " %s", file2);
if (cnt >= 0)
appendf(&msg, " = %jd bytes", (intmax_t)cnt);
- if (wd[0])
- appendf(&msg, " (wd: %s)", wd);
+ appendf(&msg, " (wd: %s", wd);
if (guest || dochroot)
- appendf(&msg, " (chroot: %s)", chrootdir);
+ appendf(&msg, "; chrooted");
+ appendf(&msg, ")");
syslog(LOG_INFO, "%s", msg);
free(msg);
}
OpenPOWER on IntegriCloud