summaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPeter Åstrand <astrand@cendio.se>2005-01-03 13:32:28 +0000
committerPeter Åstrand <astrand@cendio.se>2005-01-03 13:32:28 +0000
commit3e3c75ec5642579b1a7e3ebab36a7f3c3866467d (patch)
tree78bd5c2bae8b4f92ee6bc6d63c0aea6182d28dab /vncviewer
parent55855d5a0a786628c251bfdf2de43adc94f5cee4 (diff)
downloadtigervnc-3e3c75ec5642579b1a7e3ebab36a7f3c3866467d.tar.gz
tigervnc-3e3c75ec5642579b1a7e3ebab36a7f3c3866467d.zip
-PasswordFile support for Windows viewer as well
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@80 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/CViewOptions.cxx4
-rw-r--r--vncviewer/CViewOptions.h1
-rw-r--r--vncviewer/cview.cxx13
3 files changed, 17 insertions, 1 deletions
diff --git a/vncviewer/CViewOptions.cxx b/vncviewer/CViewOptions.cxx
index 1f551296..13ad7cdd 100644
--- a/vncviewer/CViewOptions.cxx
+++ b/vncviewer/CViewOptions.cxx
@@ -30,6 +30,8 @@
using namespace rfb;
using namespace rfb::win32;
+static StringParameter passwordFile("PasswordFile",
+ "Password file for VNC authentication", "");
static BoolParameter useLocalCursor("UseLocalCursor", "Render the mouse cursor locally", true);
static BoolParameter useDesktopResize("UseDesktopResize", "Support dynamic desktop resizing", true);
@@ -113,7 +115,7 @@ preferredEncoding(encodingZRLE), clientCutText(::clientCutText), serverCutText(:
protocol3_3(::protocol3_3), acceptBell(::acceptBell), lowColourLevel(::lowColourLevel),
pointerEventInterval(ptrEventInterval), emulate3(::emulate3), monitor(::monitor.getData()),
customCompressLevel(::customCompressLevel), compressLevel(::compressLevel),
-noJpeg(::noJpeg), qualityLevel(::qualityLevel)
+noJpeg(::noJpeg), qualityLevel(::qualityLevel), passwordFile(::passwordFile.getData())
{
CharArray encodingName(::preferredEncoding.getData());
preferredEncoding = encodingNum(encodingName.buf);
diff --git a/vncviewer/CViewOptions.h b/vncviewer/CViewOptions.h
index e45612c3..d49cab14 100644
--- a/vncviewer/CViewOptions.h
+++ b/vncviewer/CViewOptions.h
@@ -83,6 +83,7 @@ namespace rfb {
bool noJpeg;
int qualityLevel;
+ CharArray passwordFile;
};
diff --git a/vncviewer/cview.cxx b/vncviewer/cview.cxx
index 5d1ee5d2..78fc4be6 100644
--- a/vncviewer/cview.cxx
+++ b/vncviewer/cview.cxx
@@ -1484,6 +1484,19 @@ void CView::invertRect(const Rect& r) {
}
bool CView::getUserPasswd(char** user, char** password) {
+ if (!user && options.passwordFile.buf[0]) {
+ FILE* fp = fopen(options.passwordFile.buf, "r");
+ if (!fp) return false;
+ char data[256];
+ int datalen = fread(data, 1, 256, fp);
+ fclose(fp);
+ if (datalen != 8) return false;
+ vncAuthUnobfuscatePasswd(data);
+ *password = strDup(data);
+ memset(data, 0, strlen(data));
+ return true;
+ }
+
if (user && options.userName.buf)
*user = strDup(options.userName.buf);
if (password && options.password.buf)