Commit b34beb1b authored by dscho's avatar dscho

socket via proxy gets options set, compiler warning fixes

parent 0024d747
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
...@@ -270,7 +270,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -270,7 +270,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
// proxy connection // proxy connection
rfbLog("httpd: client asked for CONNECT\n"); rfbLog("httpd: client asked for CONNECT\n");
WriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR)); 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 // don't fclose(rfbScreen->httpFP), because this would kill the connection
rfbScreen->httpFP = NULL; rfbScreen->httpFP = NULL;
rfbScreen->httpSock = -1; rfbScreen->httpSock = -1;
...@@ -280,7 +280,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -280,7 +280,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
// proxy connection // proxy connection
rfbLog("httpd: client asked for /proxied.connection\n"); rfbLog("httpd: client asked for /proxied.connection\n");
WriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR)); 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 // don't fclose(rfbScreen->httpFP), because this would kill the connection
rfbScreen->httpFP = NULL; rfbScreen->httpFP = NULL;
rfbScreen->httpSock = -1; rfbScreen->httpSock = -1;
......
...@@ -35,8 +35,10 @@ ...@@ -35,8 +35,10 @@
#include <pwd.h> #include <pwd.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef CORBA #ifdef CORBA
...@@ -213,6 +215,8 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) ...@@ -213,6 +215,8 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
if(isUDP) { if(isUDP) {
rfbLog(" accepted UDP client\n"); rfbLog(" accepted UDP client\n");
} else { } else {
int one=1;
getpeername(sock, (struct sockaddr *)&addr, &addrlen); getpeername(sock, (struct sockaddr *)&addr, &addrlen);
cl->host = strdup(inet_ntoa(addr.sin_addr)); cl->host = strdup(inet_ntoa(addr.sin_addr));
...@@ -223,6 +227,21 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) ...@@ -223,6 +227,21 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
} }
rfbReleaseClientIterator(iterator); 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)); FD_SET(sock,&(rfbScreen->allFds));
rfbScreen->maxFd = max(sock,rfbScreen->maxFd); rfbScreen->maxFd = max(sock,rfbScreen->maxFd);
......
...@@ -63,7 +63,7 @@ vncEncryptAndStorePasswd(char *passwd, char *fname) ...@@ -63,7 +63,7 @@ vncEncryptAndStorePasswd(char *passwd, char *fname)
/* windows security sux */ /* windows security sux */
#ifndef WIN32 #ifndef WIN32
fchmod(fp, S_IRUSR|S_IWUSR); fchmod(fileno(fp), S_IRUSR|S_IWUSR);
#endif #endif
/* pad password with nulls */ /* pad password with nulls */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment