Commit 1c3af685 authored by steven_carr's avatar steven_carr

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

parent ccdbe8f3
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> 2006-05-15 Steven Carr <scarr@jsa-usa.com>
* The great UltraVNC Compatibility Commit! * The great UltraVNC Compatibility Commit!
libvncserver now supports the following messages: libvncserver now supports the following messages:
......
...@@ -25,6 +25,8 @@ rfbUsage(void) ...@@ -25,6 +25,8 @@ rfbUsage(void)
fprintf(stderr, "-rfbwait time max time in ms to wait for RFB client\n"); 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" fprintf(stderr, "-rfbauth passwd-file use authentication on RFB protocol\n"
" (use 'storepasswd' to create a password file)\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" fprintf(stderr, "-passwd plain-password use authentication \n"
" (use plain-password as password, USE AT YOUR RISK)\n"); " (use plain-password as password, USE AT YOUR RISK)\n");
fprintf(stderr, "-deferupdate time time in ms to defer updates " fprintf(stderr, "-deferupdate time time in ms to defer updates "
...@@ -90,6 +92,16 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]) ...@@ -90,6 +92,16 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return FALSE; return FALSE;
} }
rfbScreen->authPasswdData = argv[++i]; 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 */ } else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */
char **passwds = malloc(sizeof(char**)*2); char **passwds = malloc(sizeof(char**)*2);
if (i + 1 >= *argc) { if (i + 1 >= *argc) {
......
...@@ -836,9 +836,10 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, ...@@ -836,9 +836,10 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->handleEventsEagerly = FALSE; screen->handleEventsEagerly = FALSE;
/* Emulate UltraVNC Server by default */ screen->protocolMajorVersion = rfbProtocolMajorVersion;
screen->protocolMajorVersion = 3; screen->protocolMinorVersion = rfbProtocolMinorVersion;
screen->protocolMinorVersion = 6;
screen->permitFileTransfer = FALSE;
if(!rfbProcessArguments(screen,argc,argv)) { if(!rfbProcessArguments(screen,argc,argv)) {
free(screen); free(screen);
......
...@@ -1589,9 +1589,21 @@ rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t con ...@@ -1589,9 +1589,21 @@ rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t con
return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* Deny */ return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* Deny */
} }
} }
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"); rfbLog("rfbProcessFileTransfer() File Transfer Permission DENIED by default!\n");
return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* DEFAULT: DENY (for security) */ return rfbSendFileTransferMessage(cl, rfbFileTransferAccess, 0, -1 , 0, ""); /* DEFAULT: DENY (for security) */
} }
}
}
break; break;
......
...@@ -348,6 +348,9 @@ typedef struct _rfbScreenInfo ...@@ -348,6 +348,9 @@ typedef struct _rfbScreenInfo
/* What does the server tell the new clients which version it supports */ /* What does the server tell the new clients which version it supports */
int protocolMajorVersion; int protocolMajorVersion;
int protocolMinorVersion; int protocolMinorVersion;
/* command line authorization of file transfers */
rfbBool permitFileTransfer;
} rfbScreenInfo, *rfbScreenInfoPtr; } rfbScreenInfo, *rfbScreenInfoPtr;
......
...@@ -218,7 +218,7 @@ typedef struct { ...@@ -218,7 +218,7 @@ typedef struct {
#define rfbProtocolVersionFormat "RFB %03d.%03d\n" #define rfbProtocolVersionFormat "RFB %03d.%03d\n"
#define rfbProtocolMajorVersion 3 #define rfbProtocolMajorVersion 3
#define rfbProtocolMinorVersion 6 #define rfbProtocolMinorVersion 8
/* UltraVNC Viewer examines rfbProtocolMinorVersion number (4, and 6) /* UltraVNC Viewer examines rfbProtocolMinorVersion number (4, and 6)
* to identify if the server supports File Transfer * to identify if the server supports File Transfer
*/ */
......
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