wok annotate 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
rev   line source
pascal@19610 1 Keep anonynous default usage, need -a for authentication check
pascal@19610 2 --- busybox-1.26/networking/ftpd.c
pascal@19610 3 +++ busybox-1.26/networking/ftpd.c
pascal@19610 4 @@ -47,7 +47,7 @@
pascal@19610 5 //kbuild:lib-$(CONFIG_FTPD) += ftpd.o
pascal@19610 6
pascal@19610 7 //usage:#define ftpd_trivial_usage
pascal@19610 8 -//usage: "[-wvS] [-t N] [-T N] [DIR]"
pascal@19610 9 +//usage: "[-wvSa] [-t N] [-T N] [DIR]"
pascal@19610 10 //usage:#define ftpd_full_usage "\n\n"
pascal@19610 11 //usage: "Anonymous FTP server\n"
pascal@19610 12 //usage: "\n"
pascal@19610 13 @@ -59,6 +59,7 @@
pascal@19610 14 //usage: "\n -w Allow upload"
pascal@19610 15 //usage: "\n -v Log errors to stderr. -vv: verbose log"
pascal@19610 16 //usage: "\n -S Log errors to syslog. -SS: verbose log"
pascal@19610 17 +//usage: "\n -a Authentication check"
pascal@19610 18 //usage: "\n -t,-T Idle and absolute timeouts"
pascal@19610 19 //usage: "\n DIR Change root to this directory"
pascal@19610 20
pascal@19610 21 @@ -1142,7 +1143,8 @@
pascal@19610 22 #endif
pascal@19610 23 OPT_v = (1 << ((!BB_MMU) * 3 + 0)),
pascal@19610 24 OPT_S = (1 << ((!BB_MMU) * 3 + 1)),
pascal@19610 25 - OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTPD_WRITE,
pascal@19610 26 + OPT_a = (1 << ((!BB_MMU) * 3 + 2)),
pascal@19610 27 + OPT_w = (1 << ((!BB_MMU) * 3 + 3)) * ENABLE_FEATURE_FTPD_WRITE,
pascal@19610 28 };
pascal@19610 29
pascal@19610 30 int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
pascal@19610 31 @@ -1166,9 +1168,9 @@
pascal@19610 32 G.timeout = 2 * 60;
pascal@19610 33 opt_complementary = "vv:SS";
pascal@19610 34 #if BB_MMU
pascal@19610 35 - opts = getopt32(argv, "vS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19610 36 + opts = getopt32(argv, "vSa" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19610 37 #else
pascal@19610 38 - opts = getopt32(argv, "l1AvS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19610 39 + opts = getopt32(argv, "l1AvSa" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19610 40 if (opts & (OPT_l|OPT_1)) {
pascal@19610 41 /* Our secret backdoor to ls */
pascal@19610 42 /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */
pascal@19610 43 @@ -1232,7 +1234,7 @@
pascal@19610 44 signal(SIGALRM, timeout_handler);
pascal@19610 45
pascal@19610 46 #if ENABLE_FEATURE_FTPD_AUTHENTICATION
pascal@19610 47 - while (1) {
pascal@19610 48 + if (opts & OPT_a) while (1) {
pascal@19610 49 uint32_t cmdval = cmdio_get_cmd_and_arg();
pascal@19610 50 if (cmdval == const_USER) {
pascal@19610 51 pw = getpwnam(G.ftp_arg);
pascal@19610 52 @@ -1282,7 +1284,7 @@
pascal@19610 53 }
pascal@19610 54
pascal@19610 55 #if ENABLE_FEATURE_FTPD_AUTHENTICATION
pascal@19610 56 - change_identity(pw);
pascal@19610 57 + if (opts & OPT_a) change_identity(pw);
pascal@19610 58 #endif
pascal@19610 59
pascal@19610 60 /* RFC-959 Section 5.1