Commit d9214f99 authored by dscho's avatar dscho

cmdline arg -passwd added

parent c301d627
......@@ -21,6 +21,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, "-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 "
"(default 40)\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 */
if (i + 1 >= *argc) rfbUsage();
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 */
if (i + 1 >= *argc) rfbUsage();
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
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;
......@@ -465,6 +465,8 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
rfbScreen->height = height;
rfbScreen->bitsPerPixel = rfbScreen->depth = 8*bytesPerPixel;
rfbScreen->passwordCheck = defaultPasswordCheck;
rfbProcessArguments(rfbScreen,argc,argv);
#ifdef WIN32
......@@ -532,7 +534,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
rfbScreen->setXCutText = defaultSetXCutText;
rfbScreen->getCursorPtr = defaultGetCursorPtr;
rfbScreen->setTranslateFunction = rfbSetTranslateFunction;
rfbScreen->passwordCheck = defaultPasswordCheck;
rfbScreen->newClientHook = doNothingWithClient;
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 doNothingWithClient(rfbClientPtr cl);
/* to check against plain passwords */
Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len);
/* functions to make a vnc server */
extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
int width,int height,int bitsPerSample,int samplesPerPixel,
......
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