1
0
mirror of https://github.com/KDE/krfb synced 2026-07-01 07:41:17 -07:00

Fix: password timeout was 20s, is now 120s

svn path=/trunk/kdenetwork/krfb/; revision=152981
This commit is contained in:
Tim Jansen
2002-04-30 18:25:51 +00:00
parent eb0432a3f4
commit 596a62c61c
3 changed files with 19 additions and 3 deletions

View File

@@ -30,6 +30,8 @@
#include <stdlib.h>
#include "rfb.h"
static int rfbMaxPasswordWait = 120000; /* password timeout (ms) */
/*
* rfbAuthNewClient is called when we reach the point of authenticating
* a new client. If authentication isn't being used then we simply send
@@ -77,7 +79,8 @@ rfbAuthProcessClientMessage(cl)
CARD8 response[CHALLENGESIZE];
CARD32 authResult;
if ((n = ReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
if ((n = ReadExactTimeout(cl, (char *)response, CHALLENGESIZE,
rfbMaxPasswordWait)) <= 0) {
if (n != 0)
rfbLogPerror("rfbAuthProcessClientMessage: read");
rfbCloseClient(cl);

View File

@@ -556,6 +556,7 @@ extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen);
extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen);
extern void rfbCloseClient(rfbClientPtr cl);
extern int ReadExact(rfbClientPtr cl, char *buf, int len);
extern int ReadExactTimeout(rfbClientPtr cl, char *buf, int len, int timeout);
extern int WriteExact(rfbClientPtr cl, const char *buf, int len);
extern void rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec);
extern int rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);

View File

@@ -357,6 +357,18 @@ ReadExact(cl, buf, len)
rfbClientPtr cl;
char *buf;
int len;
{
return ReadExactTimeout(cl, buf, len, rfbMaxClientWait);
}
/*
* ReadExact with customizable timeout (in ms).
*/
int
ReadExactTimeout(cl, buf, len, timeout)
rfbClientPtr cl;
char *buf;
int len;
{
int sock = cl->sock;
int n;
@@ -384,7 +396,7 @@ ReadExact(cl, buf, len)
return n;
}
/* Retry every 5 seconds until we exceed rfbMaxClientWait. We
/* Retry every 5 seconds until we exceed the timeout. We
need to do this because select doesn't necessarily return
immediately when the other end has gone away */
@@ -401,7 +413,7 @@ ReadExact(cl, buf, len)
}
if (n == 0) {
totalTimeWaited += 5000;
if (totalTimeWaited >= rfbMaxClientWait) {
if (totalTimeWaited >= timeout) {
errno = ETIMEDOUT;
return -1;
}