ftpd: allow -A if !FTPD_AUTHENTICATION as well
Users will be able to use "ftpd -A" in scripts regardless of build config Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
8edaaced16
commit
e0afe0a9fd
@ -71,6 +71,10 @@
|
|||||||
//usage: "\n -w Allow upload"
|
//usage: "\n -w Allow upload"
|
||||||
//usage: IF_FEATURE_FTPD_AUTHENTICATION(
|
//usage: IF_FEATURE_FTPD_AUTHENTICATION(
|
||||||
//usage: "\n -A No login required, client access occurs under ftpd's UID"
|
//usage: "\n -A No login required, client access occurs under ftpd's UID"
|
||||||
|
//
|
||||||
|
// if !FTPD_AUTHENTICATION, -A is accepted too, but not shown in --help
|
||||||
|
// since it's the only supported mode in that configuration
|
||||||
|
//
|
||||||
//usage: "\n -a USER Enable 'anonymous' login and map it to USER"
|
//usage: "\n -a USER Enable 'anonymous' login and map it to USER"
|
||||||
//usage: )
|
//usage: )
|
||||||
//usage: "\n -v Log errors to stderr. -vv: verbose log"
|
//usage: "\n -v Log errors to stderr. -vv: verbose log"
|
||||||
@ -1157,14 +1161,12 @@ enum {
|
|||||||
#if !BB_MMU
|
#if !BB_MMU
|
||||||
OPT_l = (1 << 0),
|
OPT_l = (1 << 0),
|
||||||
OPT_1 = (1 << 1),
|
OPT_1 = (1 << 1),
|
||||||
OPT_A = (1 << 2),
|
|
||||||
#endif
|
#endif
|
||||||
BIT_v = (!BB_MMU) * 3,
|
BIT_A = (!BB_MMU) * 2,
|
||||||
OPT_v = (1 << (BIT_v + 0)),
|
OPT_A = (1 << (BIT_A + 0)),
|
||||||
OPT_S = (1 << (BIT_v + 1)),
|
OPT_v = (1 << (BIT_A + 1)),
|
||||||
OPT_w = (1 << (BIT_v + 2)) * ENABLE_FEATURE_FTPD_WRITE,
|
OPT_S = (1 << (BIT_A + 2)),
|
||||||
BIT_A = BIT_v + 2 + ENABLE_FEATURE_FTPD_WRITE,
|
OPT_w = (1 << (BIT_A + 3)) * ENABLE_FEATURE_FTPD_WRITE,
|
||||||
OPT_A = (1 << (BIT_A + 0)) * ENABLE_FEATURE_FTPD_AUTHENTICATION,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
@ -1184,26 +1186,25 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
verbose_S = 0;
|
verbose_S = 0;
|
||||||
G.timeout = 2 * 60;
|
G.timeout = 2 * 60;
|
||||||
#if BB_MMU
|
#if BB_MMU
|
||||||
opts = getopt32(argv, "^" "vS"
|
opts = getopt32(argv, "^" "AvS" IF_FEATURE_FTPD_WRITE("w")
|
||||||
IF_FEATURE_FTPD_WRITE("w") IF_FEATURE_FTPD_AUTHENTICATION("A")
|
|
||||||
"t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:")
|
"t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:")
|
||||||
"\0" "vv:SS",
|
"\0" "vv:SS",
|
||||||
&G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,)
|
&G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,)
|
||||||
&G.verbose, &verbose_S
|
&G.verbose, &verbose_S
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
opts = getopt32(argv, "^" "l1AvS"
|
opts = getopt32(argv, "^" "l1AvS" IF_FEATURE_FTPD_WRITE("w")
|
||||||
IF_FEATURE_FTPD_WRITE("w") IF_FEATURE_FTPD_AUTHENTICATION("A")
|
|
||||||
"t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:")
|
"t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:")
|
||||||
"\0" "vv:SS",
|
"\0" "vv:SS",
|
||||||
&G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,)
|
&G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,)
|
||||||
&G.verbose, &verbose_S
|
&G.verbose, &verbose_S
|
||||||
);
|
);
|
||||||
if (opts & (OPT_l|OPT_1)) {
|
if (opts & (OPT_l|OPT_1)) {
|
||||||
/* Our secret backdoor to ls */
|
/* Our secret backdoor to ls: see popen_ls() */
|
||||||
if (fchdir(3) != 0)
|
if (fchdir(3) != 0)
|
||||||
_exit(127);
|
_exit(127);
|
||||||
/* memset(&G, 0, sizeof(G)); - ls_main does it */
|
/* memset(&G, 0, sizeof(G)); - ls_main does it */
|
||||||
|
/* NB: in this case -A has a different meaning: like "ls -A" */
|
||||||
return ls_main(/*argc_unused*/ 0, argv);
|
return ls_main(/*argc_unused*/ 0, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user