summaryrefslogtreecommitdiff
path: root/lib/smb.c
Commit message (Collapse)AuthorAgeFilesLines
* infof: remove newline from format strings, always append itDaniel Stenberg2021-07-071-2/+2
| | | | | | | | | | | | | | | | - the data needs to be "line-based" anyway since it's also passed to the debug callback/application - it makes infof() work like failf() and consistency is good - there's an assert that triggers on newlines in the format string - Also removes a few instances of "..." - Removes the code that would append "..." to the end of the data *iff* it was truncated in infof() Closes #7357
* vtls: only store TIMER_APPCONNECT for non-proxy connectDaniel Stenberg2021-06-191-1/+1
| | | | | | | | | Introducing a 'isproxy' argument to the connect function so that it knows wether to store the time stamp or not. Reported-by: Yongkang Huang Fixes #7274 Closes #7274
* conn: add 'attach' to protocol handler, make libssh2 use itDaniel Stenberg2021-05-171-0/+2
| | | | | | | | | | | The libssh2 backend has SSH session associated with the connection but the callback context is the easy handle, so when a connection gets attached to a transfer, the protocol handler now allows for a custom function to get used to set things up correctly. Reported-by: Michael O'Farrell Fixes #6898 Closes #7078
* http: limit the initial send amount to used upload buffer sizeDaniel Stenberg2021-05-071-3/+2
| | | | | | | | | | | | | | | Previously this logic would cap the send to CURL_MAX_WRITE_SIZE bytes, but for the situations where a larger upload buffer has been set, this function can benefit from sending more bytes. With default size used, this does the same as before. Also changed the storage of the size to an 'unsigned int' as it is not allowed to be set larger than 2M. Also added cautions to the man pages about changing buffer sizes in run-time. Closes #7022
* config: remove CURL_SIZEOF_CURL_OFF_T use only SIZEOF_CURL_OFF_TDaniel Stenberg2021-03-111-2/+2
| | | | | | | Make the code consistently use a single name for the size of the "curl_off_t" type. Closes #6702
* transfer: remove conn->data useDaniel Stenberg2021-01-191-1/+1
| | | | Closes #6486
* vtls: reduce conn->data usePatrick Monnerat2021-01-191-1/+2
| | | | Closes #6474
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-112/+132
| | | | | | | | | | | | | | | | | | | | | ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425
* misc: fix "warning: empty expression statement has no effect"Daniel Stenberg2020-12-261-4/+8
| | | | | | | | | | Turned several macros into do-while(0) style to allow their use to work find with semicolon. Bug: https://github.com/curl/curl/commit/08e8455dddc5e48e58a12ade3815c01ae3da3b64#commitcomment-45433279 Follow-up to 08e8455dddc5e4 Reported-by: Gisle Vanem Closes #6376
* urldata: remove 'void *protop' and create the union 'p'Daniel Stenberg2020-11-231-10/+10
| | | | | | | ... to avoid the use of 'void *' for the protocol specific structs done per transfer. Closes #6238
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* Curl_handler: add 'family' to each protocolDaniel Stenberg2020-09-211-0/+2
| | | | | | | Makes get_protocol_family() faster and it moves the knowledge about the "families" to each protocol handler, where it belongs. Closes #5986
* ntlm: fix condition for curl_ntlm_core usageMarcel Raad2020-08-291-6/+3
| | | | | | | | | | | | `USE_WINDOWS_SSPI` without `USE_WIN32_CRYPTO` but with any other DES backend is fine, but was excluded before. This also fixes test 1013 as the condition for SMB support in configure.ac didn't match the condition in the source code. Now it does. Fixes https://github.com/curl/curl/issues/1262 Closes https://github.com/curl/curl/pull/5771
* escape: make the URL decode able to reject only %00 bytesDaniel Stenberg2020-06-251-2/+2
| | | | | | ... or all "control codes" or nothing. Assisted-by: Nicolas Sterchele
* smb: check for full size message before reading message detailsDaniel Stenberg2019-09-161-1/+2
| | | | | | | | To avoid reading of uninitialized data. Assisted-by: Max Dymond Bug: https://crbug.com/oss-fuzz/16907 Closes #4363
* smb: init *msg to NULL in smb_send_and_recv()Daniel Stenberg2019-09-021-0/+1
| | | | | | | | | ... it might otherwise return OK from this function leaving that pointer uninitialized. Bug: https://crbug.com/oss-fuzz/16907 Closes #4286
* cleanup: remove the 'numsocks' argument used in many placesDaniel Stenberg2019-07-301-8/+3
| | | | | | | | | 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
* smb: Use the correct error code for access denied on file openJuergen Hoetzel2019-07-111-0/+2
| | | | | | | | - Return CURLE_REMOTE_ACCESS_DENIED for SMB access denied on file open. Prior to this change CURLE_REMOTE_FILE_NOT_FOUND was returned instead. Closes https://github.com/curl/curl/pull/4095
* build: fix Codacy warningsMarcel Raad2019-06-051-2/+2
| | | | | | Reduce variable scopes and remove redundant variable stores. Closes https://github.com/curl/curl/pull/3975
* smb: fix incorrect path in request if connection reusedMatus Uzak2018-12-191-6/+3
| | | | | | | | Follow-up to 09e401e01bf9. If connection gets reused, then data member will be copied, but not the proto member. As a result, in smb_do(), path has been set from the original proto.share data. Closes #3388
* url: use the URL API internally as wellDaniel Stenberg2018-09-221-1/+1
| | | | | | ... to make it a truly unified URL parser. Closes #3017
* CURLOPT_UPLOAD_BUFFERSIZE: set upload buffer sizeDaniel Stenberg2018-09-061-1/+2
| | | | | | | This is step 3 of #2888. Fixes #2888 Closes #2896
* all: s/int/size_t cleanupDaniel Stenberg2018-09-011-2/+2
| | | | | | Assisted-by: Rikard Falkeborn Closes #2922
* upload: allocate upload buffer on-demandDaniel Stenberg2018-08-181-7/+14
| | | | | | | Saves 16KB on the easy handle for operations that don't need that buffer. Part 1 of #2888
* smb: don't mark it done in smb_doDaniel Stenberg2018-08-011-1/+1
| | | | | | | | Follow-up to 09e401e01bf9. The SMB protocol handler needs to use its doing function too, which requires smb_do() to not mark itself as done... Closes #2822
* smb: fix memory leak on early failureDaniel Stenberg2018-07-301-33/+36
| | | | | | | | | | ... by making sure connection related data (->share) is stored in the connection and not in the easy handle. Detected by OSS-fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9369 Fixes #2769 Closes #2810
* smb_getsock: always wait for write socket tooDaniel Stenberg2018-07-201-7/+1
| | | | | | | | | | | ... the protocol is doing read/write a lot, so it needs to write often even when downloading. A more proper fix could check for eactly when it wants to write and only ask for it then. Without this fix, an SMB download could easily get stuck when the event-driven API was used. Closes #2768
* smb: fix memory-leak in URL parse error pathDaniel Stenberg2018-07-121-8/+3
| | | | | | Detected by OSS-Fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9369 Closes #2740
* smb: reject negative file sizesDaniel Stenberg2018-05-121-4/+10
| | | | | | | Assisted-by: Max Dymond Detected by OSS-Fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8245
* get_posix_time: only check for overflows if they can happen!Daniel Stenberg2018-02-091-0/+2
|
* time: support > year 2038 time stamps for system with 32bit longDaniel Stenberg2018-01-301-4/+9
| | | | | | | | ... with the introduction of CURLOPT_TIMEVALUE_LARGE and CURLINFO_FILETIME_T. Fixes #2238 Closes #2264
* SMB: fix numeric constant suffix and variable typesDaniel Stenberg2018-01-161-21/+8
| | | | | | | | | | 1. don't use "ULL" suffix since unsupported in older MSVC 2. use curl_off_t instead of custom long long ifdefs 3. make get_posix_time() not do unaligned data access Fixes #2211 Closes #2240 Reported-by: Chester Liu
* SMB: fix uninitialized local variableDaniel Stenberg2017-11-131-1/+1
| | | | Reported-by: Brian Carpenter
* smb: rename variable to fix shadowing warningMarcel Raad2017-07-091-5/+5
| | | | | | | | | GCC 4.6.3 on travis complains: smb.c: In function ‘get_posix_time’: smb.c:725:13: error: declaration of ‘time’ shadows a global declaration [-Werror=shadow] Fix this by renaming the variable.
* smb: add support for CURLOPT_FILETIMEGisle Vanem2017-07-041-3/+24
| | | | | | Bug: https://curl.haxx.se/mail/lib-2017-07/0005.html Closes #1643
* smb: fix build for djgpp/MSDOSGisle Vanem2017-07-041-1/+1
| | | | bug: https://curl.haxx.se/mail/lib-2017-07/0005.html
* handler: refactor connection checkingMax Dymond2017-06-301-0/+2
| | | | | | Add a new type of callback to Curl_handler which performs checks on the connection. Alter RTSP so that it uses this callback to do its own check on connection health.
* upload: UPLOAD_BUFSIZE is now for the upload bufferDaniel Stenberg2017-05-011-1/+1
|
* NTLM: check for features with #ifdef instead of #ifMarcel Raad2017-03-291-1/+1
| | | | | | | | | Feature defines are normally checked with #ifdef instead of #if in the rest of the codebase. Additionally, some compilers warn when a macro is implicitly evaluated to 0 because it is not defined, which was the case here. Ref: https://github.com/curl/curl/pull/1362#discussion_r108605101 Closes https://github.com/curl/curl/pull/1367
* smb: use getpid replacement for windows UWP buildsDaniel Stenberg2017-02-201-1/+5
| | | | Source: https://github.com/Microsoft/vcpkg/blob/7676b8780db1e1e591c4fc7eba4f96f73c428cb4/ports/curl/0002_fix_uwp.patch
* smb: code indentDaniel Stenberg2017-02-141-16/+17
|
* Declare endian read functions argument as a const pointer.Patrick Monnerat2016-11-241-7/+7
| | | | This is done for all functions of the form Curl_read[136][624]_[lb]e.
* smb: properly check incoming packet boundariesTobias Stoeckmann2016-10-091-5/+5
| | | | | | | | Not all reply messages were properly checked for their lengths, which made it possible to access uninitialized memory (but this does not lead to out of boundary accesses). Closes #1052
* conn: don't free easy handle data in handler->disconnectDaniel Stenberg2016-06-291-1/+0
| | | | | Reported-by: Gou Lingfeng Bug: https://curl.haxx.se/mail/lib-2016-06/0139.html
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-1/+1
|
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* smb.c: Fixed compilation warningsSteve Holme2015-11-211-3/+5
| | | | | | | | | smb.c:134:3: warning: conversion to 'short unsigned int' from 'int' may alter its value smb.c:146:42: warning: conversion to 'unsigned int' from 'long long unsigned int' may alter its value smb.c:146:65: warning: conversion to 'unsigned int' from 'long long unsigned int' may alter its value
* SMB: rangecheck values read off incoming packetDaniel Stenberg2015-06-171-3/+9
| | | | | | | | CVE-2015-3237 Detected by Coverity. CID 1299430. Bug: http://curl.haxx.se/docs/adv_20150617B.html
* curl_memory: make curl_memory.h the second-last header file loadedDan Fandrich2015-03-241-2/+2
| | | | | | | This header file must be included after all header files except memdebug.h, as it does similar memory function redefinitions and can be similarly affected by conflicting definitions in system or dependent library headers.
* free: instead of Curl_safefree()Daniel Stenberg2015-03-161-3/+3
| | | | | | | | | | | | Since we just started make use of free(NULL) in order to simplify code, this change takes it a step further and: - converts lots of Curl_safefree() calls to good old free() - makes Curl_safefree() not check the pointer before free() The (new) rule of thumb is: if you really want a function call that frees a pointer and then assigns it to NULL, then use Curl_safefree(). But we will prefer just using free() from now on.