Blame SOURCES/tigervnc-cookie.patch

136d7b
diff -up tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie tigervnc-1.0.90-20091221svn3929/unix/vncserver
136d7b
--- tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie	2009-11-12 11:39:54.000000000 +0100
136d7b
+++ tigervnc-1.0.90-20091221svn3929/unix/vncserver	2009-12-21 16:15:01.907799091 +0100
136d7b
@@ -189,27 +189,12 @@ $vncPort = 5900 + $displayNumber;
136d7b
 $desktopLog = "$vncUserDir/$host:$displayNumber.log";
136d7b
 unlink($desktopLog);
136d7b
 
136d7b
-# Make an X server cookie - use /dev/urandom on systems that have it,
136d7b
-# otherwise use perl's random number generator, seeded with the sum
136d7b
-# of the current time, our PID and part of the encrypted form of the password.
136d7b
-
136d7b
-my $cookie = "";
136d7b
-if (open(URANDOM, '<', '/dev/urandom')) {
136d7b
-  my $randata;
136d7b
-  if (sysread(URANDOM, $randata, 16) == 16) {
136d7b
-    $cookie = unpack 'h*', $randata;
136d7b
-  }
136d7b
-  close(URANDOM);
136d7b
-}
136d7b
-if ($cookie eq "") {
136d7b
-  srand(time+$$+unpack("L",`cat $vncUserDir/passwd`));
136d7b
-  for (1..16) {
136d7b
-    $cookie .= sprintf("%02x", int(rand(256)) % 256);
136d7b
-  }
136d7b
-}
136d7b
-
136d7b
-system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie");
136d7b
-system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); 
136d7b
+# Make an X server cookie - use mcookie
136d7b
+$cookie = `/usr/bin/mcookie`;
136d7b
+open (XAUTH, "|xauth -f $xauthorityFile source -");
136d7b
+print XAUTH "add $host:$displayNumber . $cookie\n";
136d7b
+print XAUTH "add $host/unix:$displayNumber . $cookie\n";
136d7b
+close XAUTH;
136d7b
 
136d7b
 if ($opt{'-name'}) {
136d7b
     $desktopName = $opt{'-name'};