summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authordscho <dscho>2005-10-07 09:58:45 +0000
committerdscho <dscho>2005-10-07 09:58:45 +0000
commit951ec26b7cad541c030b7aebf289a21f631fc736 (patch)
tree87532ba5a1597a72d9e397b0d0ad4b81f867c0b7 /libvncserver
parent2c177c866be95e9a2ea84021e8274cd2f60efdad (diff)
downloadlibtdevnc-951ec26b7cad541c030b7aebf289a21f631fc736.tar.gz
libtdevnc-951ec26b7cad541c030b7aebf289a21f631fc736.zip
The PseudoEncoding extension code was getting silly:
If the client asked for an encoding, and no enabled extension handled it, LibVNCServer would walk through all extensions, and if they promised to handle the encoding, execute the extension's newClient() if it was not NULL. However, if newClient is not NULL, it will be called when a client connects, and if it returns TRUE, the extension will be enabled. Since all the state of the extension should be in the client data, there is no good reason why newClient should return FALSE the first time (thus not enabling the extension), but TRUE when called just before calling enablePseudoEncoding(). So in effect, the extension got enabled all the time, even if that was not necessary. The resolution is to pass a void** to enablePseudoEncoding. This has the further advantage that enablePseudoEncoding can remalloc() or free() the data without problems. Though keep in mind that if enablePseudoEncoding() is called on a not-yet-enabled extension, the passed data points to NULL.
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/rfbserver.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index 652b1b7..474351c 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -921,7 +921,7 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
rfbExtensionData* next = e->next;
if(e->extension->enablePseudoEncoding &&
e->extension->enablePseudoEncoding(cl,
- e->data, (int)enc))
+ &e->data, (int)enc))
/* ext handles this encoding */
break;
e = next;
@@ -938,9 +938,7 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
while(encs && *encs!=0) {
if(*encs==(int)enc) {
void* data = NULL;
- if(e->newClient)
- e->newClient(cl, &data);
- if(!e->enablePseudoEncoding(cl, data, (int)enc)) {
+ if(!e->enablePseudoEncoding(cl, &data, (int)enc)) {
rfbLog("Installed extension pretends to handle pseudo encoding 0x%x, but does not!\n",(int)enc);
} else {
rfbEnableExtension(cl, e, data);