summaryrefslogtreecommitdiff
path: root/networking/ftpd.c
AgeCommit message (Collapse)Author
2015-10-13ftpd: make DIR parameter work for non-root too: chdir to it instead of chrootDenys Vlasenko
Unfortunately, chroot() works only for root user, because of attacks on setuid binaries (make DIR/lib/ld-linux.so a shell, hardlink to a setuid binary, chroot to DIR, execute it and get root shell). function old new delta ftpd_main 2160 2180 +20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24libbb: add setsockopt_foo helpersDenys Vlasenko
function old new delta setsockopt_int - 23 +23 do_load 918 934 +16 setsockopt_SOL_SOCKET_int - 14 +14 setsockopt_keepalive - 10 +10 setsockopt_SOL_SOCKET_1 - 10 +10 buffer_fill_and_print 169 178 +9 setsockopt_1 - 8 +8 nfsmount 3560 3566 +6 redirect 1277 1282 +5 tcpudpsvd_main 1782 1786 +4 d6_send_kernel_packet 272 275 +3 i2cget_main 380 382 +2 ed_main 2544 2545 +1 scan_recursive 380 378 -2 nbdclient_main 492 490 -2 hash_find 235 233 -2 cmdputs 334 332 -2 parse_command 1443 1440 -3 static.two 4 - -4 ntpd_main 1039 1035 -4 const_int_1 4 - -4 const_IPTOS_LOWDELAY 4 - -4 RCVBUF 4 - -4 ntp_init 474 469 -5 change_listen_mode 316 310 -6 uevent_main 416 409 -7 arping_main 1697 1690 -7 telnet_main 1612 1603 -9 socket_want_pktinfo 42 33 -9 setsockopt_reuseaddr 21 10 -11 setsockopt_broadcast 21 10 -11 httpd_main 772 757 -15 get_remote_transfer_fd 109 94 -15 make_new_session 503 487 -16 ftpd_main 2177 2160 -17 read_bunzip 1896 1866 -30 common_traceroute_main 4099 4058 -41 common_ping_main 1836 1783 -53 ------------------------------------------------------------------------------ (add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283) Total: -172 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-31ftpd: change_identity() must be after chroot()Denys Vlasenko
Otherwise chroot() doesn't work for non-root Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-26ftpd: prevent zombies. closes 7832Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-15ftpd: make LIST command show dotfiles tooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-05ftpd: add optional support for authenticationMorten Kvistgaard
function old new delta cmdio_get_cmd_and_arg - 237 +237 get_passwd - 97 +97 check_password - 82 +82 ftpd_main 2297 2178 -119 ask_and_check_password_extended 206 84 -122 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/2 up/down: 416/-241) Total: 175 bytes Signed-off-by: Morten Kvistgaard <MK@pch-engineering.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27ftpd: do not use root_fd if we are not in chrootDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27ftpd: for LIST, open current directory *in the child*Denys Vlasenko
Last change introduced an open fd leak. This is the fix. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27ftpd: escape chroot prior to re-executing ls helperDenys Vlasenko
When we merely chdir to saved "real" root fd, exec("proc/self/exe") works for static executables but not for dynamic ones (they can't find their interpreter). With this patch, we also *chroot* to real root. As a bonus, this gives us proper usernames, timezone conversion etc. function old new delta popen_ls 203 259 +56 ftpd_main 2362 2366 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-26ftpd: optimize writes of LIST results a bitDenys Vlasenko
function old new delta handle_dir_common 201 207 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25ftpd: support deprecated XPWD commandDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-11ftpd: free allocated string on error pathDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-11ftpd: fix MDTM's month value. Closes 5336Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08libbb: make xchroot do a chdir("/") after chrootDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-07libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08ftpd: better usage textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12*: s/xatoi_u/xatoi_positive/g - I got bored of mistyping xatoi_u as xatou_iDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04*: introduce and use xfork() and xvfork()Pascal Bellard
function old new delta launch_helper 170 169 -1 setup_heredoc 312 302 -10 handle_dir_common 367 354 -13 expand_vars_to_list 2456 2443 -13 open_transformer 89 74 -15 data_extract_to_command 439 423 -16 do_ipaddr 1406 1389 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85) Total: -85 bytes Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-21ftpd: work around LIST -aXYZ too, not only LIST -lXYZDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06telnetd: fill hostname field in utmp/wtmp recordsDenys Vlasenko
function old new delta get_lsa - 109 +109 make_new_session 438 504 +66 get_peer_lsa - 10 +10 ftpd_main 2340 2267 -73 get_sock_lsa 101 10 -91 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 1/2 up/down: 185/-164) Total: 21 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03ftpd: shrink by 33 bytesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-24typo fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04*: suppress ~60% of "aliased warnings" on gcc-4.4.1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18ftpd: conditional support for broken clientsStefan Seyfried
Signed-off-by: Stefan Seyfried <stefan.seyfried@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-17ftpd: code shrinkDenys Vlasenko
function old new delta MMU: handle_dir_common 354 338 -16 NOMMU: ftpd_main 2437 2442 +5 popen_ls 201 174 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15libbb: added xfdopen_for_read/writeDenys Vlasenko
function old new delta xfdopen_helper - 40 +40 logdir_open 1163 1184 +21 process_stdin 433 443 +10 xfdopen_for_write - 9 +9 doCommands 2465 2474 +9 patch_main 1214 1222 +8 bbunpack 457 465 +8 xfdopen_for_read - 7 +7 scan_tree 258 262 +4 xstrtoul_range_sfx 230 231 +1 sendmail_main 957 955 -2 passwd_main 1027 1023 -4 parse 969 964 -5 test_main 253 247 -6 sed_main 655 649 -6 dos2unix_main 437 429 -8 fbsplash_main 950 938 -12 handle_dir_common 371 354 -17 expand_vars_to_list 2197 2169 -28 update_passwd 1275 1246 -29 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02*: introduce and use ffulsh_all()Denys Vlasenko
function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-30find: add zeroing of G.xxx; ftpd - remove extraneous zeroing of G.xxxDenys Vlasenko
Brought "G trick" to the same shape in a few more places. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05ftpd: allow multiple -S options to increase verbosity too, like -vDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-04ftpd: fix a case when with -w unknown commands are ignored with no error codeDenys Vlasenko
Signed-off-by: Stefan Seyfried <seife@suse.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-21*: mass renaming of USE_XXXX to IF_XXXXDenis Vlasenko
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
2009-04-04ftpd: s/CONFIG_BUSYBOX_EXEC_PATH/bb_busybox_exec_path/Denis Vlasenko
2009-03-18ftpd: fix command fetching to not do it in 1-byte reads;Denis Vlasenko
fix command de-escaping. Tested to download files with embeeded \xff and LF. libbb: tweaks for the above function old new delta ftpd_main 2231 2321 +90 xmalloc_fgets_internal 190 222 +32 xmalloc_fgets_str_len - 27 +27 xmalloc_fgets_str 7 23 +16 xmalloc_fgetline_str 10 26 +16 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0) Total: 181 bytes
2009-03-18ftpd: add some commentsDenis Vlasenko
2009-03-18ftpd: trim messages (but make sure they still make sense)Denis Vlasenko
text data bss dec hex filename 4400 0 0 4400 1130 ftpd_old.o 4346 0 0 4346 10fa ftpd.o
2009-03-18ftpd: do not use nasty tricks for re-execing if we are on MMU machine.Denis Vlasenko
On NOMMU, code is alomost the same, on MMU: function old new delta handle_dir_common 223 390 +167 ftpd_main 2306 2231 -75 popen_ls 203 - -203 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 167/-278) Total: -111 bytes
2009-03-18ftpd: add support for MDTM, I see clients often use it,Denis Vlasenko
it may allow client-side caching. function old new delta ftpd_main 2232 2306 +74 gmtime_r - 19 +19 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 93/0) Total: 93 bytes
2009-03-17ftpd: document NLST formatDenis Vlasenko
2009-03-17ftpd: instead of wordy HELP, implement useful, and smaller, FEAT.Denis Vlasenko
(HELP is still "supported" as an alias to FEAT) text data bss dec hex filename 807331 468 7856 815655 c7227 busybox_old 807246 468 7856 815570 c71d2 busybox_unstripped
2009-03-17ftpd: implement -vv verbosityDenis Vlasenko
function old new delta ftpd_main 2097 2190 +93 verbose_log - 33 +33 cmdio_write_raw 12 34 +22 cmdio_write_ok 25 45 +20 cmdio_write_error 25 45 +20 cmdio_write 62 78 +16 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/0 up/down: 204/0) Total: 204 bytes
2009-03-17ftpd: tweak timeout codeDenis Vlasenko
2009-03-16ftpd: fix thinko: set_nport takes port in network orderDenis Vlasenko
2009-03-16ftpd: dont use fdprintf for simple status messagesDenis Vlasenko
function old new delta ftpd_main 2025 2055 +30 cmdio_write_ok 17 25 +8 cmdio_write_error 17 25 +8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 46/0) Total: 46 bytes
2009-03-16ftpd: simplify PORT check by assuming IP = peer's IP.Denis Vlasenko
Should be as safe as before this change. function old new delta ftpd_main 2115 2025 -90
2009-03-16ftpd: add idle and absolute timeouts. This is a security issue,Denis Vlasenko
otherwise ftpd may end up hanging indefinitely. function old new delta timeout_handler - 110 +110 ftpd_main 2019 2115 +96 packed_usage 25662 25685 +23 handle_upload_common 306 322 +16 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 245/0) Total: 245 bytes
2009-03-16ftpd: security tightened up:Denis Vlasenko
PORT is not allowed on !IPv4 PORT must have IP == peer's IP upload is allowed only into regular files function old new delta ftpd_main 1815 2019 +204 handle_upload_common 260 306 +46 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 250/0) Total: 250 bytes
2009-03-15ftpd: fix the bug where >2GB file ops report errors;Denis Vlasenko
make a few simplifications; add TODOs. function old new delta port_or_pasv_was_seen - 37 +37 get_remote_transfer_fd 104 109 +5 handle_upload_common 265 260 -5 handle_dir_common 228 223 -5 popen_ls 211 203 -8 ftpd_main 1825 1815 -10 data_transfer_checks_ok 37 - -37 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/4 up/down: 42/-65) Total: -23 bytes