wok annotate busybox/stuff/busybox-1.25-ftpd.u @ rev 19402

memtest: DOS shutdown (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Sep 03 19:40:30 2016 +0200 (2016-09-03)
parents
children
rev   line source
pascal@19340 1 Keep anonynous default usage, need -a for authentication check
pascal@19340 2 --- busybox-1.25/networking/ftpd.c
pascal@19340 3 +++ busybox-1.25/networking/ftpd.c
pascal@19340 4 @@ -13,7 +13,7 @@
pascal@19340 5 */
pascal@19340 6
pascal@19340 7 //usage:#define ftpd_trivial_usage
pascal@19340 8 -//usage: "[-wvS] [-t N] [-T N] [DIR]"
pascal@19340 9 +//usage: "[-wvSa] [-t N] [-T N] [DIR]"
pascal@19340 10 //usage:#define ftpd_full_usage "\n\n"
pascal@19340 11 //usage: "Anonymous FTP server\n"
pascal@19340 12 //usage: "\n"
pascal@19340 13 @@ -25,6 +25,7 @@
pascal@19340 14 //usage: "\n -w Allow upload"
pascal@19340 15 //usage: "\n -v Log errors to stderr. -vv: verbose log"
pascal@19340 16 //usage: "\n -S Log errors to syslog. -SS: verbose log"
pascal@19340 17 +//usage: "\n -a Authentication check"
pascal@19340 18 //usage: "\n -t,-T Idle and absolute timeouts"
pascal@19340 19 //usage: "\n DIR Change root to this directory"
pascal@19340 20
pascal@19340 21 @@ -1108,7 +1109,8 @@
pascal@19340 22 #endif
pascal@19340 23 OPT_v = (1 << ((!BB_MMU) * 3 + 0)),
pascal@19340 24 OPT_S = (1 << ((!BB_MMU) * 3 + 1)),
pascal@19340 25 - OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTP_WRITE,
pascal@19340 26 + OPT_a = (1 << ((!BB_MMU) * 3 + 2)),
pascal@19340 27 + OPT_w = (1 << ((!BB_MMU) * 3 + 3)) * ENABLE_FEATURE_FTP_WRITE,
pascal@19340 28 };
pascal@19340 29
pascal@19340 30 int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
pascal@19340 31 @@ -1132,9 +1134,9 @@
pascal@19340 32 G.timeout = 2 * 60;
pascal@19340 33 opt_complementary = "t+:T+:vv:SS";
pascal@19340 34 #if BB_MMU
pascal@19340 35 - opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19340 36 + opts = getopt32(argv, "vSa" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19340 37 #else
pascal@19340 38 - opts = getopt32(argv, "l1AvS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19340 39 + opts = getopt32(argv, "l1AvSa" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19340 40 if (opts & (OPT_l|OPT_1)) {
pascal@19340 41 /* Our secret backdoor to ls */
pascal@19340 42 /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */
pascal@19340 43 @@ -1198,7 +1200,7 @@
pascal@19340 44 signal(SIGALRM, timeout_handler);
pascal@19340 45
pascal@19340 46 #if ENABLE_FEATURE_FTP_AUTHENTICATION
pascal@19340 47 - while (1) {
pascal@19340 48 + if (opts & OPT_a) while (1) {
pascal@19340 49 uint32_t cmdval = cmdio_get_cmd_and_arg();
pascal@19340 50 if (cmdval == const_USER) {
pascal@19340 51 pw = getpwnam(G.ftp_arg);
pascal@19340 52 @@ -1248,7 +1250,7 @@
pascal@19340 53 }
pascal@19340 54
pascal@19340 55 #if ENABLE_FEATURE_FTP_AUTHENTICATION
pascal@19340 56 - change_identity(pw);
pascal@19340 57 + if (opts & OPT_a) change_identity(pw);
pascal@19340 58 #endif
pascal@19340 59
pascal@19340 60 /* RFC-959 Section 5.1