wok diff busybox/stuff/busybox-1.26-ftpd.u @ rev 20175

fake-sane: fix path
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jan 24 14:55:51 2018 +0100 (2018-01-24)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.26-ftpd.u	Wed Jan 24 14:55:51 2018 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +Keep anonynous default usage, need -a for authentication check
     1.5 +--- busybox-1.26/networking/ftpd.c
     1.6 ++++ busybox-1.26/networking/ftpd.c
     1.7 +@@ -47,7 +47,7 @@
     1.8 + //kbuild:lib-$(CONFIG_FTPD) += ftpd.o
     1.9 + 
    1.10 + //usage:#define ftpd_trivial_usage
    1.11 +-//usage:       "[-wvS] [-t N] [-T N] [DIR]"
    1.12 ++//usage:       "[-wvSa] [-t N] [-T N] [DIR]"
    1.13 + //usage:#define ftpd_full_usage "\n\n"
    1.14 + //usage:       "Anonymous FTP server\n"
    1.15 + //usage:       "\n"
    1.16 +@@ -59,6 +59,7 @@
    1.17 + //usage:     "\n	-w	Allow upload"
    1.18 + //usage:     "\n	-v	Log errors to stderr. -vv: verbose log"
    1.19 + //usage:     "\n	-S	Log errors to syslog. -SS: verbose log"
    1.20 ++//usage:     "\n	-a	Authentication check"
    1.21 + //usage:     "\n	-t,-T	Idle and absolute timeouts"
    1.22 + //usage:     "\n	DIR	Change root to this directory"
    1.23 + 
    1.24 +@@ -1142,7 +1143,8 @@
    1.25 + #endif
    1.26 + 	OPT_v = (1 << ((!BB_MMU) * 3 + 0)),
    1.27 + 	OPT_S = (1 << ((!BB_MMU) * 3 + 1)),
    1.28 +-	OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTPD_WRITE,
    1.29 ++	OPT_a = (1 << ((!BB_MMU) * 3 + 2)),
    1.30 ++	OPT_w = (1 << ((!BB_MMU) * 3 + 3)) * ENABLE_FEATURE_FTPD_WRITE,
    1.31 + };
    1.32 + 
    1.33 + int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1.34 +@@ -1166,9 +1168,9 @@
    1.35 + 	G.timeout = 2 * 60;
    1.36 + 	opt_complementary = "vv:SS";
    1.37 + #if BB_MMU
    1.38 +-	opts = getopt32(argv,    "vS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.39 ++	opts = getopt32(argv,    "vSa" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.40 + #else
    1.41 +-	opts = getopt32(argv, "l1AvS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.42 ++	opts = getopt32(argv, "l1AvSa" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.43 + 	if (opts & (OPT_l|OPT_1)) {
    1.44 + 		/* Our secret backdoor to ls */
    1.45 + /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */
    1.46 +@@ -1232,7 +1234,7 @@
    1.47 + 	signal(SIGALRM, timeout_handler);
    1.48 + 
    1.49 + #if ENABLE_FEATURE_FTPD_AUTHENTICATION
    1.50 +-	while (1) {
    1.51 ++	if (opts & OPT_a) while (1) {
    1.52 + 		uint32_t cmdval = cmdio_get_cmd_and_arg();
    1.53 + 			if (cmdval == const_USER) {
    1.54 + 			pw = getpwnam(G.ftp_arg);
    1.55 +@@ -1282,7 +1284,7 @@
    1.56 + 	}
    1.57 + 
    1.58 + #if ENABLE_FEATURE_FTPD_AUTHENTICATION
    1.59 +-	change_identity(pw);
    1.60 ++	if (opts & OPT_a) change_identity(pw);
    1.61 + #endif
    1.62 + 
    1.63 + 	/* RFC-959 Section 5.1