summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Åstrand <astrand@cendio.se>2006-05-19 14:32:59 +0000
committerPeter Åstrand <astrand@cendio.se>2006-05-19 14:32:59 +0000
commitc971056768c11ea0e145b6bbcb87ef9b4c614eb1 (patch)
tree9b50b713975cf2f04a3d2c42f3d8bf9c6811f67c
parent2188242d6dcc6f09d7741b3a078604671ba2ca3c (diff)
downloadtigervnc-c971056768c11ea0e145b6bbcb87ef9b4c614eb1.tar.gz
tigervnc-c971056768c11ea0e145b6bbcb87ef9b4c614eb1.zip
Adapt CConn::getUserPasswd, so that it can read from a file again.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@566 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--vncviewer/CConn.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index d141e50c..73597f52 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -677,20 +677,22 @@ void CConn::copyRect(const Rect& r, int srcX, int srcY) {
}
void CConn::getUserPasswd(char** user, char** password) {
-/*
if (!user && options.passwordFile.buf[0]) {
FILE* fp = fopen(options.passwordFile.buf, "rb");
- 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 (fp) {
+ char data[256];
+ int datalen = fread(data, 1, 256, fp);
+ fclose(fp);
+ if (datalen == 8) {
+ ObfuscatedPasswd obfPwd;
+ obfPwd.buf = data;
+ obfPwd.length = datalen;
+ PlainPasswd passwd(obfPwd);
+ *password = strDup(passwd.buf);
+ memset(data, 0, strlen(data));
+ }
+ }
}
-*/
if (user && options.userName.buf)
*user = strDup(options.userName.buf);
if (password && options.password.buf)