Magellan Linux

Contents of /trunk/tigervnc/patches/tigervnc-1.0.90-cookie.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 952 - (show annotations) (download)
Wed Dec 23 21:28:17 2009 UTC (14 years, 4 months ago) by niro
File size: 1456 byte(s)
rediffed for 1.0.90

1 diff -up tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie tigervnc-1.0.90-20091221svn3929/unix/vncserver
2 --- tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie 2009-11-12 11:39:54.000000000 +0100
3 +++ tigervnc-1.0.90-20091221svn3929/unix/vncserver 2009-12-21 16:15:01.907799091 +0100
4 @@ -189,27 +189,12 @@ $vncPort = 5900 + $displayNumber;
5 $desktopLog = "$vncUserDir/$host:$displayNumber.log";
6 unlink($desktopLog);
7
8 -# Make an X server cookie - use /dev/urandom on systems that have it,
9 -# otherwise use perl's random number generator, seeded with the sum
10 -# of the current time, our PID and part of the encrypted form of the password.
11 -
12 -my $cookie = "";
13 -if (open(URANDOM, '<', '/dev/urandom')) {
14 - my $randata;
15 - if (sysread(URANDOM, $randata, 16) == 16) {
16 - $cookie = unpack 'h*', $randata;
17 - }
18 - close(URANDOM);
19 -}
20 -if ($cookie eq "") {
21 - srand(time+$$+unpack("L",`cat $vncUserDir/passwd`));
22 - for (1..16) {
23 - $cookie .= sprintf("%02x", int(rand(256)) % 256);
24 - }
25 -}
26 -
27 -system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie");
28 -system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie");
29 +# Make an X server cookie - use mcookie
30 +$cookie = `/usr/bin/mcookie`;
31 +open (XAUTH, "|xauth -f $xauthorityFile source -");
32 +print XAUTH "add $host:$displayNumber . $cookie\n";
33 +print XAUTH "add $host/unix:$displayNumber . $cookie\n";
34 +close XAUTH;
35
36 if ($opt{'-name'}) {
37 $desktopName = $opt{'-name'};