summaryrefslogtreecommitdiff
path: root/lib/ftp.c
Commit message (Collapse)AuthorAgeFilesLines
* terminology: call them null-terminated stringsDaniel Stenberg2020-06-281-2/+2
| | | | | | | | | | | Updated terminology in docs, comments and phrases to refer to C strings as "null-terminated". Done to unify with how most other C oriented docs refer of them and what users in general seem to prefer (based on a single highly unscientific poll on twitter). Reported-by: coinhubs on github Fixes #5598 Closes #5608
* escape: make the URL decode able to reject only %00 bytesDaniel Stenberg2020-06-251-3/+4
| | | | | | ... or all "control codes" or nothing. Assisted-by: Nicolas Sterchele
* Curl_inet_ntop: always check the return codeDaniel Stenberg2020-06-241-2/+5
| | | | | | Reported-by: Siva Sivaraman Fixes #5412 Closes #5597
* build: disable more code/data when built without proxy supportDaniel Stenberg2020-05-301-7/+21
| | | | | | Added build to travis to verify Closes #5466
* timeouts: change millisecond timeouts to timediff_t from time_tDaniel Stenberg2020-05-301-3/+3
| | | | | | | For millisecond timers we like timediff_t better. Also, time_t can be unsigned so returning a negative value doesn't work then. Closes #5479
* urldata: connect related booleans live in struct ConnectBitsDaniel Stenberg2020-05-271-2/+1
| | | | | | And remove a few unused booleans! Closes #5461
* cleanup: use a single space after equals sign in assignmentsDaniel Stenberg2020-05-261-1/+1
|
* all: fix codespell errorsViktor Szakats2020-05-251-1/+1
| | | | | | Reviewed-by: Jay Satiro Reviewed-by: Daniel Stenberg Closes https://github.com/curl/curl/pull/5452
* ftp: mark return-ignoring calls to Curl_GetFTPResponse with (void)Daniel Stenberg2020-05-191-2/+2
| | | | | | | They're done on purpose, make that visible in the code. Reported-by: MonocleAI Fixes #5412 Closes #549
* source cleanup: remove all custom typedef structsDaniel Stenberg2020-05-151-3/+3
| | | | | | | | | | | - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
* ftp: make domore_getsock() return the secondary socket properlyDaniel Stenberg2020-05-151-1/+3
| | | | | | | | Previously, after PASV and immediately after the data connection has connected, the function would only return the control socket to wait for which then made the data connection simply timeout and not get polled correctly. This become obvious when running test 1631 and 1632 event- based.
* ftp: shut down the secondary connection properly when SSL is usedDaniel Stenberg2020-05-151-3/+4
| | | | | | Reported-by: Neal Poole Fixes #5340 Closes #5385
* checksrc: enhance the ASTERISKSPACE and update code accordinglyDaniel Stenberg2020-05-141-1/+1
| | | | | | | | Fine: "struct hello *world" Not fine: "struct hello* world" (and variations) Closes #5386
* socks: make the connect phase non-blockingDaniel Stenberg2020-02-171-3/+6
| | | | | | Removes two entries from KNOWN_BUGS. Closes #4907
* ftp: convert 'sock_accepted' to a plain booleanDaniel Stenberg2020-02-161-1/+1
| | | | | | | This was an array indexed with sockindex but it was only ever used for the secondary socket. Closes #4929
* ftp: remove the duplicated user/password struct fieldsDaniel Stenberg2020-02-071-11/+2
| | | | Closes #4887
* ftp: remove superfluous checking for crlf in user or pwdDaniel Stenberg2020-02-071-17/+0
| | | | | | | | | ... as this is already done much earlier in the URL parser. Also add test case 894 that verifies that pop3 with an encodedd CR in the user name is rejected. Closes #4887
* ftp: shrink temp buffers used for PORTDaniel Stenberg2020-02-051-5/+6
| | | | | | | These two stack based buffers only need to be 46 + 66 bytes instead of 256 + 1024. Closes #4880
* parsedate: offer a getdate_capped() alternativeDaniel Stenberg2019-11-291-3/+1
| | | | | | | | | | | ... and use internally. This function will return TIME_T_MAX instead of failure if the parsed data is found to be larger than what can be represented. TIME_T_MAX being the largest value curl can represent. Reviewed-by: Daniel Gustafsson Reported-by: JanB on github Fixes #4152 Closes #4651
* FTP: url-decode path before evaluationZenju2019-09-271-169/+124
| | | | Closes #4428
* Revert "FTP: url-decode path before evaluation"Daniel Stenberg2019-09-261-124/+171
| | | | This reverts commit 2f036a72d543e96128bd75cb0fedd88815fd42e2.
* FTP: url-decode path before evaluationZenju2019-09-261-171/+124
| | | | Closes #4423
* FTP: FTPFILE_NOCWD: avoid redundant CWDsZenju2019-09-211-56/+60
| | | | Closes #4382
* ftp: the conditional expression is always trueDaniel Stenberg2019-09-201-4/+2
| | | | | | | ... both !result and (ftp->transfer != FTPTRANSFER_BODY)! Fixes warning detected by PVS-Studio Fixes #4374
* ftp: Expression 'ftpc->wait_data_conn' is always falseDaniel Stenberg2019-09-201-7/+2
| | | | | Fixes warning detected by PVS-Studio Fixes #4374
* ftp: Expression 'ftpc->wait_data_conn' is always trueDaniel Stenberg2019-09-201-6/+5
| | | | | Fixes warning detected by PVS-Studio Fixes #4374
* ftp: part of conditional expression is always true: !resultDaniel Stenberg2019-09-201-1/+1
| | | | | Fixes warning detected by PVS-Studio Fixes #4374
* FTP: remove trailing slash from path for LIST/MLSDZenju2019-09-181-8/+7
| | | | Closes #4348
* FTP: allow "rubbish" prepended to the SIZE responseDaniel Stenberg2019-09-131-2/+18
| | | | | | | | | | This is a protocol violation but apparently there are legacy proprietary servers doing this. Added test 336 and 337 to verify. Reported-by: Philippe Marguinaud Closes #4339
* FTP: skip CWD to entry dir when target is absoluteZenju2019-09-131-1/+3
| | | | Closes #4332
* timediff: make it 64 bit (if possible) even with 32 bit time_tDaniel Stenberg2019-08-011-2/+2
| | | | | | | ... to make it hold microseconds too. Fixes #4165 Closes #4168
* cleanup: remove the 'numsocks' argument used in many placesDaniel Stenberg2019-07-301-13/+6
| | | | | | | | | It was used (intended) to pass in the size of the 'socks' array that is also passed to these functions, but was rarely actually checked/used and the array is defined to a fixed size of MAX_SOCKSPEREASYHANDLE entries that should be used instead. Closes #4169
* build: fix Codacy warningsMarcel Raad2019-06-051-15/+3
| | | | | | Reduce variable scopes and remove redundant variable stores. Closes https://github.com/curl/curl/pull/3975
* cleanup: remove FIXME and TODO commentsDaniel Stenberg2019-05-161-2/+1
| | | | | | | | | They serve very little purpose and mostly just add noise. Most of them have been around for a very long time. I read them all before removing or rephrasing them. Ref: #3876 Closes #3883
* doh: disable DOH for the cases it doesn't workDaniel Stenberg2019-05-111-3/+3
| | | | | | | | | | Due to limitations in Curl_resolver_wait_resolv(), it doesn't work for DOH resolves. This fix disables DOH for those. Limitation added to KNOWN_BUGS. Fixes #3850 Closes #3857
* urldata: simplify bytecountersDaniel Stenberg2019-03-011-21/+14
| | | | | | | | | | | | | - no need to have them protocol specific - no need to set pointers to them with the Curl_setup_transfer() call - make Curl_setup_transfer() operate on a transfer pointer, not connection - switch some counters from long to the more proper curl_off_t type Closes #3627
* urldata: convert bools to bitfields and move to endDaniel Stenberg2019-02-271-1/+0
| | | | | | | | | | | | This allows the compiler to pack and align the structs better in memory. For a rather feature-complete build on x86_64 Linux, gcc 8.1.2 makes the Curl_easy struct 4.9% smaller. From 6312 bytes to 6000. Removed an unused struct field. No functionality changes. Closes #3610
* strerror: make the strerror function use local buffersDaniel Stenberg2019-02-261-11/+11
| | | | | | | | | | | | | | | | Instead of using a fixed 256 byte buffer in the connectdata struct. In my build, this reduces the size of the connectdata struct by 11.8%, from 2160 to 1904 bytes with no functionality or performance loss. This also fixes a bug in schannel's Curl_verify_certificate where it called Curl_sspi_strerror when it should have called Curl_strerror for string from GetLastError. the only effect would have been no text or the wrong text being shown for the error. Co-authored-by: Jay Satiro Closes #3612
* pingpong: ignore regular timeout in disconnect phaseDaniel Stenberg2018-12-171-3/+3
| | | | | | | | | | | The timeout set with CURLOPT_TIMEOUT is no longer used when disconnecting from one of the pingpong protocols (FTP, IMAP, SMTP, POP3). Reported-by: jasal82 on github Fixes #3264 Closes #3374
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-231-15/+15
| | | | | | | | | | | The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
* memory: ensure to check allocation resultsDaniel Gustafsson2018-10-031-1/+3
| | | | | | | | | | | | | | | | The result of a memory allocation should always be checked, as we may run under memory pressure where even a small allocation can fail. This adds checking and error handling to a few cases where the allocation wasn't checked for success. In the ftp case, the freeing of the path variable is moved ahead of the allocation since there is little point in keeping it around across the strdup, and the separation makes for more readable code. In nwlib, the lock is aslo freed in the error path. Also bumps the copyright years on affected files. Closes #3084 Reviewed-by: Jay Satiro <raysatiro@yahoo.com> Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* ftp: don't access pointer before NULL checkDaniel Stenberg2018-09-231-2/+1
| | | | | | Detected by Coverity. CID 1439611. Follow-up from 46e164069d1a523
* url: use the URL API internally as wellDaniel Stenberg2018-09-221-17/+18
| | | | | | ... to make it a truly unified URL parser. Closes #3017
* ftp: include command in Curl_ftpsend sendbufferDaniel Gustafsson2018-09-131-1/+5
| | | | | | | | | | Commit 8238ba9c5f10414a88f502bf3f5d5a42d632984c inadvertently removed the actual command to be sent from the send buffer in a refactoring. Add back copying the command into the buffer. Also add more guards against malformed input while at it. Closes #2985 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* Curl_debug: remove dead printhost codeDaniel Stenberg2018-06-121-2/+1
| | | | | | | | | The struct field is never set (since 5e0d9aea3) so remove the use of it and remove the connectdata pointer from the prototype. Reported-by: Tejas Bug: https://curl.haxx.se/mail/lib-2018-06/0054.html Closes #2647
* cppcheck: fix warningsMarian Klymov2018-06-111-7/+6
| | | | | | | | | | | | | - Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
* lib: Fix format specifiersRikard Falkeborn2018-05-141-2/+2
|
* ftplistparser: keep state between invokesDaniel Stenberg2018-04-241-17/+21
| | | | | | | | | | Fixes FTP wildcard parsing when done over a number of read buffers. Regression from f786d1f14 Reported-by: wncboy on github Fixes #2445 Closes #2526
* Revert "ftplistparser: keep state between invokes"Daniel Stenberg2018-04-241-21/+16
| | | | | | This reverts commit abbc8457d85aca74b7cfda1d394b0844932b2934. Caused fuzzer problems on travis not seen when this was a PR!
* ftplistparser: keep state between invokesDaniel Stenberg2018-04-231-16/+21
| | | | | | | | | | Fixes FTP wildcard parsing when doing over a number of read buffers. Regression from f786d1f14 Reported-by: wncboy on github Fixes #2445 Closes #2519