aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr
Commit message (Collapse)AuthorAgeFilesLines
* 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)) ~ ^ ~
* Add missing virtual destructorsSteve Kondik2017-07-081-0/+1
| | | | | | | | | | | | | | Fix warnings emitted by Clang: /home/shade/dev/tigervnc/common/rdr/FdInStream.h:30:9: error: 'rdr::FdInStreamBlockCallback' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] class FdInStreamBlockCallback { ^ In file included from /home/shade/dev/tigervnc/common/network/TcpSocket.cxx:44: In file included from /home/shade/dev/tigervnc/common/network/TcpSocket.h:31: /home/shade/dev/tigervnc/common/network/Socket.h:82:9: error: 'network::ConnectionFilter' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] class ConnectionFilter { ^ ..etc
* Fix busy loop in FdOutStream::flush()Pierre Ossman2016-10-101-1/+6
| | | | | | | This bug was introduced in c6df31db. A non-blocking socket that did not have any more space would busy loop until the write succeeded. Instead now it returns without any action, just as it did before the bug was introduced.
* Clean up FdOutStream::flush()Pierre Ossman2016-04-291-21/+3
| | | | The logic was a bit confusing and superfluous.
* Remove Windows 98 socket workaroundPierre Ossman2016-04-291-26/+22
| | | | We haven't supported such an old version of Windows for some time.
* Clear up ZlibInStream::reset() behaviourPierre Ossman2015-11-272-15/+43
| | | | | | | | | It previously only did a reset of the ZlibInStream object, not the underlying zlib stream. It also had the side effect of flushing the underlying stream and disassociating from it. Clear things up by changing the naming, and introducing a proper reset function (which is needed by the Tight decoder).
* Add efficient method to copy data between two streamsPierre Ossman2015-11-271-0/+12
|