aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr
Commit message (Collapse)AuthorAgeFilesLines
...
* Only implicitly flush on uncorkingPierre Ossman2022-06-281-1/+1
| | | | | There is no point flushing when corking was enabled, as we might then push out a small buffer that the corking otherwise would have preserved.
* Avoid temporary cmake variablesPierre Ossman2022-06-071-5/+4
| | | | | Modern cmake has better support for adding source files and libraries incrementally, so let's use that to clean things up.
* Enable stream sanity checks in debug buildsPierre Ossman2022-04-061-1/+3
| | | | | | Enable this automatically for developers so we increase the chance of these problems getting caught. There is a risk of overhead though so keep them disabled for release builds.
* Don't trust GNUTLS_E_AGAINPierre Ossman2022-04-062-3/+17
| | | | | | Unfortunately this error can be given by GnuTLS even though the underlying stream still has data available. So stop trusting this value and keep track of the underlying stream explicitly.
* Be consistent in including config.hPierre Ossman2021-12-308-8/+24
| | | | | | The generally recommended way is to include it from source files, not headers. We had a mix of both. Let's try to be consistent and follow the recommended way.
* Increase maximum input bufferPierre Ossman2021-11-041-1/+1
| | | | | | macOS' built in VNC server unfortunately sends the entire monitor in a single rect, so we need to be prepared to buffer a lot of data in case the monitor has a large resolution.
* Propagate exceptions from GnuTLS push/pull functionsPierre Ossman2021-06-114-3/+28
| | | | | Gives us a more meaningful error rather than just "Error in push/pull function".
* Remove early data check for TLSInStreamPierre Ossman2021-06-111-5/+3
| | | | | | | Having this early check means that we somewhat randomly get different exception behaviours on errors in deeper layers as some exceptions are allowed to propagate unhindered and some are not (since they are thrown in the pull function).
* Propagate errno to GnuTLSPierre Ossman2021-06-112-0/+10
| | | | | Give GnuTLS the correct errno from deeper layers, in the cases where we know it. In most cases GnuTLS doesn't care, but just in case...
* Revert "Support TCP_NOPUSH as alternative to TCP_CORK"Pierre Ossman2021-03-021-4/+0
| | | | | This reverts commit d6e39658ae105fca2cfe37ba736dbf0e8d8356af. Apparently this is broken on macOS so it's not something we can make use of.
* Support TCP_NOPUSH as alternative to TCP_CORKPierre Ossman2021-03-021-0/+4
| | | | TCP_CORK is a Linux thing and BSD has TCP_NOPUSH instead.
* Add missing headers for TCP_CORKPierre Ossman2021-03-021-0/+2
| | | | | We didn't include the proper headers to get the correct define, so corking was never enabled.
* Fix overloaded function signaturePierre Ossman2021-01-262-2/+2
|
* Remove unused attributesPierre Ossman2021-01-261-3/+0
|
* Change streams to be asynchronousPierre Ossman2020-05-2121-198/+193
| | | | | | | | | | Major restructuring of how streams work. Neither input nor output streams are now blocking. This avoids stalling the rest of the client or server when a peer is slow or unresponsive. Note that this puts an extra burden on users of streams to make sure they are allowed to do their work once the underlying transports are ready (e.g. monitoring fds).
* Remove readString()/writeString()Pierre Ossman2020-05-214-57/+0
| | | | | These are not universal in the protocol so having functions for them only obfuscates things.
* Improved bandwidth monitoringPierre Ossman2020-05-212-60/+2
| | | | | | Now measures over an entire update, which should hopefully give us more stable values. They are still small values for fast networks though so increase precision in the values we keep.
* Make direct stream API a bit saferPierre Ossman2020-05-216-31/+35
| | | | | Provide some safety checks when directly accessing the underlying pointer of streams.
* Log I/O errors from TLS streamsPierre Ossman2020-05-212-1/+10
|
* Check buffer usage with a simply booleanPierre Ossman2020-05-212-8/+10
| | | | | External callers don't need to know the exact details, only if there is data that needs to be flushed or not.
* Dynamically allocate stream buffersPierre Ossman2020-05-214-28/+132
| | | | | This allows us to handle peaks in input and output streams gracefully without having to block processing.
* Don't shuffle input buffer unless actually neededPierre Ossman2020-05-211-4/+6
|
* Generalise corking to all output streamsPierre Ossman2020-05-219-24/+69
| | | | | The principle can be used in a more general fashion than just TCP streams.
* Remove unused bufSize argument from streamsPierre Ossman2020-05-2116-34/+27
|
* Simplify stream availability handlingPierre Ossman2020-05-2117-113/+63
| | | | | Just have a simply number of bytes argument to avoid a lot of complexity.
* Create common base classes for buffered streamsPierre Ossman2020-05-2119-397/+413
| | | | | Most streams are backed by a memory buffer. Create common base classes for this functionality to avoid code duplication.
* Add stream avail() methodsPierre Ossman2020-05-2112-20/+36
| | | | | Makes it more readable to write code that needs to know how much data/space is available in a stream.
* Remove OutStream::skip()Pierre Ossman2020-05-211-8/+0
| | | | | It might leak data depending on what's in the buffer. Use pad() instead where blank space is needed.
* Remove unused stream methodsPierre Ossman2020-05-213-35/+1
| | | | | They were accidentally left unused in fbad8a9 so they haven't been used in some time.
* Include error code in getaddrinfo() exceptionsPierre Ossman2020-03-261-1/+10
|
* Avoid using insecure variable length arraysPierre Ossman2020-03-261-1/+2
|
* Merge branch 'unicode_translation' of https://github.com/CendioAlex/tigervncPierre Ossman2020-03-172-28/+34
|\
| * Throw GAIException() for getaddrinfo errorsAlex Tanskanen2020-03-172-2/+25
| | | | | | | | | | | | | | | | Created a new subclass of Exception called GAIException() that will handle error messages from getaddrinfo() instead of letting Exception() handle it. GAIException() will make use of gai_strerror() to map the error code to text. On Windows, gai_strerrorW() must be used if the text is encoded with UTF-8.
| * Make system error messeges in Windows 10 use UTF-8Alex Tanskanen2020-03-121-26/+9
| | | | | | | | | | | | The previous error messages did not support Unicode characters. This commit will use UTF-8 encoding to be able to display error messages in every language.
* | Fix error check for zlib callsPierre Ossman2020-02-272-3/+3
|/ | | | | There are multiple "okay" return values, not just Z_OK. Make sure we don't bail out needlessly.
* Merge branch 'secfix' of https://github.com/CendioOssman/tigervncPierre Ossman2019-12-2025-250/+227
|\
| * Be defensive about overflows in stream objectsPierre Ossman2019-11-1513-48/+75
| | | | | | | | | | | | | | | | | | | | | | | | We use a lot of lengths given to us over the network, so be more paranoid about them causing an overflow as otherwise an attacker might trick us in to overwriting other memory. This primarily affects the client which often gets lengths from the server, but there are also some scenarios where the server might theoretically be vulnerable. Issue found by Pavel Cheremushkin from Kaspersky Lab.
| * Use size_t for lengths in stream objectsPierre Ossman2019-11-1524-155/+156
| | | | | | | | | | | | | | | | Provides safety against them accidentally becoming negative because of bugs in the calculations. Also does the same to CharArray and friends as they were strongly connection to the stream objects.
| * Remove unused FixedMemOutStreamPierre Ossman2019-11-151-52/+0
| |
| * Make ZlibInStream more robust against failuresPierre Ossman2019-11-152-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | Move the checks around to avoid missing cases where we might access memory that is no longer valid. Also avoid touching the underlying stream implicitly (e.g. via the destructor) as it might also no longer be valid. A malicious server could theoretically use this for remote code execution in the client. Issue found by Pavel Cheremushkin from Kaspersky Lab
* | Handle pending data in TLS buffersPierre Ossman2019-12-091-3/+5
|/ | | | | | There might be more bytes left in the current TLS record, even if there is nothing on the underlying stream. Make sure we properly return this when we aren't being requested to block.
* Do proper logging rather than fprintf(stderr, ...)Pierre Ossman2019-04-292-11/+17
|
* Remove commented out loggingPierre Ossman2019-04-291-10/+0
|
* Remove Java web serverPierre Ossman2018-10-091-102/+0
| | | | | Applets don't work anymore so remove everything that has to do with serving them.
* Fix bad reference in TLSException initialiserPierre Ossman2018-05-291-1/+1
|
* Fully standardise on send()/recv()Pierre Ossman2017-11-082-7/+6
| | | | We already assume sockets here since we use select().
* Added my/Cendio copyright where relevantPeter Åstrand (astrand)2017-11-081-0/+1
|
* Use send() with MSG_DONTWAIT when possiblePeter Åstrand (astrand)2017-11-081-1/+9
|
* Make exception classes have clearer messagesPierre Ossman2017-10-121-6/+2
| | | | | Include the type of exception in the string generated by each subclass. Also simplify the constructs to what is needed.
* rdr: Fix incorrect error checking after fread()Steve Kondik2017-07-081-3/+3
| | | | | | | | | fread() returns size_t, which is unsigned. Don't check for negative values to avoid warnings from Clang. /home/shade/dev/tigervnc/common/rdr/FileInStream.cxx:74:13: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (n < 0 || ferror(file)) ~ ^ ~