wok-current diff busybox/stuff/busybox-1.23-ftpd.u @ rev 19722
Up cgal (4.9)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Feb 16 13:20:58 2017 +0100 (2017-02-16) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/busybox/stuff/busybox-1.23-ftpd.u Thu Feb 16 13:20:58 2017 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +Keep anonynous default usage, need -a for authentication check 1.5 +--- busybox-1.23.0/networking/ftpd.c 1.6 ++++ busybox-1.23.0/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 +@@ -1106,7 +1107,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 +@@ -1127,9 +1129,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 +@@ -1193,7 +1195,8 @@ 1.47 + signal(SIGALRM, timeout_handler); 1.48 + 1.49 + #if ENABLE_FEATURE_FTP_AUTHENTICATION 1.50 +- { 1.51 ++ if (opts & OPT_a) { 1.52 ++ { 1.53 + struct passwd *pw = NULL; 1.54 + 1.55 + while (1) { 1.56 +@@ -1216,8 +1219,9 @@ 1.57 + } 1.58 + } 1.59 + change_identity(pw); 1.60 ++ } 1.61 ++ WRITE_OK(FTP_LOGINOK); 1.62 + } 1.63 +- WRITE_OK(FTP_LOGINOK); 1.64 + #endif 1.65 + 1.66 + /* Do this after auth, else /etc/passwd is not accessible */