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)
// 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;
......
......@@ -35,8 +35,10 @@
#include <pwd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#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);
......
......@@ -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 */
......
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