Default to RFB 3.8, add command line option to specify the RFB version.

pull/1/head
steven_carr 18 years ago
parent ccdbe8f325
commit 1c3af68549

@ -1,3 +1,9 @@
2006-05-15 Steven Carr <scarr@jsa-usa.com>
* Default to RFB 3.8
* Add command line options:
-rfbversion X.Y Sets the version thatthe server reports
-permitfiletransfer Permits File Transfer (Default is Deny)
2006-05-15 Steven Carr <scarr@jsa-usa.com>
* The great UltraVNC Compatibility Commit!
libvncserver now supports the following messages:

@ -25,6 +25,8 @@ rfbUsage(void)
fprintf(stderr, "-rfbwait time max time in ms to wait for RFB client\n");
fprintf(stderr, "-rfbauth passwd-file use authentication on RFB protocol\n"
" (use 'storepasswd' to create a password file)\n");
fprintf(stderr, "-rfbversion 3.x Set the version of the RFB we choose to advertise\n");
fprintf(stderr, "-permitfiletransfer permit file transfer support\n");
fprintf(stderr, "-passwd plain-password use authentication \n"
" (use plain-password as password, USE AT YOUR RISK)\n");
fprintf(stderr, "-deferupdate time time in ms to defer updates "
@ -90,6 +92,16 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return FALSE;
}
rfbScreen->authPasswdData = argv[++i];
fprintf(stderr, "-permitfiletransfer permit file transfer support\n");
} else if (strcmp(argv[i], "-permitfiletransfer") == 0) { /* -permitfiletransfer */
rfbScreen->permitFileTransfer = TRUE;
} else if (strcmp(argv[i], "-rfbversion") == 0) { /* -rfbversion 3.6 */
if (i + 1 >= *argc) {
rfbUsage();
return FALSE;
}
sscanf(argv[++i],"%d.%d", &rfbScreen->protocolMajorVersion, &rfbScreen->protocolMinorVersion);
} else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */
char **passwds = malloc(sizeof(char**)*2);
if (i + 1 >= *argc) {

@ -836,9 +836,10 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->handleEventsEagerly = FALSE;
/* Emulate UltraVNC Server by default */
screen->protocolMajorVersion = 3;
screen->protocolMinorVersion = 6;
screen->protocolMajorVersion = rfbProtocolMajorVersion;
screen->protocolMinorVersion = rfbProtocolMinorVersion;
screen->permitFileTransfer = FALSE;
if(!rfbProcessArguments(screen,argc,argv)) {
free(screen);

@ -1589,8 +1589,20 @@ rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t con
return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* Deny */
}
}
rfbLog("rfbProcessFileTransfer() File Transfer Permission DENIED by default!\n");
return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* DEFAULT: DENY (for security) */
else
{
if (cl->screen->permitFileTransfer)
{
rfbLog("rfbProcessFileTransfer() File Transfer Permission Granted!\n");
return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, 1 , 0, ""); /* Permit */
}
else
{
rfbLog("rfbProcessFileTransfer() File Transfer Permission DENIED by default!\n");
return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* DEFAULT: DENY (for security) */
}
}
}
break;

@ -348,6 +348,9 @@ typedef struct _rfbScreenInfo
/* What does the server tell the new clients which version it supports */
int protocolMajorVersion;
int protocolMinorVersion;
/* command line authorization of file transfers */
rfbBool permitFileTransfer;
} rfbScreenInfo, *rfbScreenInfoPtr;

@ -218,7 +218,7 @@ typedef struct {
#define rfbProtocolVersionFormat "RFB %03d.%03d\n"
#define rfbProtocolMajorVersion 3
#define rfbProtocolMinorVersion 6
#define rfbProtocolMinorVersion 8
/* UltraVNC Viewer examines rfbProtocolMinorVersion number (4, and 6)
* to identify if the server supports File Transfer
*/

Loading…
Cancel
Save