X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=networking%2Ftftp.c;h=ce48a1edd5f5089f5a68ea3467c9b5d8f59465c9;hb=3a9365e2732f5df2cdef758bc1f6e5e9da8fbcef;hp=6484410167983974c5ef5a3e1435ad68e39d06f0;hpb=88d3cfdb75b6da83f3552daceed803f0a29d0c9c;p=oweals%2Fbusybox.git diff --git a/networking/tftp.c b/networking/tftp.c index 648441016..ce48a1edd 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -23,7 +23,6 @@ //usage: "[OPTIONS] HOST [PORT]" //usage:#define tftp_full_usage "\n\n" //usage: "Transfer a file from/to tftp server\n" -//usage: "\nOptions:" //usage: "\n -l FILE Local FILE" //usage: "\n -r FILE Remote FILE" //usage: IF_FEATURE_TFTP_GET( @@ -46,7 +45,6 @@ //usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n" //usage: "It also can be ran from udpsvd:\n" //usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" -//usage: "\nOptions:" //usage: "\n -r Prohibit upload" //usage: "\n -c Allow file creation via upload" //usage: "\n -u Access files as USER" @@ -791,8 +789,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) openlog(applet_name, LOG_PID, LOG_DAEMON); logmode = LOGMODE_SYSLOG; } - if (argv[0]) - xchdir(argv[0]); + if (argv[0]) { + xchroot(argv[0]); + } result = recv_from_to(STDIN_FILENO, block_buf, sizeof(block_buf), 0 /* flags */, @@ -815,7 +814,8 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) goto err; } mode = local_file + strlen(local_file) + 1; - if (mode >= block_buf + result || strcmp(mode, "octet") != 0) { + /* RFC 1350 says mode string is case independent */ + if (mode >= block_buf + result || strcasecmp(mode, "octet") != 0) { goto err; } # if ENABLE_FEATURE_TFTP_BLOCKSIZE