aboutsummaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Use __attribute__:s directlyPierre Ossman2023-01-055-31/+17
| | | | | | These are supported by gcc and clang, and I don't think MSVC works well with our code anyway, so let's keep things simple and use these directly.
* Remove old mingw compatibility codePierre Ossman2023-01-054-223/+0
| | | | | This isn't needed with modern build environments, and can even conflict with them.
* Protect key variables from setjmp()Pierre Ossman2023-01-052-10/+13
| | | | | If we don't mark these as volatile then they might get reset on longjmp() and the code will misbehave.
* Remove useless const specifiersPierre Ossman2023-01-052-4/+4
| | | | | These are just values, so setting const on them has no effect as the caller will get a copy.
* Explicitly mark switch case fall throughPierre Ossman2023-01-053-0/+8
| | | | | This allows us to separate accidental fall through from explicit ones, which allows us to turn on such checks in the compiler.
* Fix RSA-AES state machinesPierre Ossman2023-01-052-48/+44
| | | | | | | | | | If there isn't enough data, then the client reading the hash will fall down and try to read the subtype instead, which isn't correct. Invert the logic so we get a more consistent way through where we only break out when there is insufficient data. Do the same for the server code, for consistency.
* Explicitly mark unused parametersPierre Ossman2023-01-0431-78/+95
| | | | | This allows us to separate accidentally unused, from explicitly unused parameters, which allows us to turn on such checks in the compiler.
* Don't include palette to full color methodsPierre Ossman2023-01-044-9/+7
| | | | They have no need for it, so let's simplify things.
* Remove unused flags to decoder contextsPierre Ossman2023-01-046-6/+13
| | | | Everything in flags is already handled at a higher level.
* Stop supplying flags to clipboard peek handlerPierre Ossman2023-01-0410-10/+10
| | | | The flags should always be empty anyway.
* Mark system include paths correctlyPierre Ossman2023-01-042-8/+8
| | | | | This makes sure the compiler doesn't complain about problems in those files.
* Add client-side support for the MSLogonII security type.Dinglan Peng2022-12-276-26/+232
|
* Add client-side support for the DH security type.Dinglan Peng2022-12-276-3/+210
|
* Flush decoder errors on close()Pierre Ossman2022-11-071-0/+10
| | | | | | We don't want any stray exceptions as we are cleaning up, so handle any still pending decoder errors by just logging them. We are already shutting down so there is no need to abort the connection here.
* Don't enable RSA-AES by default in serversPierre Ossman2022-10-141-3/+0
| | | | | | These require a key to have been set up on the server beforehand, so they do not give a good default experience as clients will be unable to connect.
* Ignore whitespace around components of host-and-port specificationCatherine Tower2022-09-011-2/+22
| | | | This is to make the code more tolerant of typos when entering a hostname
* Fix incorrect nettle library referencesPierre Ossman2022-09-012-2/+6
|
* Add support for RSA-AES security typespdlan2022-09-0117-13/+1612
|
* Fix stream check for InStream::getptr()Pierre Ossman2022-08-251-3/+0
| | | | | This call should have been preceeded by hasData() or avail(), just like all other accessor functions.
* Move include_directories() to proper placesPierre Ossman2022-08-252-2/+8
| | | | We should scope these as narrowely as possible to avoid side effects.
* Use BufferedOutStream in more streamsPierre Ossman2022-08-259-161/+69
| | | | | | Avoid duplicating all the memory mangement, and instead use the BufferedOutStream as a base clase for all out streams that need an intermediate buffer.
* Remove unused CSecurity::description()Pierre Ossman2022-08-2510-25/+3
|
* Make BufferedInStream allocation more availablePierre Ossman2022-08-2514-24/+43
| | | | | Allow subclasses to call it, instead of it being strictly internal. This is useful when a subclass can only provide data in minimum sized chunks.
* Safely discard large (extended) clipboard contentsPierre Ossman2022-06-282-8/+40
| | | | | | | | | Avoid having to buffer everything we want to discard, and instead do it piece by piece. This is more efficient, and avoids hitting any limits on the buffering. Note that this is safe here because we already know we have all the compressed data. It would not be safe for a general input stream.
* Properly restore cork state when changedPierre Ossman2022-06-282-2/+13
| | | | | | | | | | | | These streams both need to change the corking state temporarily, but it is important it is restored to the previous state or things might get messed up. For the zlib stream it would just leave things uncorked, which still works but is less efficient. But for the TLS stream it might make things very unresponsive as the corking might be left on permanently, delaying packets indefinitely.
* 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.
* Merge branch 'mft-crop-fix' of https://github.com/mmozeiko/tigervncPierre Ossman2022-06-132-8/+220
|\
| * Workaround for MFT cropping in H264 decodingMartins Mozeiko2022-06-072-8/+220
| | | | | | | | | | | | | | | | | | It seems MFT h264 decoder does not support frame cropping. Which means that if frame width or height is not multiple of 16 then decoded output can potentially be used with wrong offset. This code adds explicit parsing of SPS to extract cropping information to use, and will apply cropping if reported size differs from expected.
* | Find FFMPEG using pkg-configPierre Ossman2022-06-071-0/+1
| | | | | | | | | | | | This is the standard method of finding it on Unix systems, so make sure we use it. Still keep a fallback, though, for other systems, e.g. Windows.
* | Fix up ffmpeg header and library handlingPierre Ossman2022-06-071-1/+2
| | | | | | | | | | FFMPEG is needed by the RFB library, so all the details about it should only be applied there and not for other components.
* | Use pkg-config for pixmanPierre Ossman2022-06-071-2/+3
| | | | | | | | | | | | This is the standard method of finding it on Unix systems, so make sure we use it. Still keep a fallback, though, for other systems, e.g. Windows.
* | Avoid temporary cmake variablesPierre Ossman2022-06-073-33/+19
|/ | | | | Modern cmake has better support for adding source files and libraries incrementally, so let's use that to clean things up.
* Assert that accessCheck isn't called too earlySamuel Mannehed2022-04-291-0/+3
| | | | | These checks depend on accessRights being set up, this has only happened if we have done the QUERYING steps.
* Initialize SConnection's accessRightsSamuel Mannehed2022-04-291-1/+1
| | | | | Properties should be initialized in order to avoid random values in case they are used earlier than expected.
* 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.
* Print GnuTLS certificate status as hexPierre Ossman2022-03-241-1/+1
| | | | It's a bit field so it's easier to decode in hex.
* Allow exceptions for expired certificatesPierre Ossman2022-03-241-20/+55
| | | | | The browsers allow users to make an exception for expired certificates, so we should probably also.
* Make sure server name is always a valid stringPierre Ossman2022-03-242-2/+9
| | | | | Otherwise we can get crashes on NULL dereference. This should only happen on reverse connections where we don't have a server address.
* Fix compilation issue.Chris2022-02-281-1/+1
| | | | | | | | | | | | | | | | | Ubuntu 20.04 gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 libx264-dev:amd64 2:0.155.2917+git0a84d98-2 [ 11%] Building CXX object common/rfb/CMakeFiles/rfb.dir/H264LibavDecoderContext.cxx.o tigervnc/common/rfb/H264LibavDecoderContext.cxx: In member function ‘virtual bool rfb::H264LibavDecoderContext::initCodec()’: tigervnc/common/rfb/H264LibavDecoderContext.cxx:50:40: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive] 50 | AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264); | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ | | | const AVCodec* make[2]: *** [common/rfb/CMakeFiles/rfb.dir/build.make:895: common/rfb/CMakeFiles/rfb.dir/H264LibavDecoderContext.cxx.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:597: common/rfb/CMakeFiles/rfb.dir/all] Error 2 make: *** [Makefile:130: all] Error 2
* get rid of c++11 stuffVladimir Sukhonosov2022-01-252-3/+3
|
* Improve logging around screen resizingPierre Ossman2022-01-252-4/+17
| | | | | | Avoid duplication, and add logging for some more error conditions so it's possible to see in the logs why a resize has failed or produced unexpected results.
* support H264 decoding with MediaFoundation on WindowsMārtiņš Možeiko2022-01-213-0/+382
|
* H264 DecoderVladimir Sukhonosov2022-01-2110-0/+617
| | | | Linux implementation using ffmpeg
* Fix handling of VMware cursorsPierre Ossman2022-01-181-2/+2
| | | | | | This is a regression from ad0f061. If a VMware cursor rect was split up over multiple read()s then the stream would become corrupted as we set the restore point at the wrong place.
* Be consistent in including config.hPierre Ossman2021-12-3073-32/+282
| | | | | | 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.
* Log decoding stats on disconnectPierre Ossman2021-11-042-0/+66
| | | | | Can be helpful to see what encodings were actually used during a connection, and how they performed.
* 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.
* Throw more descriptive error on rect read errorPierre Ossman2021-11-041-2/+6
| | | | Gives a bit more context where this error happened.
* Remove single cpu decoder shortcutPierre Ossman2021-11-041-27/+1
| | | | | Single CPU machines are extremely rare now, so let's avoid the hassle of multiple code paths.