aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-04-11 05:12:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-04-11 05:12:53 +0200
commit532e961f7ec04d9490e11c16a9efac8aed4f0585 (patch)
tree3f75ddf624a4ba18270b595617672a223c244d60
parent24ec952f1403759af280661b83471b28f1158553 (diff)
downloadbusybox-w32-532e961f7ec04d9490e11c16a9efac8aed4f0585.tar.gz
busybox-w32-532e961f7ec04d9490e11c16a9efac8aed4f0585.tar.bz2
busybox-w32-532e961f7ec04d9490e11c16a9efac8aed4f0585.zip
tftpd: add -l "log to syslog" option. Needed for inetd mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tftp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index e50d9254b..9080c442f 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -43,13 +43,14 @@
43//usage: "\n" 43//usage: "\n"
44//usage: "tftpd should be used as an inetd service.\n" 44//usage: "tftpd should be used as an inetd service.\n"
45//usage: "tftpd's line for inetd.conf:\n" 45//usage: "tftpd's line for inetd.conf:\n"
46//usage: " 69 dgram udp nowait root tftpd tftpd /files/to/serve\n" 46//usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n"
47//usage: "It also can be ran from udpsvd:\n" 47//usage: "It also can be ran from udpsvd:\n"
48//usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" 48//usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n"
49//usage: "\nOptions:" 49//usage: "\nOptions:"
50//usage: "\n -r Prohibit upload" 50//usage: "\n -r Prohibit upload"
51//usage: "\n -c Allow file creation via upload" 51//usage: "\n -c Allow file creation via upload"
52//usage: "\n -u Access files as USER" 52//usage: "\n -u Access files as USER"
53//usage: "\n -l Log to syslog (inetd mode requires this)"
53 54
54#include "libbb.h" 55#include "libbb.h"
55 56
@@ -92,6 +93,7 @@ enum {
92 TFTPD_OPT_r = (1 << 8) * ENABLE_TFTPD, 93 TFTPD_OPT_r = (1 << 8) * ENABLE_TFTPD,
93 TFTPD_OPT_c = (1 << 9) * ENABLE_TFTPD, 94 TFTPD_OPT_c = (1 << 9) * ENABLE_TFTPD,
94 TFTPD_OPT_u = (1 << 10) * ENABLE_TFTPD, 95 TFTPD_OPT_u = (1 << 10) * ENABLE_TFTPD,
96 TFTPD_OPT_l = (1 << 11) * ENABLE_TFTPD,
95}; 97};
96 98
97#if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT 99#if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT
@@ -782,8 +784,12 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
782 peer_lsa->len = our_lsa->len; 784 peer_lsa->len = our_lsa->len;
783 785
784 /* Shifting to not collide with TFTP_OPTs */ 786 /* Shifting to not collide with TFTP_OPTs */
785 opt = option_mask32 = TFTPD_OPT | (getopt32(argv, "rcu:", &user_opt) << 8); 787 opt = option_mask32 = TFTPD_OPT | (getopt32(argv, "rcu:l", &user_opt) << 8);
786 argv += optind; 788 argv += optind;
789 if (opt & TFTPD_OPT_l) {
790 openlog(applet_name, LOG_PID, LOG_DAEMON);
791 logmode = LOGMODE_SYSLOG;
792 }
787 if (argv[0]) 793 if (argv[0])
788 xchdir(argv[0]); 794 xchdir(argv[0]);
789 795