From afd1d329ed117f6e4d8c46eba362b7d5c51184ac Mon Sep 17 00:00:00 2001 From: Amandeep Singh Date: Wed, 9 Oct 2013 04:12:08 +0530 Subject: Fix crash in krfb Krfb crashes on quit, if any client is connected due to a rfbClientConnectionGone call missing --- libvncserver/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libvncserver') diff --git a/libvncserver/main.c b/libvncserver/main.c index 4cb18ac..b8cdde1 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -1061,10 +1061,13 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) { if(disconnectClients) { rfbClientPtr cl; rfbClientIteratorPtr iter = rfbGetClientIterator(screen); - while( (cl = rfbClientIteratorNext(iter)) ) - if (cl->sock > -1) - /* we don't care about maxfd here, because the server goes away */ - rfbCloseClient(cl); + while( (cl = rfbClientIteratorNext(iter)) ) { + if (cl->sock > -1) { + /* we don't care about maxfd here, because the server goes away */ + rfbCloseClient(cl); + rfbClientConnectionGone(cl); + } + } rfbReleaseClientIterator(iter); } -- cgit v1.2.3 From 012594b970b07c212eaf48ed22333a9d37d017a4 Mon Sep 17 00:00:00 2001 From: Amandeep Singh Date: Sat, 28 Sep 2013 17:58:13 +0530 Subject: allow rfbInitSockets with non-ready states. This allows for reinitializations of e. g. sockets in a SHUTDOWN state. The only state that doesn't make sense to reinitialize are READY states. --- libvncserver/sockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libvncserver') diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index ddd8450..d2f814b 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -122,8 +122,9 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) { in_addr_t iface = rfbScreen->listenInterface; - if (rfbScreen->socketState!=RFB_SOCKET_INIT) - return; + if (rfbScreen->socketState == RFB_SOCKET_READY) { + return; + } rfbScreen->socketState = RFB_SOCKET_READY; -- cgit v1.2.3