diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-09-15 23:35:58 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-09-15 23:35:58 +0200 |
commit | 7666fa1d02b4e7e74a83833881caef09b475b88b (patch) | |
tree | 413baf197e4f5094327b9fe15437b5df550628d6 | |
parent | 05399fc53dc0b812727e44189882181ecaf3b6d6 (diff) | |
download | busybox-w32-7666fa1d02b4e7e74a83833881caef09b475b88b.tar.gz busybox-w32-7666fa1d02b4e7e74a83833881caef09b475b88b.tar.bz2 busybox-w32-7666fa1d02b4e7e74a83833881caef09b475b88b.zip |
ftpd: make LIST command show dotfiles too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/ftpd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c index 9fcc3e963..6adcb1dee 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c | |||
@@ -622,7 +622,7 @@ popen_ls(const char *opt) | |||
622 | pid_t pid; | 622 | pid_t pid; |
623 | 623 | ||
624 | argv[0] = "ftpd"; | 624 | argv[0] = "ftpd"; |
625 | argv[1] = opt; /* "-l" or "-1" */ | 625 | argv[1] = opt; /* "-lA" or "-1A" */ |
626 | argv[2] = "--"; | 626 | argv[2] = "--"; |
627 | argv[3] = G.ftp_arg; | 627 | argv[3] = G.ftp_arg; |
628 | argv[4] = NULL; | 628 | argv[4] = NULL; |
@@ -699,7 +699,7 @@ handle_dir_common(int opts) | |||
699 | if (!(opts & USE_CTRL_CONN) && !port_or_pasv_was_seen()) | 699 | if (!(opts & USE_CTRL_CONN) && !port_or_pasv_was_seen()) |
700 | return; /* port_or_pasv_was_seen emitted error response */ | 700 | return; /* port_or_pasv_was_seen emitted error response */ |
701 | 701 | ||
702 | ls_fd = popen_ls((opts & LONG_LISTING) ? "-l" : "-1"); | 702 | ls_fd = popen_ls((opts & LONG_LISTING) ? "-lA" : "-1A"); |
703 | ls_fp = xfdopen_for_read(ls_fd); | 703 | ls_fp = xfdopen_for_read(ls_fd); |
704 | /* FIXME: filenames with embedded newlines are mishandled */ | 704 | /* FIXME: filenames with embedded newlines are mishandled */ |
705 | 705 | ||
@@ -1102,10 +1102,11 @@ enum { | |||
1102 | #if !BB_MMU | 1102 | #if !BB_MMU |
1103 | OPT_l = (1 << 0), | 1103 | OPT_l = (1 << 0), |
1104 | OPT_1 = (1 << 1), | 1104 | OPT_1 = (1 << 1), |
1105 | OPT_A = (1 << 2), | ||
1105 | #endif | 1106 | #endif |
1106 | OPT_v = (1 << ((!BB_MMU) * 2 + 0)), | 1107 | OPT_v = (1 << ((!BB_MMU) * 3 + 0)), |
1107 | OPT_S = (1 << ((!BB_MMU) * 2 + 1)), | 1108 | OPT_S = (1 << ((!BB_MMU) * 3 + 1)), |
1108 | OPT_w = (1 << ((!BB_MMU) * 2 + 2)) * ENABLE_FEATURE_FTP_WRITE, | 1109 | OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTP_WRITE, |
1109 | }; | 1110 | }; |
1110 | 1111 | ||
1111 | int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 1112 | int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
@@ -1126,12 +1127,11 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) | |||
1126 | G.timeout = 2 * 60; | 1127 | G.timeout = 2 * 60; |
1127 | opt_complementary = "t+:T+:vv:SS"; | 1128 | opt_complementary = "t+:T+:vv:SS"; |
1128 | #if BB_MMU | 1129 | #if BB_MMU |
1129 | opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); | 1130 | opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); |
1130 | #else | 1131 | #else |
1131 | opts = getopt32(argv, "l1vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); | 1132 | opts = getopt32(argv, "l1AvS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); |
1132 | if (opts & (OPT_l|OPT_1)) { | 1133 | if (opts & (OPT_l|OPT_1)) { |
1133 | /* Our secret backdoor to ls */ | 1134 | /* Our secret backdoor to ls */ |
1134 | /* TODO: pass -A? It shows dot files */ | ||
1135 | /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */ | 1135 | /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */ |
1136 | if (fchdir(3) != 0) | 1136 | if (fchdir(3) != 0) |
1137 | _exit(127); | 1137 | _exit(127); |