]> git.webhop.me Git - lcd4linux.git/commitdiff
add UNSECURE password option to drv_vnc - SSH would be the better choice.
authormichux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 30 Mar 2009 18:44:28 +0000 (18:44 +0000)
committermichux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 30 Mar 2009 18:44:28 +0000 (18:44 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1016 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

drv_vnc.c
lcd4linux.conf.sample

index 5330030f33c95c0c014cc300ce7b8543963f2c61..147b7dcb9d7191c898a48c8747ea9cecc8b25666 100644 (file)
--- a/drv_vnc.c
+++ b/drv_vnc.c
@@ -92,6 +92,7 @@ static int mouse_x = 0;
 static int mouse_y = 0;
 static int mouse_stat_old = 0;
 static int process_event = 0;
+static char *password;
 
 /* draws a simple rect, used to display keypad */
 int draw_rect(int x, int y, int size, unsigned char col, char *buffer)
@@ -278,10 +279,13 @@ static int drv_vnc_open(const char *Section)
        frameg = (keypadcol & 0xff00) >> 8;
        frameb = (keypadcol & 0xff0000) >> 16;
     }
-
     if (cfg_number(Section, "Port", 5900, 1, 65535, &port) < 1) {
        info("[DRV_VNC] no '%s.Port' entry from %s using default %d", Section, cfg_source(), port);
     }
+    password = cfg_get(Section, "Password", NULL);
+    if (password != NULL) {
+       info("[DRV_VNC] password enabled");
+    }
 
     return 0;
 }
@@ -378,6 +382,14 @@ static int drv_vnc_start(const char *section)
     server->ptrAddEvent = hook_mouseaction;
     server->newClientHook = hook_newclient;
 
+    if (password != NULL) {
+       char **passwds = malloc(sizeof(char **) * 2);
+       passwds[0] = password;
+       passwds[1] = 0;
+       server->authPasswdData = (void *) passwds;
+       server->passwordCheck = rfbCheckPasswordByList;
+    }
+
     /* Initialize the server */
     rfbInitServer(server);
 
@@ -461,6 +473,9 @@ int drv_vnc_quit(const int quiet)
 
     drv_generic_graphic_quit();
     drv_generic_keypad_quit();
+    if (password != NULL) {
+       free(password);
+    }
 
     debug("closing connection");
     drv_vnc_close();
index 020085b61d8329f3afc0b08a927fc54968c77a12..9c0ed4d7e871a5a74feac7ffc9532f928af428a3 100644 (file)
@@ -518,6 +518,7 @@ Display VNC {
     Keypadygap   '10'
     Keypadcol    '8745877'
     Osd_showtime '2000'
+#    Password     'password'
 }
 
 #Plugin KVV {