mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2024-11-28 02:53:41 +01:00
vncserver: load .kasmpasswd users
This commit is contained in:
parent
ffb88ee8e6
commit
a6e9f94e27
@ -95,6 +95,7 @@ my %config;
|
|||||||
|
|
||||||
$kasmAuthEnabled = 1;
|
$kasmAuthEnabled = 1;
|
||||||
$kasmPasswdFile = "$ENV{HOME}/.kasmpasswd";
|
$kasmPasswdFile = "$ENV{HOME}/.kasmpasswd";
|
||||||
|
@kasmPasswdUsers = &LoadKasmPasswdUsers();
|
||||||
|
|
||||||
if ($kasmAuthEnabled) {
|
if ($kasmAuthEnabled) {
|
||||||
&TellUserToSetupUserAndPassword();
|
&TellUserToSetupUserAndPassword();
|
||||||
@ -842,15 +843,33 @@ sub DisableVncAuth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub TellUserToSetupUserAndPassword {
|
sub TellUserToSetupUserAndPassword {
|
||||||
if (!(-e $kasmPasswdFile)) {
|
if (scalar @kasmPasswdUsers > 0) {
|
||||||
warn "\nYou will require a password to access your desktops.\n\n";
|
return;
|
||||||
system($exedir."kasmvncpasswd $kasmPasswdFile");
|
}
|
||||||
if (($? >> 8) != 0) {
|
|
||||||
exit 1;
|
warn "\nYou will require a password to access your desktops.\n\n";
|
||||||
}
|
system($exedir."kasmvncpasswd $kasmPasswdFile");
|
||||||
|
if (($? >> 8) != 0) {
|
||||||
|
exit 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub LoadKasmPasswdUsers {
|
||||||
|
my @result = ();
|
||||||
|
|
||||||
|
open(FH, '<', $kasmPasswdFile) or return @result;
|
||||||
|
|
||||||
|
while(<FH>){
|
||||||
|
$_ =~ /^([^:]+):/ or die "$kasmPasswdFile is incorrect";
|
||||||
|
push(@result, $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(FH);
|
||||||
|
|
||||||
|
return @result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub MakeXCookie {
|
sub MakeXCookie {
|
||||||
# Make an X server cookie and set up the Xauthority file
|
# Make an X server cookie and set up the Xauthority file
|
||||||
# mcookie is a part of util-linux, usually only GNU/Linux systems have it.
|
# mcookie is a part of util-linux, usually only GNU/Linux systems have it.
|
||||||
|
Loading…
Reference in New Issue
Block a user