From e49456ae361f5fee765625e2eb3d7439a560cc84 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 24 Aug 2018 14:37:11 +0200 Subject: [PATCH] Prevent monitoring all interfaces after change of other props Commit bfa1432 prevents monitoring all interfaces if invalid interface is provided, but it works only in some cases, because the invalid interface is not remembered and for example consequent change of port will cause that all interfaces are monitored again. Remember the invalid interface to prevent monitoring all interfaces even after change of other properties... https://bugzilla.gnome.org/show_bug.cgi?id=796349 --- server/libvncserver/sockets.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/libvncserver/sockets.c b/server/libvncserver/sockets.c index 45df6d5..ee755eb 100644 --- a/server/libvncserver/sockets.c +++ b/server/libvncserver/sockets.c @@ -748,12 +748,9 @@ rfbSetNetworkInterface(rfbScreenInfoPtr rfbScreen, const char *netIface) rfbScreen->rfbListenSockTotal = 0; } - if(netIface != NULL && strlen(netIface) > 0 && if_nametoindex(netIface) > 0) { - rfbScreen->netIface = netIface; - } - else { - rfbScreen->netIface = NULL; - if(netIface != NULL && strlen(netIface) > 0) { + if(netIface != NULL && strlen(netIface) > 0) { + rfbScreen->netIface = netIface; + if (if_nametoindex(netIface) == 0) { rfbLog("(%s) is an invalid network interface\n", netIface); return FALSE; } -- 2.19.0