From 38f0d2c3894f12d4d90a25ee057f049516a6ff10 Mon Sep 17 00:00:00 2001 From: Jiuyang liu Date: Thu, 6 Feb 2020 14:48:25 +0000 Subject: [PATCH] implement username/password from env. --- vncviewer/UserDialog.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx index c3aa2f36..8fa26cf3 100644 --- a/vncviewer/UserDialog.cxx +++ b/vncviewer/UserDialog.cxx @@ -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); -- 2.39.5