]> source.dussan.org Git - tigervnc.git/commitdiff
implement username/password from env.
authorJiuyang liu <liujiuyang1994@gmail.com>
Thu, 6 Feb 2020 14:48:25 +0000 (14:48 +0000)
committerJiuyang liu <liujiuyang1994@gmail.com>
Thu, 6 Feb 2020 14:48:25 +0000 (14:48 +0000)
vncviewer/UserDialog.cxx

index c3aa2f3646395c81f76280f1cdb33667a396e217..8fa26cf3668d4eaecca95c0c9466103c5cd3fe28 100644 (file)
@@ -75,6 +75,19 @@ void UserDialog::getUserPasswd(bool secure, char** user, char** password)
   CharArray passwordFileStr(passwordFile.getData());
 
   assert(password);
+  char *envUsername = getenv("VNC_USERNAME");
+  char *envPassword = getenv("VNC_PASSWORD");
+
+  if(envUsername && envPassword) {
+    *user = strdup(envUsername);
+    *password = strdup(envPassword);
+    return;
+  }
+
+  if (!user && envPassword) {
+    *password = strdup(envPassword);
+    return;
+  }
 
   if (!user && passwordFileStr.buf[0]) {
     ObfuscatedPasswd obfPwd(256);