Revision: 4817 http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4817&view=rev Author: bphinz Date: 2011-11-25 01:12:58 +0000 (Fri, 25 Nov 2011) Log Message: ----------- add PasswordFile parameter as requested in tracker #3441859
Modified Paths: -------------- trunk/java/com/tigervnc/rfb/VncAuth.java trunk/java/com/tigervnc/vncviewer/CConn.java trunk/java/com/tigervnc/vncviewer/VncViewer.java Modified: trunk/java/com/tigervnc/rfb/VncAuth.java =================================================================== --- trunk/java/com/tigervnc/rfb/VncAuth.java 2011-11-24 12:34:15 UTC (rev 4816) +++ trunk/java/com/tigervnc/rfb/VncAuth.java 2011-11-25 01:12:58 UTC (rev 4817) @@ -49,7 +49,7 @@ des.encrypt(obfuscated,0,obfuscated,0); } - String unobfuscatePasswd(byte[] obfuscated) { + public static String unobfuscatePasswd(byte[] obfuscated) { DesCipher des = new DesCipher(obfuscationKey); des.decrypt(obfuscated,0,obfuscated,0); int len; Modified: trunk/java/com/tigervnc/vncviewer/CConn.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/CConn.java 2011-11-24 12:34:15 UTC (rev 4816) +++ trunk/java/com/tigervnc/vncviewer/CConn.java 2011-11-25 01:12:58 UTC (rev 4817) @@ -39,6 +39,8 @@ import java.io.IOException; import java.io.InputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.util.jar.Attributes; import java.util.jar.Manifest; import javax.swing.*; @@ -242,7 +244,30 @@ public final boolean getUserPasswd(StringBuffer user, StringBuffer passwd) { String title = ("VNC Authentication [" +csecurity.description() + "]"); + String passwordFileStr = viewer.passwordFile.getValue(); PasswdDialog dlg; + + if (user == null && passwordFileStr != "") { + InputStream fp = null; + try { + fp = new FileInputStream(passwordFileStr); + } catch(FileNotFoundException e) { + throw new Exception("Opening password file failed"); + } + byte[] obfPwd = new byte[256]; + try { + fp.read(obfPwd); + fp.close(); + } catch(IOException e) { + throw new Exception("Failed to read VncPasswd file"); + } + String PlainPasswd = + VncAuth.unobfuscatePasswd(obfPwd); + passwd.append(PlainPasswd); + passwd.setLength(PlainPasswd.length()); + return true; + } + if (user == null) { dlg = new PasswdDialog(title, (user == null), (passwd == null)); } else { Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/VncViewer.java 2011-11-24 12:34:15 UTC (rev 4816) +++ trunk/java/com/tigervnc/vncviewer/VncViewer.java 2011-11-25 01:12:58 UTC (rev 4817) @@ -253,6 +253,11 @@ = new BoolParameter("SendLocalUsername", "Send the local username for SecurityTypes "+ "such as Plain rather than prompting", true); + StringParameter passwordFile + = new StringParameter("PasswordFile", + "Password file for VNC authentication", ""); + AliasParameter passwd + = new AliasParameter("passwd", "Alias for PasswordFile", passwordFile); BoolParameter autoSelect = new BoolParameter("AutoSelect", "Auto select pixel format and encoding", true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Tigervnc-commits mailing list Tigervnc-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-commits