]> source.dussan.org Git - tigervnc.git/commitdiff
Adapt CConn::getUserPasswd, so that it can read from a file again.
authorPeter Åstrand <astrand@cendio.se>
Fri, 19 May 2006 14:32:59 +0000 (14:32 +0000)
committerPeter Åstrand <astrand@cendio.se>
Fri, 19 May 2006 14:32:59 +0000 (14:32 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@566 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer/CConn.cxx

index d141e50cc233fcc6a0bc0f4cc77da5d39d8054f7..73597f52a2d15b282432f4fc61a08058ab12f9d3 100644 (file)
@@ -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)