wok diff busybox/stuff/busybox-1.25-ftpd.u @ rev 19597

Up: cURL (7.52.1)
author Alexander Medvedev <devl547@gmail.com>
date Sun Jan 01 17:49:15 2017 +0000 (2017-01-01)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.25-ftpd.u	Sun Jan 01 17:49:15 2017 +0000
     1.3 @@ -0,0 +1,60 @@
     1.4 +Keep anonynous default usage, need -a for authentication check
     1.5 +--- busybox-1.25/networking/ftpd.c
     1.6 ++++ busybox-1.25/networking/ftpd.c
     1.7 +@@ -13,7 +13,7 @@
     1.8 +  */
     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 +@@ -25,6 +25,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 +@@ -1108,7 +1109,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_FTP_WRITE,
    1.29 ++	OPT_a = (1 << ((!BB_MMU) * 3 + 2)),
    1.30 ++	OPT_w = (1 << ((!BB_MMU) * 3 + 3)) * ENABLE_FEATURE_FTP_WRITE,
    1.31 + };
    1.32 + 
    1.33 + int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1.34 +@@ -1132,9 +1134,9 @@
    1.35 + 	G.timeout = 2 * 60;
    1.36 + 	opt_complementary = "t+:T+:vv:SS";
    1.37 + #if BB_MMU
    1.38 +-	opts = getopt32(argv,    "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.39 ++	opts = getopt32(argv,    "vSa" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.40 + #else
    1.41 +-	opts = getopt32(argv, "l1AvS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
    1.42 ++	opts = getopt32(argv, "l1AvSa" IF_FEATURE_FTP_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 +@@ -1198,7 +1200,7 @@
    1.47 + 	signal(SIGALRM, timeout_handler);
    1.48 + 
    1.49 + #if ENABLE_FEATURE_FTP_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 +@@ -1248,7 +1250,7 @@
    1.56 + 	}
    1.57 + 
    1.58 + #if ENABLE_FEATURE_FTP_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