wok-current annotate 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
rev   line source
pascal@19350 1 Keep anonynous default usage, need -a for authentication check
pascal@19350 2 --- busybox-1.23.0/networking/ftpd.c
pascal@19350 3 +++ busybox-1.23.0/networking/ftpd.c
pascal@19350 4 @@ -13,7 +13,7 @@
pascal@19350 5 */
pascal@19350 6
pascal@19350 7 //usage:#define ftpd_trivial_usage
pascal@19350 8 -//usage: "[-wvS] [-t N] [-T N] [DIR]"
pascal@19350 9 +//usage: "[-wvSa] [-t N] [-T N] [DIR]"
pascal@19350 10 //usage:#define ftpd_full_usage "\n\n"
pascal@19350 11 //usage: "Anonymous FTP server\n"
pascal@19350 12 //usage: "\n"
pascal@19350 13 @@ -25,6 +25,7 @@
pascal@19350 14 //usage: "\n -w Allow upload"
pascal@19350 15 //usage: "\n -v Log errors to stderr. -vv: verbose log"
pascal@19350 16 //usage: "\n -S Log errors to syslog. -SS: verbose log"
pascal@19350 17 +//usage: "\n -a Authentication check"
pascal@19350 18 //usage: "\n -t,-T Idle and absolute timeouts"
pascal@19350 19 //usage: "\n DIR Change root to this directory"
pascal@19350 20
pascal@19350 21 @@ -1106,7 +1107,8 @@
pascal@19350 22 #endif
pascal@19350 23 OPT_v = (1 << ((!BB_MMU) * 3 + 0)),
pascal@19350 24 OPT_S = (1 << ((!BB_MMU) * 3 + 1)),
pascal@19350 25 - OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTP_WRITE,
pascal@19350 26 + OPT_a = (1 << ((!BB_MMU) * 3 + 2)),
pascal@19350 27 + OPT_w = (1 << ((!BB_MMU) * 3 + 3)) * ENABLE_FEATURE_FTP_WRITE,
pascal@19350 28 };
pascal@19350 29
pascal@19350 30 int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
pascal@19350 31 @@ -1127,9 +1129,9 @@
pascal@19350 32 G.timeout = 2 * 60;
pascal@19350 33 opt_complementary = "t+:T+:vv:SS";
pascal@19350 34 #if BB_MMU
pascal@19350 35 - opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19350 36 + opts = getopt32(argv, "vSa" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19350 37 #else
pascal@19350 38 - opts = getopt32(argv, "l1AvS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19350 39 + opts = getopt32(argv, "l1AvSa" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
pascal@19350 40 if (opts & (OPT_l|OPT_1)) {
pascal@19350 41 /* Our secret backdoor to ls */
pascal@19350 42 /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */
pascal@19350 43 @@ -1193,7 +1195,8 @@
pascal@19350 44 signal(SIGALRM, timeout_handler);
pascal@19350 45
pascal@19350 46 #if ENABLE_FEATURE_FTP_AUTHENTICATION
pascal@19350 47 - {
pascal@19350 48 + if (opts & OPT_a) {
pascal@19350 49 + {
pascal@19350 50 struct passwd *pw = NULL;
pascal@19350 51
pascal@19350 52 while (1) {
pascal@19350 53 @@ -1216,8 +1219,9 @@
pascal@19350 54 }
pascal@19350 55 }
pascal@19350 56 change_identity(pw);
pascal@19350 57 + }
pascal@19350 58 + WRITE_OK(FTP_LOGINOK);
pascal@19350 59 }
pascal@19350 60 - WRITE_OK(FTP_LOGINOK);
pascal@19350 61 #endif
pascal@19350 62
pascal@19350 63 /* Do this after auth, else /etc/passwd is not accessible */