summaryrefslogtreecommitdiff
path: root/lib/telnet.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* curl_setup_once: Remove ERRNO/SET_ERRNO macrosJay Satiro2017-07-101-6/+7
| | | | | | | | | | | | Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError for Win32 and regular errno otherwise. I reviewed the code and found no justifiable reason for conflating errno on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno, and any Win32 multithreaded CRT supports thread-local errno. Fixes https://github.com/curl/curl/issues/895 Closes https://github.com/curl/curl/pull/1589
* handler: refactor connection checkingMax Dymond2017-06-301-0/+1
| | | | | | 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.
* Telnet: Write full buffer instead of byte-by-byteRichard Hsu2017-05-021-31/+51
| | | | | | | | Previous TODO wanting to write in chunks. We should support writing more at once since some TELNET servers may respond immediately upon first byte written such as WHOIS servers. Closes #1389
* buffer: use data->set.buffer_size instead of BUFSIZEDaniel Stenberg2017-05-011-5/+5
| | | | ... to properly use the dynamically set buffer size!
* buffer_size: make sure it always has the correct sizeDaniel Stenberg2017-05-011-1/+1
| | | | Removes the need for CURL_BUFSIZE
* lib: remove unused codeMarcel Raad2017-04-261-2/+4
| | | | | | | | This fixes the following clang warnings: macro is not used [-Wunused-macros] will never be executed [-Wunreachable-code] Closes https://github.com/curl/curl/pull/1448
* code: fix typos and style in commentsDaniel Gustafsson2017-04-171-2/+2
| | | | | | | A few random typos, and minor whitespace cleanups, found in comments while reading code. Closes #1423
* telnet: (win32) fix read callback return variableDaniel Stenberg2017-04-011-6/+6
| | | | | | | | | | | | | | telnet.c(1427,21): warning: comparison of constant 268435456 with expression of type 'CURLcode' is always false telnet.c(1433,21): warning: comparison of constant 268435457 with expression of type 'CURLcode' is always false Reviewed-by: Jay Satiro Reported-by: Gisle Vanem Bug: https://github.com/curl/curl/issues/1225#issuecomment-290340890 Closes #1374
* Improve code readbilitySylvestre Ledru2017-03-131-6/+4
| | | | | | ... by removing the else branch after a return, break or continue. Closes #1310
* telnet: Fix typosDaniel Gustafsson2017-02-071-2/+2
| | | | Ref: https://github.com/curl/curl/pull/1245
* telnet: fix windows compiler warningsDaniel Stenberg2017-01-241-2/+2
| | | | | | Thumbs-up-by: Jay Satiro Closes #1225
* CURLOPT_BUFFERSIZE: support enlarging receive bufferRichy Kim2017-01-191-2/+3
| | | | | | | | | | Replace use of fixed macro BUFSIZE to define the size of the receive buffer. Reappropriate CURLOPT_BUFFERSIZE to include enlarging receive buffer size. Upon setting, resize buffer if larger than the current default size up to a MAX_BUFSIZE (512KB). This can benefit protocols like SFTP. Closes #1222
* checksrc: warn for assignments within if() expressionsDaniel Stenberg2016-12-141-1/+2
| | | | | ... they're already frowned upon in our source code style guide, this now enforces the rule harder.
* checksrc: stricter no-space-before-paren enforcementDaniel Stenberg2016-12-131-7/+7
| | | | In order to make the code style more uniform everywhere
* checksrc: white space edits to comply to stricter checksrcDaniel Stenberg2016-11-241-3/+3
|
* strcasecompare: all case insensitive string compares ignore locale nowDaniel Stenberg2016-10-311-6/+6
| | | | | We had some confusions on when each function was used. We should not act differently on different locales anyway.
* strcasecompare: is the new name for strequal()Daniel Stenberg2016-10-311-1/+0
| | | | | | | ... to make it less likely that we forget that the function actually does case insentive compares. Also replaced several invokes of the function with a plain strcmp when case sensitivity is not an issue (like comparing with "-").
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-12/+12
|
* loadlibrary: Only load system DLLs from the system directorySteve Holme2016-05-301-1/+2
| | | | | | | | Inspiration provided by: Daniel Stenberg and Ray Satiro Bug: https://curl.haxx.se/docs/adv_20160530.html Ref: Windows DLL hijacking with curl, CVE-2016-4802
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-2/+2
| | | | | | | | | | | | | | | | | | | | curl_printf.h defines printf to curl_mprintf, etc. This can cause problems with external headers which may use __attribute__((format(printf, ...))) markers etc. To avoid that they cause problems with system includes, we include curl_printf.h after any system headers. That makes the three last headers to always be, and we keep them in this order: curl_printf.h curl_memory.h memdebug.h None of them include system headers, they all do funny #defines. Reported-by: David Benjamin Fixes #743
* code: style updatesDaniel Stenberg2016-04-031-3/+3
|
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* Revert "cleanup: general removal of TODO (and similar) comments"Daniel Stenberg2015-11-241-0/+1
| | | | | | | This reverts commit 64e959ffe37c436503f9fed1ce2d6ee6ae50bd9a. Feedback-by: Dan Fandrich URL: http://curl.haxx.se/mail/lib-2015-11/0062.html
* cleanup: general removal of TODO (and similar) commentsDaniel Stenberg2015-11-131-1/+0
| | | | | | They tend to never get updated anyway so they're frequently inaccurate and we never go back to revisit them anyway. We document issues to work on properly in KNOWN_BUGS and TODO instead.
* fread_func: move callback pointer from set to state structDaniel Stenberg2015-10-151-5/+6
| | | | | | | | | | | | | | | | ... and assign it from the set.fread_func_set pointer in the Curl_init_CONNECT function. This A) avoids that we have code that assigns fields in the 'set' struct (which we always knew was bad) and more importantly B) it makes it impossibly to accidentally leave the wrong value for when the handle is re-used etc. Introducing a state-init functionality in multi.c, so that we can set a specific function to get called when we enter a state. The Curl_init_CONNECT is thus called when switching to the CONNECT state. Bug: https://github.com/bagder/curl/issues/346 Closes #346
* telnet: Fix read-callback change for Windows buildsJay Satiro2015-05-211-1/+2
| | | | Refer to b0143a2 for more information on the read-callback change.
* read_callback: move to SessionHandle from connectdataDaniel Stenberg2015-05-201-4/+4
| | | | | | | With many easy handles using the same connection for multiplexing, it is important we store and keep the transfer-oriented stuff in the SessionHandle so that callbacks and callback data work fine even when many easy handles share the same physical connection.
* 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.
* checksrc: use space after commaDaniel Stenberg2015-03-171-22/+18
|
* mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg2015-03-031-3/+1
| | | | | ... and as a consequence, introduce curl_printf.h with that re-define magic instead and make all libcurl code use that instead.
* Revert "telnet.c: fix handling of 0 being returned from custom read function"Marc Hoersken2015-02-251-3/+1
| | | | This reverts commit 03fa576833643c67579ae216c4e7350fa9b5f2fe.
* telnet.c: fix invalid use of custom read function if not being setMarc Hoersken2015-02-251-1/+1
| | | | | | | obj_count can be 1 if the custom read function is set or the stdin handle is a reference to a pipe. Since the pipe should be handled using the PeekNamedPipe-check below, the custom read function should only be used if it is actually enabled.