diff options
-rw-r--r-- | libexec/ftpd/ftpd.c | 19 | ||||
-rw-r--r-- | libexec/ftpd/monitor.c | 14 | ||||
-rw-r--r-- | libexec/ftpd/monitor.h | 4 |
3 files changed, 21 insertions, 16 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 5fe5fababc1..57306086304 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.174 2006/12/21 02:28:47 krw Exp $ */ +/* $OpenBSD: ftpd.c,v 1.175 2007/03/01 20:06:27 otto Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -70,7 +70,7 @@ static const char copyright[] = static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #else static const char rcsid[] = - "$OpenBSD: ftpd.c,v 1.174 2006/12/21 02:28:47 krw Exp $"; + "$OpenBSD: ftpd.c,v 1.175 2007/03/01 20:06:27 otto Exp $"; #endif #endif /* not lint */ @@ -655,6 +655,7 @@ lostconn(int signo) { struct syslog_data sdata = SYSLOG_DATA_INIT; + sdata.log_fac = LOG_FTP; if (debug) syslog_r(LOG_DEBUG, &sdata, "lost connection"); dologout(1); @@ -665,7 +666,8 @@ sigquit(int signo) { struct syslog_data sdata = SYSLOG_DATA_INIT; - syslog_r(LOG_ERR, &sdata, "got signal %s", sys_signame[signo]); + sdata.log_fac = LOG_FTP; + syslog_r(LOG_DEBUG, &sdata, "got signal %s", sys_signame[signo]); dologout(1); } @@ -718,7 +720,7 @@ user(char *name) char *class = NULL; if (logged_in) { - kill_slave(); + kill_slave("user already logged in"); end_login(); } @@ -929,7 +931,7 @@ pass(char *passwd) syslog(LOG_NOTICE, "repeated login failures from %s", remotehost); - kill_slave(); + kill_slave("repeated login failures"); _exit(0); } return (AUTH_FAILED); @@ -940,7 +942,7 @@ pass(char *passwd) free(guestpw); guestpw = strdup(passwd); if (guestpw == NULL) { - kill_slave(); + kill_slave("out of mem"); fatal("Out of memory."); } @@ -952,7 +954,7 @@ pass(char *passwd) "FTP LOGIN FAILED (HOST) as %s: approval failure.", pw->pw_name); reply(530, "Approval failure."); - kill_slave(); + kill_slave("approval failure"); _exit(0); } } else { @@ -960,7 +962,7 @@ pass(char *passwd) "FTP LOGIN CLASS %s MISSING for %s: approval failure.", pw->pw_class, pw->pw_name); reply(530, "Permission denied."); - kill_slave(); + kill_slave("permission denied"); _exit(0); } @@ -1959,6 +1961,7 @@ reply_r(int n, const char *fmt, ...) va_list ap; struct syslog_data sdata = SYSLOG_DATA_INIT; + sdata.log_fac = LOG_FTP; va_start(ap, fmt); vsnprintf(msg, sizeof(msg), fmt, ap); va_end(ap); diff --git a/libexec/ftpd/monitor.c b/libexec/ftpd/monitor.c index 1dc7d5977f8..2177c53ac36 100644 --- a/libexec/ftpd/monitor.c +++ b/libexec/ftpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.14 2006/04/21 17:42:50 deraadt Exp $ */ +/* $OpenBSD: monitor.c,v 1.15 2007/03/01 20:06:27 otto Exp $ */ /* * Copyright (c) 2004 Moritz Jodeit <moritz@openbsd.org> @@ -85,7 +85,7 @@ send_data(int sock, void *buf, size_t len) while (len > pos) { switch (n = write(sock, ptr + pos, len - pos)) { case 0: - kill_slave(); + kill_slave("write failure"); _exit(0); /* NOTREACHED */ case -1: @@ -111,7 +111,7 @@ recv_data(int sock, void *buf, size_t len) while (len > pos) { switch (n = read(sock, ptr + pos, len - pos)) { case 0: - kill_slave(); + kill_slave("read failure"); _exit(0); /* NOTREACHED */ case -1: @@ -416,10 +416,12 @@ sig_chld(int signo) } void -kill_slave(void) +kill_slave(char *reason) { - if (slave_pid > 0) + if (slave_pid > 0) { + syslog(LOG_NOTICE, "kill slave %d: %s", slave_pid, reason); kill(slave_pid, SIGQUIT); + } } void @@ -431,7 +433,7 @@ fatalx(char *fmt, ...) vsyslog(LOG_ERR, fmt, ap); va_end(ap); - kill_slave(); + kill_slave("fatal error"); _exit(0); } diff --git a/libexec/ftpd/monitor.h b/libexec/ftpd/monitor.h index 2c6012d4e1a..737156e2066 100644 --- a/libexec/ftpd/monitor.h +++ b/libexec/ftpd/monitor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.h,v 1.4 2005/07/14 14:48:47 moritz Exp $ */ +/* $OpenBSD: monitor.h,v 1.5 2007/03/01 20:06:27 otto Exp $ */ /* * Copyright (c) 2004 Moritz Jodeit <moritz@openbsd.org> @@ -34,7 +34,7 @@ int monitor_pass(char *); int monitor_socket(int); int monitor_bind(int, struct sockaddr *, socklen_t); -void kill_slave(void); +void kill_slave(char *); void send_fd(int, int); int recv_fd(int); |