summaryrefslogtreecommitdiffstats
path: root/libvncserver/rfbserver.c
Commit message (Collapse)AuthorAgeFilesLines
* IPv6 support for LibVNCServer, part onepointfive: Fix compilation with IPv6 ↵Christian Beier2012-02-271-0/+4
| | | | | | missing. There was an oversight that crept in...
* IPv6 support for LibVNCServer, part one: accept IPv4 and IPv6 connections.Christian Beier2012-02-201-2/+13
| | | | | | | | | This uses a separate-socket approach since there are systems that do not support dual binding sockets under *any* circumstances, for instance OpenBSD. Using separate sockets for IPv4 and IPv6 is thus more portable than having a v6 socket handle v4 connections as well. Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Support Mac OS X vnc client with no passwordKyle J. McKay2012-02-111-7/+17
| | | | | | Support connections from the Mac OS X built-in VNC client to LibVNCServers running with no password and advertising a server version of 3.7 or greater.
* Fix deadlock in threaded mode when using nested rfbClientIteratorNext() calls.Christian Beier2011-10-261-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lengthy explanation follows... First, the scenario before this patch: We have three clients 1,2,3 connected. The main thread loops through them using rfbClientIteratorNext() (loop L1) and is currently at client 2 i.e. client 2's cl_2->refCount is 1. At this point we need to loop again through the clients, with cl_2->refCount == 1, i.e. do a loop L2 nested within loop L1. BUT: Now client 2 disconnects, it's clientInput thread terminates its clientOutput thread and calls rfbClientConnectionGone(). This LOCKs clientListMutex and WAITs for cl_2->refCount to become 0. This means this thread waits for the main thread to release cl_2. Waiting, with clientListMutex LOCKed! Meanwhile, the main thread is about to begin the inner rfbClientIteratorNext() loop L2. The first call to rfbClientIteratorNext() LOCKs clientListMutex. BAAM. This mutex is locked by cl2's clientInput thread and is only released when cl_2->refCount becomes 0. The main thread would decrement cl_2->refCount when it would continue with loop L1. But it's waiting for cl2's clientInput thread to release clientListMutex. Which never happens since this one's waiting for the main thread to decrement cl_2->refCount. DEADLOCK. Now, situation with this patch: Same as above, but when client 2 disconnects it's clientInput thread rfbClientConnectionGone(). This again LOCKs clientListMutex, removes cl_2 from the linked list and UNLOCKS clientListMutex. The WAIT for cl_2->refCount to become 0 is _after_ that. Waiting, with clientListMutex UNLOCKed! Therefore, the main thread can continue, do the inner loop L2 (now only looping through 1,3 - 2 was removed from the linked list) and continue with loop L1, finally decrementing cl_2->refCount, allowing cl2's clientInput thread to continue and terminate. The resources held by cl2 are not free()'d by rfbClientConnectionGone until cl2->refCount becomes 0, i.e. loop L1 has released cl2.
* Fix memory leakGeorge Fleury2011-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I was debbuging some code tonight and i found a pointer that is not been freed, so i think there is maybe a memory leak, so it is... there is the malloc caller reverse order: ( malloc cl->statEncList ) <- rfbStatLookupEncoding <- rfbStatRecordEncodingSent <- rfbSendCursorPos <- rfbSendFramebufferUpdate <- rfbProcessEvents I didnt look the whole libvncserver api, but i am using rfbReverseConnection with rfbProcessEvents, and then when the client connection dies, i am calling a rfbShutdownServer and rfbScreenCleanup, but the malloc at rfbStatLookupEncoding isnt been freed. So to free the stats i added a rfbResetStats(cl) after rfbPrintStats(cl) at rfbClientConnectionGone in rfbserver.c before free the cl pointer. (at rfbserver.c line 555). And this, obviously, is correcting the memory leak. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* websockets: Move Hixie disconnect hack to websockets.cGernot Tenchio2011-08-251-65/+2
| | | | | | Move the hixie disconnect hack to websockets.c. Removed the remaining websockets vars from rfbClientPtr, so all websockets stuff is hidden behind an opaque pointer.
* websockets: Initial HyBi supportGernot Tenchio2011-08-251-2/+0
|
* websockets: Add encryption supportGernot Tenchio2011-08-171-8/+47
| | | | | | | [jes: moved out GnuTLS and OpenSSL support, added a dummy support, to separate changes better, and to keep things compiling] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* websockets: Add UTF-8 encoding support.Joel Martin2011-08-171-8/+20
| | | | | | | | | | | | | | | This is not completely standard UTF-8 encoding. Only code points 0-255 are encoded and never encoded to more than two octets. Since '\x00' is a WebSockets framing character, it's easier for all parties to encode zero as '\xc4\x80', i.e. 194+128, i.e. UTF-8 256. This means that a random stream will be slightly more than 50% larger using this encoding scheme. But it's easy CPU-wise for client and server to decode/encode. This is especially important for clients written in languages that have weak bitops, like Javascript (i.e. the noVNC client). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* websockets: Better disconnect detection.Joel Martin2011-08-171-0/+5
| | | | | | | If the only thing we are waiting on is a WebSockets terminator, then remove it from the stream early on in rfbProcessClientNormalMessage. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* websockets: Initial WebSockets support.Joel Martin2011-08-171-1/+32
| | | | | | | | | | | | | | Has a bug: WebSocket client disconnects are not detected. rfbSendFramebufferUpdate is doing a MSG_PEEK recv to determine if enough data is available which prevents a disconnect from being detected. Otherwise it's working pretty well. [jes: moved added struct members to the end for binary compatibility with previous LibVNCServer versions, removed an unused variable] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* tightPng: Add initial tightPng encoding support.Joel Martin2011-07-221-4/+45
| | | | | | | http://wiki.qemu.org/VNC_Tight_PNG Signed-off-by: Joel Martin <github@martintribe.org> Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Fix compilation in c89 mode.George Kiagiadakis2011-04-281-3/+3
| | | | Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Fix (most) MinGW32 compiler warnings.Christian Beier2011-03-171-2/+2
|
* Call WSAGetLastError() everywhere errno is read after a Winsock call.Christian Beier2011-03-031-0/+6
| | | | | Winsock does NOT update errno for us, we have fetch the last error manually using WSAGetLastError().
* libvncserver: Make RRE, CoRRE and Ultra encodings thread-safe.Christian Beier2011-02-071-0/+4
| | | | | | | This adds generic before/after encoding buffers to the rfbClient struct, so there is no need for thread local storage. Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Remove never used protocol version name string.runge2011-01-011-8/+3
|
* libvncserver cleanup: remove rfbKeyFrame remnants.Christian Beier2010-11-111-2/+0
|
* libvnc[server|client]: implement xvp VNC extension.Christian Beier2010-11-021-2/+61
| | | | | | | This implements the xvp VNC extension, which is described in the community version of the RFB protocol: http://tigervnc.sourceforge.net/cgi-bin/rfbproto It is also mentioned in the official RFB protocol.
* In rfbSendDirContent() we have to make sure to call closedir() beforeTobias Doerffel2010-10-201-1/+5
| | | | | | returning. This did not happen if rfbSendFileTransferMessage() failed. Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Non-blocking sockets for Windows.Christian Beier2010-09-131-4/+1
| | | | | | | | | | | Expands the SetNonBlocking() function in libvncclient/sockets.c to also work under Windows and also changes it to honour maybe already present socket flags. A similar function was introduced for libvncserver as well and all the #ifdef'ed fnctl calls replaced with calls to that one. Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Cleanup: remove CORBA stuff.Christian Beier2010-09-131-13/+1
| | | | | | | The header file and most of the functions referred to do not exist in libvncserver. Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Implement a DisplayFinishedHook for libvncserver.Christian Beier2010-05-191-1/+11
| | | | | | | If set, this hook gets called just before rfbSendFrameBufferUpdate() returns. Signed-off-by: Christian Beier <dontmind@freeshell.org>
* Fix checks for socket values, 0 is a legal value.Christian Beier2009-11-111-1/+1
| | | | | | | | | | To make this work, we also have to initialize sockets to a default value of -1. Also close a client listen socket if it's open. Signed-off-by: Christian Beier <dontmind@freeshell.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Thread safety for zrle, zlib, tight.runge2009-05-211-0/+21
| | | | Proposed tight security type fix for debian bug 517422.
* We seem to need to guard against freeing iterator 'i' twice in ↵runge2008-06-241-4/+8
| | | | rfbSendFramebufferUpdate() (italc reported bug)
* Handle colormaps with more than 256 colors.runge2008-05-231-4/+14
|
* Fix rfbSendSupportedEncodingsdscho2008-01-311-43/+32
| | | | | | | | | There was a long standing TODO to make the counting of the supported encodings dynamic. It never triggered, until ZYWRLE was added. Noticed by Christian Ehrlicher. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Fix Swap16IfLE() on bytesdscho2008-01-311-3/+3
| | | | | | | | | | When swapping the values for the colour table to little-endian (because they are 16-bit values), we need to cast "unsigned char" to "unsigned short"; otherwise, Microsoft's compiler would keep complaining. Noticed by Christian Ehrlicher. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Move tightQualityLevel out of the JPEG specific partdscho2008-01-311-2/+2
| | | | | | | | The variable tightQualityLevel is used for ZYWRLE compression, too, so if libjpeg is not present, but libz is, we still need to have that struct member. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Add missing #include <time.h> (thanks Christian Ehrlicher)dscho2008-01-291-0/+2
| | | | Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Add ZYWRLE server-side support (thanks Noriaki Yamazaki, Hitachi)dscho2008-01-291-0/+3
| | | | Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Avoid misaligned access on 64-bit machinesdscho2007-09-171-13/+15
| | | | | | | | | We used to assume that a char[256] is properly aligned to be cast to an rfbServerInitMsg, but that was not the case. So use a union instead. Noticed by Flavio Leitner. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* More fixes to ultra java viewer, ultrafilexfer debugging output, fix -loop ↵runge2007-05-191-7/+10
| | | | in .x11vncrc case.
* In rfbSendFileTransferChunk() check permitFileTransfer 1st to avoid false ↵runge2007-05-171-3/+4
| | | | alarms.
* Drop client if UltraVNC filetransfer is not enabled.runge2007-05-161-3/+33
|
* Fix a locking problem in libvncserverdscho2007-03-171-1/+1
| | | | | | | | | | | | | | | | | | | There seems to be a locking problem in libvncserver, with respect to how condition variables are used. On certain machines in our lab, when using a vncviewer to view a display that has a very high rate of updates, we will occasionally see the VNC server process crash. In one stack trace that was obtained, an assertion had tripped in glibc's pthread_cond_wait, which was called from clientOutput. Inspection of clientOutput suggests that WAIT is being called incorrectly. The mutex that protects a condition variable should always be locked when calling wait, and on return from the wait will still be locked. The attached patch fixes the locking around this condition variable, and one other that I found by grepping the source for similar occurrences. Signed-off-by: Charles Coffing <ccoffing@novell.com>
* compile fix for MinGWdscho2007-01-251-19/+27
|
* x11vnc: improve ultravnc filexfer rate by calling rfbCheckFD more oftenrunge2006-09-181-1/+2
|
* x11vnc: clear DISPLAY for -unixpw su_verify, user supplied sig ignore.runge2006-09-151-2/+2
|
* RFB 3.8 clients are well informedsteven_carr2006-06-051-7/+24
|
* Plugged some memory leakagesteven_carr2006-05-281-0/+2
|
* Permit auth.c to test major versionsteven_carr2006-05-161-0/+1
|
* Support sending TextChat messages back to the clientsteven_carr2006-05-151-0/+41
|
* Default to RFB 3.8, add command line option to specify the RFB version.steven_carr2006-05-151-2/+14
|
* The great UltraVNC Compatibility Commitsteven_carr2006-05-151-103/+910
|
* fix some build issues WRT ultravnc code.runge2006-05-131-3/+5
|
* Server Capability Encodingssteven_carr2006-05-041-3/+277
| | | | | | | rfbEncodingSupportedEncodings - What encodings are supported? rfbEncodingSupportedMessages - What message types are supported? rfbEncodingServerIdentity - What is the servers version string? ie: "x11vnc: 0.8.1 lastmod: 2006-04-25 (LibVNCServer 0.9pre)"
* Client Independent Server Side Scaling is now supportedsteven_carr2006-05-031-23/+93
| | | | Both PalmVNC and UltraVNC SetScale messages are supported
* Ultra Encoding added. Tested against UltraVNC V1.01steven_carr2006-05-021-4/+28
|