From b34beb1b22a53046fd09f872e6541aea8e166f7f Mon Sep 17 00:00:00 2001 From: dscho Date: Sat, 31 Aug 2002 14:13:50 +0000 Subject: socket via proxy gets options set, compiler warning fixes --- cvs_update_anonymously | 9 ++++++++- httpd.c | 4 ++-- rfbserver.c | 19 +++++++++++++++++++ vncauth.c | 2 +- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/cvs_update_anonymously b/cvs_update_anonymously index f94b616..26f2014 100644 --- a/cvs_update_anonymously +++ b/cvs_update_anonymously @@ -1 +1,8 @@ -cvs -z3 -d :pserver:anonymous@cvs.libvncserver.sf.net:/cvsroot/libvncserver update +if [ a"$1" = adiff ]; then + cmd=diff +else + cmd=update +fi + +cvs -z3 -d :pserver:anonymous@cvs.libvncserver.sf.net:/cvsroot/libvncserver $cmd + diff --git a/httpd.c b/httpd.c index 0821c5b..3baedce 100644 --- a/httpd.c +++ b/httpd.c @@ -270,7 +270,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) // proxy connection rfbLog("httpd: client asked for CONNECT\n"); WriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR)); - rfbNewClient(rfbScreen,rfbScreen->httpSock); + rfbNewClientConnection(rfbScreen,rfbScreen->httpSock); // don't fclose(rfbScreen->httpFP), because this would kill the connection rfbScreen->httpFP = NULL; rfbScreen->httpSock = -1; @@ -280,7 +280,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) // proxy connection rfbLog("httpd: client asked for /proxied.connection\n"); WriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR)); - rfbNewClient(rfbScreen,rfbScreen->httpSock); + rfbNewClientConnection(rfbScreen,rfbScreen->httpSock); // don't fclose(rfbScreen->httpFP), because this would kill the connection rfbScreen->httpFP = NULL; rfbScreen->httpSock = -1; diff --git a/rfbserver.c b/rfbserver.c index bfc2e91..7ba360e 100644 --- a/rfbserver.c +++ b/rfbserver.c @@ -35,8 +35,10 @@ #include #include #include +#include #include #endif +#include #include #ifdef CORBA @@ -213,6 +215,8 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) if(isUDP) { rfbLog(" accepted UDP client\n"); } else { + int one=1; + getpeername(sock, (struct sockaddr *)&addr, &addrlen); cl->host = strdup(inet_ntoa(addr.sin_addr)); @@ -223,6 +227,21 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) } rfbReleaseClientIterator(iterator); +#ifndef WIN32 + if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { + rfbLogPerror("fcntl failed"); + close(sock); + return NULL; + } +#endif + + if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, + (char *)&one, sizeof(one)) < 0) { + rfbLogPerror("setsockopt failed"); + close(sock); + return NULL; + } + FD_SET(sock,&(rfbScreen->allFds)); rfbScreen->maxFd = max(sock,rfbScreen->maxFd); diff --git a/vncauth.c b/vncauth.c index 64e8cbe..fb2c98e 100644 --- a/vncauth.c +++ b/vncauth.c @@ -63,7 +63,7 @@ vncEncryptAndStorePasswd(char *passwd, char *fname) /* windows security sux */ #ifndef WIN32 - fchmod(fp, S_IRUSR|S_IWUSR); + fchmod(fileno(fp), S_IRUSR|S_IWUSR); #endif /* pad password with nulls */ -- cgit v1.2.1