diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-07 14:18:42 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-07 14:18:42 +0200 |
commit | e0afe0a9fd610b1972fdaa444ca39af0b0be6ec4 (patch) | |
tree | bc460e96d0e777d05d46a7d0e47ecceb96b62d56 | |
parent | 8edaaced16664503e89d9be80637e17dedc56ab9 (diff) | |
download | busybox-w32-e0afe0a9fd610b1972fdaa444ca39af0b0be6ec4.tar.gz busybox-w32-e0afe0a9fd610b1972fdaa444ca39af0b0be6ec4.tar.bz2 busybox-w32-e0afe0a9fd610b1972fdaa444ca39af0b0be6ec4.zip |
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>
-rw-r--r-- | networking/ftpd.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c index 4ecdb4121..6ca231c90 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c | |||
@@ -71,6 +71,10 @@ | |||
71 | //usage: "\n -w Allow upload" | 71 | //usage: "\n -w Allow upload" |
72 | //usage: IF_FEATURE_FTPD_AUTHENTICATION( | 72 | //usage: IF_FEATURE_FTPD_AUTHENTICATION( |
73 | //usage: "\n -A No login required, client access occurs under ftpd's UID" | 73 | //usage: "\n -A No login required, client access occurs under ftpd's UID" |
74 | // | ||
75 | // if !FTPD_AUTHENTICATION, -A is accepted too, but not shown in --help | ||
76 | // since it's the only supported mode in that configuration | ||
77 | // | ||
74 | //usage: "\n -a USER Enable 'anonymous' login and map it to USER" | 78 | //usage: "\n -a USER Enable 'anonymous' login and map it to USER" |
75 | //usage: ) | 79 | //usage: ) |
76 | //usage: "\n -v Log errors to stderr. -vv: verbose log" | 80 | //usage: "\n -v Log errors to stderr. -vv: verbose log" |
@@ -1157,14 +1161,12 @@ enum { | |||
1157 | #if !BB_MMU | 1161 | #if !BB_MMU |
1158 | OPT_l = (1 << 0), | 1162 | OPT_l = (1 << 0), |
1159 | OPT_1 = (1 << 1), | 1163 | OPT_1 = (1 << 1), |
1160 | OPT_A = (1 << 2), | ||
1161 | #endif | 1164 | #endif |
1162 | BIT_v = (!BB_MMU) * 3, | 1165 | BIT_A = (!BB_MMU) * 2, |
1163 | OPT_v = (1 << (BIT_v + 0)), | 1166 | OPT_A = (1 << (BIT_A + 0)), |
1164 | OPT_S = (1 << (BIT_v + 1)), | 1167 | OPT_v = (1 << (BIT_A + 1)), |
1165 | OPT_w = (1 << (BIT_v + 2)) * ENABLE_FEATURE_FTPD_WRITE, | 1168 | OPT_S = (1 << (BIT_A + 2)), |
1166 | BIT_A = BIT_v + 2 + ENABLE_FEATURE_FTPD_WRITE, | 1169 | OPT_w = (1 << (BIT_A + 3)) * ENABLE_FEATURE_FTPD_WRITE, |
1167 | OPT_A = (1 << (BIT_A + 0)) * ENABLE_FEATURE_FTPD_AUTHENTICATION, | ||
1168 | }; | 1170 | }; |
1169 | 1171 | ||
1170 | int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 1172 | int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
@@ -1184,26 +1186,25 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) | |||
1184 | verbose_S = 0; | 1186 | verbose_S = 0; |
1185 | G.timeout = 2 * 60; | 1187 | G.timeout = 2 * 60; |
1186 | #if BB_MMU | 1188 | #if BB_MMU |
1187 | opts = getopt32(argv, "^" "vS" | 1189 | opts = getopt32(argv, "^" "AvS" IF_FEATURE_FTPD_WRITE("w") |
1188 | IF_FEATURE_FTPD_WRITE("w") IF_FEATURE_FTPD_AUTHENTICATION("A") | ||
1189 | "t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:") | 1190 | "t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:") |
1190 | "\0" "vv:SS", | 1191 | "\0" "vv:SS", |
1191 | &G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,) | 1192 | &G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,) |
1192 | &G.verbose, &verbose_S | 1193 | &G.verbose, &verbose_S |
1193 | ); | 1194 | ); |
1194 | #else | 1195 | #else |
1195 | opts = getopt32(argv, "^" "l1AvS" | 1196 | opts = getopt32(argv, "^" "l1AvS" IF_FEATURE_FTPD_WRITE("w") |
1196 | IF_FEATURE_FTPD_WRITE("w") IF_FEATURE_FTPD_AUTHENTICATION("A") | ||
1197 | "t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:") | 1197 | "t:+T:+" IF_FEATURE_FTPD_AUTHENTICATION("a:") |
1198 | "\0" "vv:SS", | 1198 | "\0" "vv:SS", |
1199 | &G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,) | 1199 | &G.timeout, &abs_timeout, IF_FEATURE_FTPD_AUTHENTICATION(&anon_opt,) |
1200 | &G.verbose, &verbose_S | 1200 | &G.verbose, &verbose_S |
1201 | ); | 1201 | ); |
1202 | if (opts & (OPT_l|OPT_1)) { | 1202 | if (opts & (OPT_l|OPT_1)) { |
1203 | /* Our secret backdoor to ls */ | 1203 | /* Our secret backdoor to ls: see popen_ls() */ |
1204 | if (fchdir(3) != 0) | 1204 | if (fchdir(3) != 0) |
1205 | _exit(127); | 1205 | _exit(127); |
1206 | /* memset(&G, 0, sizeof(G)); - ls_main does it */ | 1206 | /* memset(&G, 0, sizeof(G)); - ls_main does it */ |
1207 | /* NB: in this case -A has a different meaning: like "ls -A" */ | ||
1207 | return ls_main(/*argc_unused*/ 0, argv); | 1208 | return ls_main(/*argc_unused*/ 0, argv); |
1208 | } | 1209 | } |
1209 | #endif | 1210 | #endif |