cmdline arg -passwd added

pull/1/head
dscho 23 years ago
parent c301d6275d
commit d9214f99ce

@ -21,6 +21,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, "-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 " fprintf(stderr, "-deferupdate time time in ms to defer updates "
"(default 40)\n"); "(default 40)\n");
fprintf(stderr, "-desktop name VNC desktop name (default \"LibVNCServer\")\n"); fprintf(stderr, "-desktop name VNC desktop name (default \"LibVNCServer\")\n");
@ -51,6 +53,13 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
} else if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */ } else if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */
if (i + 1 >= *argc) rfbUsage(); if (i + 1 >= *argc) rfbUsage();
rfbScreen->rfbAuthPasswdData = argv[++i]; rfbScreen->rfbAuthPasswdData = argv[++i];
} else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */
char **passwds = malloc(sizeof(char**)*2);
if (i + 1 >= *argc) rfbUsage();
passwds[0] = argv[++i];
passwds[1] = 0;
rfbScreen->rfbAuthPasswdData = passwds;
rfbScreen->passwordCheck = rfbCheckPasswordByList;
} else if (strcmp(argv[i], "-deferupdate") == 0) { /* -desktop desktop-name */ } else if (strcmp(argv[i], "-deferupdate") == 0) { /* -desktop desktop-name */
if (i + 1 >= *argc) rfbUsage(); if (i + 1 >= *argc) rfbUsage();
rfbScreen->rfbDeferUpdateTime = atoi(argv[++i]); rfbScreen->rfbDeferUpdateTime = atoi(argv[++i]);

@ -401,7 +401,7 @@ Bool defaultPasswordCheck(rfbClientPtr cl,char* response,int len)
/* for this method, rfbAuthPasswdData is really a pointer to an array /* for this method, rfbAuthPasswdData is really a pointer to an array
of char*'s, where the last pointer is 0. */ of char*'s, where the last pointer is 0. */
Bool checkPasswordByList(rfbClientPtr cl,char* response,int len) Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len)
{ {
char **passwds; char **passwds;
@ -465,6 +465,8 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
rfbScreen->height = height; rfbScreen->height = height;
rfbScreen->bitsPerPixel = rfbScreen->depth = 8*bytesPerPixel; rfbScreen->bitsPerPixel = rfbScreen->depth = 8*bytesPerPixel;
rfbScreen->passwordCheck = defaultPasswordCheck;
rfbProcessArguments(rfbScreen,argc,argv); rfbProcessArguments(rfbScreen,argc,argv);
#ifdef WIN32 #ifdef WIN32
@ -532,7 +534,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
rfbScreen->setXCutText = defaultSetXCutText; rfbScreen->setXCutText = defaultSetXCutText;
rfbScreen->getCursorPtr = defaultGetCursorPtr; rfbScreen->getCursorPtr = defaultGetCursorPtr;
rfbScreen->setTranslateFunction = rfbSetTranslateFunction; rfbScreen->setTranslateFunction = rfbSetTranslateFunction;
rfbScreen->passwordCheck = defaultPasswordCheck;
rfbScreen->newClientHook = doNothingWithClient; rfbScreen->newClientHook = doNothingWithClient;
rfbScreen->displayHook = 0; rfbScreen->displayHook = 0;

@ -748,6 +748,9 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y
void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion); void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion);
void doNothingWithClient(rfbClientPtr cl); void doNothingWithClient(rfbClientPtr cl);
/* to check against plain passwords */
Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len);
/* functions to make a vnc server */ /* functions to make a vnc server */
extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
int width,int height,int bitsPerSample,int samplesPerPixel, int width,int height,int bitsPerSample,int samplesPerPixel,

Loading…
Cancel
Save