diff options
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/CConn.cxx | 18 | ||||
-rw-r--r-- | vncviewer/vncviewer.cxx | 18 |
2 files changed, 30 insertions, 6 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 35d6e231..166597e5 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -39,6 +39,9 @@ #include <rdr/MemInStream.h> #include <rdr/MemOutStream.h> #include <network/TcpSocket.h> +#ifndef WIN32 +#include <network/UnixSocket.h> +#endif #include <FL/Fl.H> #include <FL/fl_ask.H> @@ -106,10 +109,19 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=NULL) if(sock == NULL) { try { - getHostAndPort(vncServerName, &serverHost, &serverPort); +#ifndef WIN32 + if (strchr(vncServerName, '/') != NULL) { + sock = new network::UnixSocket(vncServerName); + serverHost = sock->getPeerAddress(); + vlog.info(_("connected to socket %s"), serverHost); + } else +#endif + { + getHostAndPort(vncServerName, &serverHost, &serverPort); - sock = new network::TcpSocket(serverHost, serverPort); - vlog.info(_("connected to host %s port %d"), serverHost, serverPort); + sock = new network::TcpSocket(serverHost, serverPort); + vlog.info(_("connected to host %s port %d"), serverHost, serverPort); + } } catch (rdr::Exception& e) { vlog.error("%s", e.str()); if (alertOnFatalError) diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index e305d798..6c0c7384 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -376,6 +376,18 @@ potentiallyLoadConfigurationFile(char *vncServerName) (strchr(vncServerName, '\\')) != NULL); if (hasPathSeparator) { +#ifndef WIN32 + struct stat sb; + + // This might be a UNIX socket, we need to check + if (stat(vncServerName, &sb) == -1) { + // Some access problem; let loadViewerParameters() deal with it... + } else { + if ((sb.st_mode & S_IFMT) == S_IFSOCK) + return; + } +#endif + try { const char* newServerName; newServerName = loadViewerParameters(vncServerName); @@ -573,7 +585,7 @@ int main(int argc, char** argv) #endif if (listenMode) { - std::list<TcpListener*> listeners; + std::list<SocketListener*> listeners; try { int port = 5500; if (isdigit(vncServerName[0])) @@ -587,7 +599,7 @@ int main(int argc, char** argv) while (sock == NULL) { fd_set rfds; FD_ZERO(&rfds); - for (std::list<TcpListener*>::iterator i = listeners.begin(); + for (std::list<SocketListener*>::iterator i = listeners.begin(); i != listeners.end(); i++) FD_SET((*i)->getFd(), &rfds); @@ -602,7 +614,7 @@ int main(int argc, char** argv) } } - for (std::list<TcpListener*>::iterator i = listeners.begin (); + for (std::list<SocketListener*>::iterator i = listeners.begin (); i != listeners.end(); i++) if (FD_ISSET((*i)->getFd(), &rfds)) { |