diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-05-30 15:31:50 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-05-30 16:16:10 +0200 |
commit | 115a79eca024d1ba4e88702792e691e56d972c34 (patch) | |
tree | bc5e8d6c7c59be23cd14ab4e2869db92baf39482 | |
parent | 58b31be6270659d4405efecb9c3bcd42a62def89 (diff) | |
download | tigervnc-115a79eca024d1ba4e88702792e691e56d972c34.tar.gz tigervnc-115a79eca024d1ba4e88702792e691e56d972c34.zip |
Only do restorecon() for legacy directory
This is only needed because of an historical type change of the legacy
directory, so avoid doing it anywhere else.
-rw-r--r-- | unix/vncserver/vncsession.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/unix/vncserver/vncsession.c b/unix/vncserver/vncsession.c index 9022fe56..31dee57d 100644 --- a/unix/vncserver/vncsession.c +++ b/unix/vncserver/vncsession.c @@ -366,18 +366,6 @@ mkvncdir(const char *dir) syslog(LOG_CRIT, "Failure creating \"%s\": %s", dir, strerror(errno)); _exit(EX_OSERR); } - -#ifdef HAVE_SELINUX - /* this is only needed to handle historical type changes for the legacy dir */ - int result; - if (selinux_file_context_verify(dir, 0) == 0) { - result = selinux_restorecon(dir, SELINUX_RESTORECON_RECURSE); - - if (result < 0) { - syslog(LOG_WARNING, "Failure restoring SELinux context for \"%s\": %s", dir, strerror(errno)); - } - } -#endif } } @@ -429,6 +417,18 @@ redir_stdio(const char *homedir, const char *display, char **envp) if (stat(logfile, &st) != 0 && stat(legacy, &st) == 0) { syslog(LOG_WARNING, "~/.vnc is deprecated, please consult 'man vncsession' for paths to migrate to."); strcpy(logfile, legacy); + +#ifdef HAVE_SELINUX + /* this is only needed to handle historical type changes for the legacy dir */ + int result; + if (selinux_file_context_verify(legacy, 0) == 0) { + result = selinux_restorecon(legacy, SELINUX_RESTORECON_RECURSE); + + if (result < 0) { + syslog(LOG_WARNING, "Failure restoring SELinux context for \"%s\": %s", legacy, strerror(errno)); + } + } +#endif } mkdirrecursive(logfile); |