wok-next annotate busybox/stuff/busybox-1.23-ftpd.u @ rev 18805

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