You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

504_tigervnc-cookie.patch 1.2KB

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