Committed as 4343, with modifications.  Please test.

On 3/8/11 6:48 AM, Sebastiaan Breedveld wrote:
> --- vncserverorg    2011-03-07 21:35:04.588985408 +0100
> +++ vncserver    2011-03-08 13:46:03.000000000 +0100
> @@ -160,17 +160,57 @@
>       }
>   }
> 
> -# Make sure the user has a password.
> +# Make sure the user has a password, if one needed
> 
> -($z,$z,$mode) = stat("$vncUserDir/passwd");
> -if (!(-e "$vncUserDir/passwd") || ($mode & 077)) {
> -    warn "\nYou will require a password to access your desktops.\n\n";
> -    system($exedir."vncpasswd -q $vncUserDir/passwd");
> -    if (($? >> 8) != 0) {
> -    exit 1;
> +# Check the arguments to check if VncAuth or TLSVnc or X509Vnc
> +# is used as SecurityType, if SecurityType is specified at all.
> +# If a password option is given at the command line, trust this (i.e. 
> do not check for existence).
> +$has_securitytype = 0;
> +$has_vnclikeauth = 0;
> +$has_pwdcmdline = 0;
> +
> +for ($i=0; $i<@ARGV; ++$i) {
> +    # Options can be given by space (-SecurityTypes VNCAuth) or by = 
> (-SecurityTypes=VNCAuth)
> +    my @splitargs = split('=', $ARGV[$i]);
> +    push(@splitargs, $ARGV[$i+1]);
> +
> +    # Check for security types
> +    if (lc(@splitargs[0]) eq "-securitytypes")
> +    {
> +    $has_securitytype = 1;
> +
> +        foreach $arg2 (split(',', @splitargs[1]))
> +    {
> +            if ((lc($arg2) eq "vncauth") || (lc($arg2) eq "tlsvnc") || 
> (lc($arg2) eq "x509vnc"))
> +            {
> +                    # Need password
> +                $has_vnclikeauth = 1;
> +        }
> +        }
> +    }
> +
> +    # Check for Password, PasswordFile or rfbauth options
> +    if ((lc(@splitargs[0]) eq "-password") || (lc(@splitargs[0]) eq 
> "-passwordfile" || (lc(@splitargs[0]) eq "-rfbauth")))
> +    {
> +        $has_pwdcmdline = 1;
>       }
>   }
> 
> +# Now do some logic, and set VNC Password if it does not already exists
> +if ((!$has_securitytype || ($has_securitytype && $has_vnclikeauth)) && 
> !$has_pwdcmdline)
> +{
> +    $needvncpass = 1;
> +    ($z,$z,$mode) = stat("$vncUserDir/passwd");
> +    if (!(-e "$vncUserDir/passwd") || ($mode & 077)) {
> +        warn "\nYou will require a password to access your desktops.\n\n";
> +        system($exedir."vncpasswd -q $vncUserDir/passwd");
> +        if (($? >> 8) != 0) {
> +        exit 1;
> +        }
> +    }
> +}
> +
> +
>   # Find display number.
> 
>   if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to