Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 6ce4c6da13d19f37e8fb0424fe975ab7 > files > 1

vnc-4.1.2-2mdv2008.1.src.rpm

--- vnc-4_1_2-unixsrc/unix/vncviewer/vncviewer.cxx.102434	2006-12-01 13:37:27.000000000 +0100
+++ vnc-4_1_2-unixsrc/unix/vncviewer/vncviewer.cxx	2006-12-01 13:37:27.000000000 +0100
@@ -52,6 +52,7 @@
                                 "manager decoration around a window", 24);
 StringParameter passwordFile("PasswordFile",
                              "Password file for VNC authentication", "");
+BoolParameter passwdInput("passwdInput", "Gets password from stdin", false);
 AliasParameter rfbauth("passwd", "Alias for PasswordFile", &passwordFile);
 
 BoolParameter useLocalCursor("UseLocalCursor",
--- vnc-4_1_2-unixsrc/unix/vncviewer/vncviewer.man.102434	2006-12-01 13:37:27.000000000 +0100
+++ vnc-4_1_2-unixsrc/unix/vncviewer/vncviewer.man	2006-12-01 13:37:27.000000000 +0100
@@ -108,6 +108,11 @@
 "~/.vnc/passwd".
 
 .TP
+.B \-passwdInput \fItrue, false\fP
+Force standard vnc dialog to getting password and reads password from stdin.
+Default is false(shows dialog window)
+
+.TP
 .B \-Shared
 When you make a connection to a VNC server, all other existing connections are
 normally closed.  This option requests that they be left open, allowing you to
--- vnc-4_1_2-unixsrc/unix/vncviewer/parameters.h.102434	2006-12-01 13:37:27.000000000 +0100
+++ vnc-4_1_2-unixsrc/unix/vncviewer/parameters.h	2006-12-01 13:37:27.000000000 +0100
@@ -38,6 +38,7 @@
 extern rfb::BoolParameter fullScreen;
 extern rfb::StringParameter geometry;
 extern rfb::StringParameter embedParent;
+extern rfb::BoolParameter passwdInput;
 
 extern char aboutText[];
 extern char* programName;
--- vnc-4_1_2-unixsrc/unix/vncviewer/CConn.cxx.102434	2006-12-01 13:37:27.000000000 +0100
+++ vnc-4_1_2-unixsrc/unix/vncviewer/CConn.cxx	2006-12-01 13:41:42.000000000 +0100
@@ -37,6 +37,8 @@
 #include "ServerDialog.h"
 #include "PasswdDialog.h"
 #include "parameters.h"
+#include <string>
+#include <iostream>
 
 using namespace rfb;
 
@@ -206,6 +208,15 @@
     return;
   }
 
+  if(passwdInput)
+  {
+    std::string s;
+    std::cin >> s;
+    *password = strdup(s.c_str());
+    if(user) *user = 0;
+    return;
+  }
+
   const char* secType = secTypeName(getCurrentCSecurity()->getType());
   const char* titlePrefix = "VNC Authentication";
   CharArray title(strlen(titlePrefix) + strlen(secType) + 4);