summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authordscho <dscho>2002-05-02 12:53:29 +0000
committerdscho <dscho>2002-05-02 12:53:29 +0000
commitff9fbd971bdebf8eca22446139803a2647dbcf5a (patch)
tree72e85c15b93a562d22cf2e923a70d186f1d6ecb6 /main.c
parent22405c3dddfe5cb78b792f3d6b20ba1e5bd427a9 (diff)
downloadlibtdevnc-ff9fbd971bdebf8eca22446139803a2647dbcf5a.tar.gz
libtdevnc-ff9fbd971bdebf8eca22446139803a2647dbcf5a.zip
Tim's Changes
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/main.c b/main.c
index b534ea3..13ad416 100644
--- a/main.c
+++ b/main.c
@@ -34,11 +34,21 @@
MUTEX(logMutex);
+int rfbEnableLogging=1;
+
/* we cannot compare to _LITTLE_ENDIAN, because some systems
(as Solaris) assume little endian if _LITTLE_ENDIAN is
defined, even if _BYTE_ORDER is not _LITTLE_ENDIAN */
char rfbEndianTest = (_BYTE_ORDER == 1234);
+/* from rfbserver.c */
+void rfbIncrClientRef(rfbClientPtr cl);
+void rfbDecrClientRef(rfbClientPtr cl);
+
+void rfbLogEnable(int enabled) {
+ rfbEnableLogging=enabled;
+}
+
/*
* rfbLog prints a time-stamped message to the log file (stderr).
*/
@@ -50,6 +60,9 @@ rfbLog(const char *format, ...)
char buf[256];
time_t log_clock;
+ if(!rfbEnableLogging)
+ return;
+
LOCK(logMutex);
va_start(args, format);
@@ -259,7 +272,9 @@ clientOutput(void *data)
UNLOCK(cl->updateMutex);
/* Now actually send the update. */
+ rfbIncrClientRef(cl);
rfbSendFramebufferUpdate(cl, updateRegion);
+ rfbDecrClientRef(cl);
sraRgnDestroy(updateRegion);
}
@@ -300,7 +315,7 @@ listenerRun(void *data)
int client_fd;
struct sockaddr_in peer;
rfbClientPtr cl;
- int len;
+ socklen_t len;
len = sizeof(peer);
@@ -397,7 +412,7 @@ rfbCursorPtr defaultGetCursorPtr(rfbClientPtr cl)
}
/* response is cl->authChallenge vncEncrypted with passwd */
-Bool defaultPasswordCheck(rfbClientPtr cl,char* response,int len)
+Bool defaultPasswordCheck(rfbClientPtr cl,const char* response,int len)
{
int i;
char *passwd=vncDecryptPasswdFromFile(cl->screen->rfbAuthPasswdData);
@@ -427,7 +442,7 @@ Bool defaultPasswordCheck(rfbClientPtr cl,char* response,int len)
/* for this method, rfbAuthPasswdData is really a pointer to an array
of char*'s, where the last pointer is 0. */
-Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len)
+Bool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len)
{
char **passwds;