tigervnc/SOURCES/tigervnc-remove-trailing-sp...

27 lines
1.0 KiB
Diff

From 989491eb4b325f980e94d27e0ad1a7bee63b6ebd Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Fri, 3 Jul 2020 13:56:35 +0200
Subject: [PATCH] Remove trailing spaces in user name
It's quite easy to make a mistake and add an additional space when configuring
users in the vncserver.users config file. You will then get an error that the
user doesn't exist and it's hard to spot the mistake. Same applies for a space
before the display number.
---
unix/vncserver/vncsession-start.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/unix/vncserver/vncsession-start.in b/unix/vncserver/vncsession-start.in
index b20fcdd97..65ee0a81c 100644
--- a/unix/vncserver/vncsession-start.in
+++ b/unix/vncserver/vncsession-start.in
@@ -33,7 +33,7 @@ fi
DISPLAY="$1"
-USER=`grep "^${DISPLAY}=" "${USERSFILE}" 2>/dev/null | head -1 | cut -d = -f 2-`
+USER=`grep "^ *${DISPLAY}=" "${USERSFILE}" 2>/dev/null | head -1 | cut -d = -f 2- | sed 's/ *$//g'`
if [ -z "${USER}" ]; then
echo "No user configured for display ${DISPLAY}" >&2