aboutsummaryrefslogtreecommitdiffstats
path: root/unix/vncserver/vncserver.in
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-07-16 15:58:06 +0200
committerPierre Ossman <ossman@cendio.se>2020-03-12 12:03:32 +0100
commit1af1cfdf8709dd1a5574efa19fb4f0e68a98021e (patch)
treed04dd9e3a1a5e24d5a6955088f1f8bedcd616b45 /unix/vncserver/vncserver.in
parent79960594551aa32a99506ff87fb0fed5f7bee5eb (diff)
downloadtigervnc-1af1cfdf8709dd1a5574efa19fb4f0e68a98021e.tar.gz
tigervnc-1af1cfdf8709dd1a5574efa19fb4f0e68a98021e.zip
Start sessions via PAM
This sets up a more correct session as there are key tasks that need to be performed by PAM. E.g. systemd will allocate cgroups and start base services. In order to easily handle this as a system service the mapping of displays is now done via a configuration file.
Diffstat (limited to 'unix/vncserver/vncserver.in')
-rwxr-xr-xunix/vncserver/vncserver.in40
1 files changed, 4 insertions, 36 deletions
diff --git a/unix/vncserver/vncserver.in b/unix/vncserver/vncserver.in
index 0b1e9a9e..68a39af0 100755
--- a/unix/vncserver/vncserver.in
+++ b/unix/vncserver/vncserver.in
@@ -88,8 +88,6 @@ if ((@ARGV == 1) && ($ARGV[0] =~ /^:(\d+)$/)) {
if (!&CheckDisplayNumber($displayNumber)) {
die "A VNC server is already running as :$displayNumber\n";
}
-} elsif (@ARGV == 0) {
- $displayNumber = &GetDisplayNumber();
} else {
&Usage();
}
@@ -127,8 +125,8 @@ LoadConfig($vncUserConfig);
LoadConfig($vncSystemConfigMandatoryFile, 1);
#
-# Check whether VNC authentication is enabled, and if so, prompt the user to
-# create a VNC password if they don't already have one.
+# Check whether VNC authentication is enabled, and if so, check that
+# a VNC password has been created.
#
$securityTypeArgSpecified = 0;
@@ -154,17 +152,10 @@ if ($config{'password'} ||
if ((!$securityTypeArgSpecified || $vncAuthEnabled) && !$passwordArgSpecified) {
($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;
- }
+ die "VNC authentication enabled, but no password file created.\n";
}
}
-$desktopLog = "$vncUserDir/$host:$displayNumber.log";
-unlink($desktopLog);
-
#
# Find a desktop session to run
#
@@ -264,11 +255,6 @@ warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n";
warn "Starting desktop session $sessionname\n";
-warn "Log file is $desktopLog\n\n";
-
-open STDOUT, "> $desktopLog"
-open STDERR, ">&STDOUT"
-
exec(@cmd);
die "Failed to start session.\n";
@@ -315,24 +301,6 @@ sub LoadConfig {
#
-# GetDisplayNumber gets the lowest available display number. A display number
-# n is taken if something is listening on the VNC server port (5900+n) or the
-# X server port (6000+n).
-#
-
-sub GetDisplayNumber
-{
- foreach $n (1..99) {
- if (&CheckDisplayNumber($n)) {
- return $n+0; # Bruce Mah's workaround for bug in perl 5.005_02
- }
- }
-
- die "$prog: no free display number on $host.\n";
-}
-
-
-#
# Load a session desktop file
#
sub LoadXSession {
@@ -439,7 +407,7 @@ sub CheckDisplayNumber
sub Usage
{
- die("\nusage: $prog [:<number>]\n\n");
+ die("\nusage: $prog <display>\n\n");
}