summaryrefslogtreecommitdiff
path: root/lib/telnet.c
Commit message (Collapse)AuthorAgeFilesLines
* telnet: make MSVC ignore warning for assignment within conditionalDaniel Stenberg2023-03-291-0/+8
| | | | | | Follow-up to d92a5007b60e0af7d Closes #10859
* telnet: simplify the implementation of str_is_nonascii()Kamil Dudka2023-03-281-5/+4
| | | | | | There is no need to traverse the string twice. Closes #10852
* telnet: only accept option arguments in asciiDaniel Stenberg2023-03-101-0/+15
| | | | | | | To avoid embedded telnet negotiation commands etc. Reported-by: Harry Sintonen Closes #10728
* telnet: error correctly for WS set to "x[num]"Daniel Stenberg2023-02-241-2/+2
| | | | | | Follow-up to e4f93be9d587 Reported-by: Harry Sintonen Closes #10606
* telnet: parse NEW_ENVIRON without sscanfDaniel Stenberg2023-02-241-12/+9
| | | | Closes #10596
* telnet: parse the WS= argument without sscanfDaniel Stenberg2023-02-241-4/+13
| | | | Closes #10596
* telnet: parse telnet options without sscanfDaniel Stenberg2023-02-241-59/+77
| | | | Closes #10596
* copyright: update all copyright lines and remove year rangesDaniel Stenberg2023-01-031-1/+1
| | | | | | | | | | | | - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
* smb/telnet: do not free the protocol struct in *_done()Daniel Stenberg2022-12-191-3/+0
| | | | | | | | It is managed by the generic layer. Reported-by: Trail of Bits Closes #10112
* lib: connection filters (cfilter) addition to curl:Stefan Eissing2022-11-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - general construct/destroy in connectdata - default implementations of callback functions - connect: cfilters for connect and accept - socks: cfilter for socks proxying - http_proxy: cfilter for http proxy tunneling - vtls: cfilters for primary and proxy ssl - change in general handling of data/conn - Curl_cfilter_setup() sets up filter chain based on data settings, if none are installed by the protocol handler setup - Curl_cfilter_connect() boot straps filters into `connected` status, used by handlers and multi to reach further stages - Curl_cfilter_is_connected() to check if a conn is connected, e.g. all filters have done their work - Curl_cfilter_get_select_socks() gets the sockets and READ/WRITE indicators for multi select to work - Curl_cfilter_data_pending() asks filters if the have incoming data pending for recv - Curl_cfilter_recv()/Curl_cfilter_send are the general callbacks installed in conn->recv/conn->send for io handling - Curl_cfilter_attach_data()/Curl_cfilter_detach_data() inform filters and addition/removal of a `data` from their connection - adding vtl functions to prevent use of Curl_ssl globals directly in other parts of the code. Reviewed-by: Daniel Stenberg Closes #9855
* lib: fix some type mismatches and remove unneeded typecastsRose2022-11-081-1/+1
| | | | | | | | | Many of these castings are unneeded if we change the variables to work better with each other. Ref: https://github.com/curl/curl/pull/9823 Closes https://github.com/curl/curl/pull/9835
* style: use space after comment start and before comment endDaniel Stenberg2022-10-301-1/+1
| | | | | | | | | | /* like this */ /*not this*/ checksrc is updated accordingly Closes #9828
* copyright: make repository REUSE compliantmax.mehl2022-06-131-0/+2
| | | | | | | | | | | Add licensing and copyright information for all files in this repository. This either happens in the file itself as a comment header or in the file `.reuse/dep5`. This commit also adds a Github workflow to check pull requests and adapts copyright.pl to the changes. Closes #8869
* lib: remove exclamation marksDaniel Stenberg2022-04-161-1/+1
| | | | | | ... from infof() and failf() calls. Make them less attention seeking. Closes #8713
* urldata: remove conn->bits.user_passwdDaniel Stenberg2022-02-161-2/+2
| | | | | | | | | The authentication status should be told by the transfer and not the connection. Reported-by: John H. Ayad Fixes #8449 Closes #8451
* telnet: fix option parser to not send uninitialized contentsDaniel Stenberg2021-07-201-6/+11
| | | | | | | CVS-2021-22925 Reported-by: Red Hat Product Security Bug: https://curl.se/docs/CVE-2021-22925.html
* infof: remove newline from format strings, always append itDaniel Stenberg2021-07-071-7/+5
| | | | | | | | | | | | | | | | - 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
* CURLE_SETOPT_OPTION_SYNTAX: new error name for wrong setopt syntaxDaniel Stenberg2021-06-021-2/+2
| | | | | | | | | For options that pass in lists or strings that are subsequently parsed and must be correct. This broadens the scope for the option previously known as CURLE_TELNET_OPTION_SYNTAX but the old name is of course still provided as a #define for existing applications. Closes #7175
* telnet: check sscanf() for correct number of matchesHarry Sintonen2021-05-241-1/+1
| | | | | | CVE-2021-22898 Bug: https://curl.se/docs/CVE-2021-22898.html
* conn: add 'attach' to protocol handler, make libssh2 use itDaniel Stenberg2021-05-171-0/+1
| | | | | | | | | | | 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
* lib: save a bit of space with some structure packingErik Olsson2021-01-201-2/+1
| | | | | | | | | | | | | | | - Reorder some internal struct members so that less padding is used. This is an attempt at saving a bit of space by packing some structs (using pahole to find the holes) where it might make sense to do so without losing readability. I.e., I tried to avoid separating fields that seem grouped together (like the cwd... fields in struct ftp_conn for instance). Also abstained from touching fields behind conditional macros as that quickly can get complicated. Closes https://github.com/curl/curl/pull/6483
* lib: more conn->data cleanupsDaniel Stenberg2021-01-191-85/+82
| | | | Closes #6479
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-16/+18
| | | | | | | | | | | | | | | | | | | | | ... 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
* language: s/behaviour/behavior/gEmil Engler2021-01-021-2/+2
| | | | | | | | We currently use both spellings the british "behaviour" and the american "behavior". However "behavior" is more used in the project so I think it's worth dropping the british name. Closes #6395
* urldata: remove 'void *protop' and create the union 'p'Daniel Stenberg2020-11-231-15/+15
| | | | | | | ... 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/+1
| | | | | | | Makes get_protocol_family() faster and it moves the knowledge about the "families" to each protocol handler, where it belongs. Closes #5986
* telnet.c: depend on static requirement of WinSock version 2Marc Hoersken2020-09-021-122/+9
| | | | | | | | | | | | Drop dynamic loading of ws2_32.dll and instead rely on the imported version which is now required to be at least 2.2. Reviewed-by: Marcel Raad Reviewed-by: Jay Satiro Reviewed-by: Daniel Stenberg Reviewed-by: Viktor Szakats Closes #5854
* copyright: update mismatched copyright yearsDaniel Stenberg2020-06-221-1/+1
|
* timeouts: move ms timeouts to timediff_t from int and longMarc Hoersken2020-06-061-1/+1
| | | | | | | | | | | | | Now that all functions in select.[ch] take timediff_t instead of the limited int or long, we can remove type conversions and related preprocessor checks to silence compiler warnings. Avoiding conversions from time_t was already done in 842f73de. Based upon #5262 Supersedes #5214, #5220 and #5221 Follow up to #5343 and #5479 Closes #5490
* build: Disable Visual Studio warning "conditional expression is constant"Jay Satiro2019-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Disable warning C4127 "conditional expression is constant" globally in curl_setup.h for when building with Microsoft's compiler. This mainly affects building with the Visual Studio project files found in the projects dir. Prior to this change the cmake and winbuild build systems already disabled 4127 globally for when building with Microsoft's compiler. Also, 4127 was already disabled for all build systems in the limited circumstance of the WHILE_FALSE macro which disabled the warning specifically for while(0). This commit removes the WHILE_FALSE macro and all other cruft in favor of disabling globally in curl_setup. Background: We have various macros that cause 0 or 1 to be evaluated, which would cause warning C4127 in Visual Studio. For example this causes it: #define Curl_resolver_asynch() 1 Full behavior is not clearly defined and inconsistent across versions. However it is documented that since VS 2015 Update 3 Microsoft has addressed this somewhat but not entirely, not warning on while(true) for example. Prior to this change some C4127 warnings occurred when I built with Visual Studio using the generated projects in the projects dir. Closes https://github.com/curl/curl/pull/4658
* urldata: simplify bytecountersDaniel Stenberg2019-03-011-2/+2
| | | | | | | | | | | | | - 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
* 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
* curl-compilers: enable -Wimplicit-fallthrough=4 for GCCMarcel Raad2018-08-211-1/+1
| | | | | | | | This enables level 4 instead of the default level 3, which of the currently used comments only allows /* FALLTHROUGH */ to silence the warning. Closes https://github.com/curl/curl/pull/2747
* Silence GCC 8 cast-function-type warningsMarcel Raad2018-08-111-1/+3
| | | | | | | | | | On Windows, casting between unrelated function types is fine and sometimes even necessary, so just use an intermediate cast to (void (*) (void)) to silence the warning as described in [0]. [0] https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html Closes https://github.com/curl/curl/pull/2860
* telnet: Remove unused macros TELOPTS and TELCMDSRikard Falkeborn2018-08-091-4/+0
| | | | | | Their usage was removed in 3a145180cc754a5959ca971ef3cd243c5c83fc51. Closes #2852
* telnet: fix clang warningsGisle Vanem2018-07-011-2/+3
| | | | | | | | telnet.c(1401,28): warning: cast from function call of type 'int' to non-matching type 'HANDLE' (aka 'void *') [-Wbad-function-cast] Fixes #2696 Closes #2700
* cppcheck: fix warningsMarian Klymov2018-06-111-16/+16
| | | | | | | | | | | | | - 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
* spelling fixesViktor Szakats2018-06-031-1/+1
| | | | | | Detected using the `codespell` tool (version 1.13.0). Also secure and fix an URL.
* strictness: correct {infof, failf} format specifiersRikard Falkeborn2018-05-311-1/+1
| | | | Closes #2623
* checksrc: make sure sizeof() is used *with* parenthesesDaniel Stenberg2018-05-211-5/+5
| | | | | | ... and unify the source code to adhere. Closes #2563
* checksrc: force indentation of lines after an elseDaniel Gustafsson2018-04-271-2/+1
| | | | | | | | This extends the INDENTATION case to also handle 'else' statements and require proper indentation on the following line. Also fixes the offending cases found in the codebase. Closes #2532
* spelling fixesViktor Szakats2018-02-231-1/+2
| | | | | | | | Detected using the `codespell` tool. Also contains one URL protocol upgrade. Closes https://github.com/curl/curl/pull/2334
* time: rename Curl_tvnow to Curl_nowDaniel Stenberg2017-10-251-2/+2
| | | | | | | | | | ... since the 'tv' stood for timeval and this function does not return a timeval struct anymore. Also, cleaned up the Curl_timediff*() functions to avoid typecasts and clean up the descriptive comments. Closes #2011
* timediff: return timediff_t from the time diff functionsDaniel Stenberg2017-10-251-2/+2
| | | | | | | | | | | | | | | ... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
* code style: use space after semicolonDaniel Stenberg2017-09-121-3/+3
|
* code style: use spaces around plusesDaniel Stenberg2017-09-111-5/+5
|
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-7/+7
|
* libcurl: Stop using error codes defined under CURL_NO_OLDIESDwarakanath Yadavalli2017-07-311-1/+1
| | | | | Fixes https://github.com/curl/curl/issues/1688 Closes https://github.com/curl/curl/pull/1712
* timeval: struct curltime is a struct timeval replacementDaniel Stenberg2017-07-281-1/+1
| | | | | | | | | ... to make all libcurl internals able to use the same data types for the struct members. The timeval struct differs subtly on several platforms so it makes it cumbersome to use everywhere. Ref: #1652 Closes #1693