summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2018-01-22 15:42:29 -0800
committermetalefty <meta@vmeta.jp>2018-03-23 15:48:25 +0900
commite40f0dc7e25c5290ad8f609b9aeb7194fa7e06ae (patch)
tree70ef792214c2ef71b1de84d6481dd49e68182c30 /sesman
parent780ba744f6fd46dbfe01aec3f096f14f7346d609 (diff)
downloadxrdp-proprietary-e40f0dc7e25c5290ad8f609b9aeb7194fa7e06ae.tar.gz
xrdp-proprietary-e40f0dc7e25c5290ad8f609b9aeb7194fa7e06ae.zip
sesman: add hostname to vnc password file
Diffstat (limited to 'sesman')
-rw-r--r--sesman/env.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/sesman/env.c b/sesman/env.c
index 29bd281d..142c9bd2 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -102,6 +102,7 @@ env_set_user(const char *username, char **passwd_file, int display,
char *pw_shell;
char *pw_dir;
char text[256];
+ char hostname[256];
pw_shell = 0;
pw_dir = 0;
@@ -152,13 +153,14 @@ env_set_user(const char *username, char **passwd_file, int display,
g_setenv(name, value, 1);
}
}
-
+ g_gethostname(hostname, 255);
+ hostname[255] = 0;
if (passwd_file != 0)
{
if (0 == g_cfg->auth_file_path)
{
/* if no auth_file_path is set, then we go for
- $HOME/.vnc/sesman_username_passwd:DISPLAY */
+ $HOME/.vnc/sesman_USERNAME_passwd:DISPLAY:HOSTNAME */
if (!g_directory_exist(".vnc"))
{
if (g_mkdir(".vnc") < 0)
@@ -169,13 +171,21 @@ env_set_user(const char *username, char **passwd_file, int display,
}
}
- len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd:%d",
- pw_dir, username, display);
+ len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd:%d:%s",
+ pw_dir, username, display, hostname);
*passwd_file = (char *) g_malloc(len + 1, 1);
if (*passwd_file != NULL)
{
- /* Try legacy name first, remove if found */
+ /* Try legacy names first, remove if found */
+ g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd:%d",
+ pw_dir, username, display);
+ if (g_file_exist(*passwd_file))
+ {
+ log_message(LOG_LEVEL_WARNING, "Removing old "
+ "password file %s", *passwd_file);
+ g_file_delete(*passwd_file);
+ }
g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd",
pw_dir, username);
if (g_file_exist(*passwd_file))
@@ -184,9 +194,8 @@ env_set_user(const char *username, char **passwd_file, int display,
"password file %s", *passwd_file);
g_file_delete(*passwd_file);
}
-
- g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd:%d",
- pw_dir, username, display);
+ g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd:%d:%s",
+ pw_dir, username, display, hostname);
}
}
else