aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-11 15:07:44 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-11 15:07:44 +0000
commit4221e90ae468acc4b6c43faa36aee5160d2738c6 (patch)
treef9a100c67f7aff66cd948d6e85fa8bca6ac684ff
parenta19e64933c600b7f05232ad80bb5db85c115e42d (diff)
downloadbusybox-w32-4221e90ae468acc4b6c43faa36aee5160d2738c6.tar.gz
busybox-w32-4221e90ae468acc4b6c43faa36aee5160d2738c6.tar.bz2
busybox-w32-4221e90ae468acc4b6c43faa36aee5160d2738c6.zip
ftpd: stop unconditional logging to syslog. This was the only applet
which was doing it. Added option -S to enable it when desired. function old new delta packed_usage 25647 25666 +19 ftpd_main 1826 1825 -1
-rw-r--r--docs/logging_and_backgrounding.txt23
-rw-r--r--include/usage.h5
-rw-r--r--networking/ftpd.c15
3 files changed, 27 insertions, 16 deletions
diff --git a/docs/logging_and_backgrounding.txt b/docs/logging_and_backgrounding.txt
index 39f015883..62a6d1550 100644
--- a/docs/logging_and_backgrounding.txt
+++ b/docs/logging_and_backgrounding.txt
@@ -27,18 +27,16 @@ acpid - auto-backgrounds unless -d
27crond - auto-backgrounds unless -f, logs to syslog unless -d or -L. 27crond - auto-backgrounds unless -f, logs to syslog unless -d or -L.
28 option -d logs to stderr, -L FILE logs to FILE 28 option -d logs to stderr, -L FILE logs to FILE
29devfsd - (obsolete) 29devfsd - (obsolete)
30dnsd - option -d makes it auto-background and log to syslog 30dnsd - option -d makes it background and log to syslog
31fakeidentd - inetd service. Auto-backgrounds and logs to syslog 31fakeidentd - inetd service. Auto-backgrounds and logs to syslog
32 if no -f and no -i and no -w (-i is "inetd service" flag, 32 if no -f and no -i and no -w (-i is "inetd service" flag,
33 -w is "inetd-wait service" flag) 33 -w is "inetd-wait service" flag)
34ftpd - inetd service. Logs to syslog always, with -v logs to strerr too 34ftpd - inetd service. Logs to syslog with -S, with -v logs to strerr too
35httpd - auto-backgrounds unless -f or -i 35httpd - auto-backgrounds unless -f or -i (-i is "inetd service" flag)
36 (-i is "inetd service" flag)
37inetd - auto-backgrounds unless -f, logs to syslog unless -e 36inetd - auto-backgrounds unless -f, logs to syslog unless -e
38klogd - auto-backgrounds unless -n 37klogd - auto-backgrounds unless -n
39syslogd - auto-backgrounds unless -n 38syslogd - auto-backgrounds unless -n
40telnetd - auto-backgrounds unless -f or -i 39telnetd - auto-backgrounds unless -f or -i (-i is "inetd service" flag)
41 (-i is "inetd service" flag)
42udhcpc - auto-backgrounds unless -f after lease is obtained, 40udhcpc - auto-backgrounds unless -f after lease is obtained,
43 option -b makes it background sooner (when lease attempt 41 option -b makes it background sooner (when lease attempt
44 fails and retries start), 42 fails and retries start),
@@ -48,9 +46,18 @@ udhcpd - auto-backgrounds and do not log to stderr unless -f,
48 otherwise logs to stderr, but option -S makes it log *also* to syslog 46 otherwise logs to stderr, but option -S makes it log *also* to syslog
49zcip - auto-backgrounds and logs *also* to syslog unless -f 47zcip - auto-backgrounds and logs *also* to syslog unless -f
50 48
49Total: 13 applets (+1 obsolete),
50 4 log to syslog by default (crond fakeidentd inetd zcip),
51 5 never log to syslog (acpid httpd telnetd klogd syslogd, last two
52 - for obviously correct reasons),
53 there are no daemons which always log to syslog,
54 12 auto-background if not run as inetd servies (all except dnsd.
55 Note that there is no "standard" dnsd AFAIKS). But see below
56 for daemons (tcpsvd etc) which don't auto-background.
57
51miscutils/crond.c: logmode = LOGMODE_SYSLOG; 58miscutils/crond.c: logmode = LOGMODE_SYSLOG;
52networking/dnsd.c: logmode = LOGMODE_SYSLOG; 59networking/dnsd.c: logmode = LOGMODE_SYSLOG;
53networking/ftpd.c: logmode = LOGMODE_SYSLOG; 60networking/ftpd.c: logmode = LOGMODE_NONE;
54networking/ftpd.c: logmode |= LOGMODE_SYSLOG; 61networking/ftpd.c: logmode |= LOGMODE_SYSLOG;
55networking/inetd.c: logmode = LOGMODE_SYSLOG; 62networking/inetd.c: logmode = LOGMODE_SYSLOG;
56networking/isrv_identd.c: logmode = LOGMODE_SYSLOG; 63networking/isrv_identd.c: logmode = LOGMODE_SYSLOG;
@@ -63,7 +70,7 @@ networking/udhcp/dhcpd.c: logmode |= LOGMODE_SYSLOG;
63networking/zcip.c: logmode |= LOGMODE_SYSLOG; 70networking/zcip.c: logmode |= LOGMODE_SYSLOG;
64 71
65 72
66These daemons seem to never auto-background/log to syslog: 73These daemons never auto-background and never log to syslog:
67 74
68lpd - inetd service. Has nothing to log so far, though 75lpd - inetd service. Has nothing to log so far, though
69dhcprelay - standard behavior 76dhcprelay - standard behavior
diff --git a/include/usage.h b/include/usage.h
index b19803dfa..e945840b8 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1281,7 +1281,7 @@
1281 "\n -f Force file system check" \ 1281 "\n -f Force file system check" \
1282 1282
1283#define ftpd_trivial_usage \ 1283#define ftpd_trivial_usage \
1284 "[-vw] [DIR]" 1284 "[-wvS] [DIR]"
1285#define ftpd_full_usage "\n\n" \ 1285#define ftpd_full_usage "\n\n" \
1286 "FTP server\n" \ 1286 "FTP server\n" \
1287 "\n" \ 1287 "\n" \
@@ -1291,8 +1291,9 @@
1291 "It also can be ran from tcpsvd:\n" \ 1291 "It also can be ran from tcpsvd:\n" \
1292 " tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve\n" \ 1292 " tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve\n" \
1293 "\nOptions:" \ 1293 "\nOptions:" \
1294 "\n -v Log also to stderr" \
1295 "\n -w Allow upload" \ 1294 "\n -w Allow upload" \
1295 "\n -v Log to stderr" \
1296 "\n -S Log to syslog" \
1296 "\n DIR Change root to this directory" \ 1297 "\n DIR Change root to this directory" \
1297 1298
1298#define ftpget_trivial_usage \ 1299#define ftpget_trivial_usage \
diff --git a/networking/ftpd.c b/networking/ftpd.c
index 29589d185..3faa3ed7d 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -80,7 +80,8 @@ enum {
80 OPT_l = (1 << 0), 80 OPT_l = (1 << 0),
81 OPT_1 = (1 << 1), 81 OPT_1 = (1 << 1),
82 OPT_v = (1 << 2), 82 OPT_v = (1 << 2),
83 OPT_w = (1 << 3), 83 OPT_S = (1 << 3),
84 OPT_w = (1 << 4),
84 85
85#define mk_const4(a,b,c,d) (((a * 0x100 + b) * 0x100 + c) * 0x100 + d) 86#define mk_const4(a,b,c,d) (((a * 0x100 + b) * 0x100 + c) * 0x100 + d)
86#define mk_const3(a,b,c) ((a * 0x100 + b) * 0x100 + c) 87#define mk_const3(a,b,c) ((a * 0x100 + b) * 0x100 + c)
@@ -806,7 +807,7 @@ int ftpd_main(int argc, char **argv)
806{ 807{
807 smallint opts; 808 smallint opts;
808 809
809 opts = getopt32(argv, "l1v" USE_FEATURE_FTP_WRITE("w")); 810 opts = getopt32(argv, "l1vS" USE_FEATURE_FTP_WRITE("w"));
810 811
811 if (opts & (OPT_l|OPT_1)) { 812 if (opts & (OPT_l|OPT_1)) {
812 /* Our secret backdoor to ls */ 813 /* Our secret backdoor to ls */
@@ -828,11 +829,13 @@ int ftpd_main(int argc, char **argv)
828 * failure */ 829 * failure */
829 } 830 }
830 831
831 /* LOG_NDELAY is needed since we may chroot later */
832 openlog(applet_name, LOG_PID | LOG_NDELAY, LOG_DAEMON);
833 logmode |= LOGMODE_SYSLOG;
834 if (!(opts & OPT_v)) 832 if (!(opts & OPT_v))
835 logmode = LOGMODE_SYSLOG; 833 logmode = LOGMODE_NONE;
834 if (opts & OPT_S) {
835 /* LOG_NDELAY is needed since we may chroot later */
836 openlog(applet_name, LOG_PID | LOG_NDELAY, LOG_DAEMON);
837 logmode |= LOGMODE_SYSLOG;
838 }
836 839
837 G.proc_self_fd = xopen("/proc/self", O_RDONLY | O_DIRECTORY); 840 G.proc_self_fd = xopen("/proc/self", O_RDONLY | O_DIRECTORY);
838 841