diff options
author | Pavel Roskin <plroskin@gmail.com> | 2016-12-17 02:23:53 +0000 |
---|---|---|
committer | Pavel Roskin <plroskin@gmail.com> | 2016-12-18 09:24:11 -0800 |
commit | b1db87ea216274aa479cfece5ab8c1bc2f9ed690 (patch) | |
tree | 7255e44924abc9e1245ebe8157b410dd5723dcf5 /sesman | |
parent | 2d8d786a9d518e2d8d1dc0d84ca06bc27461c86f (diff) | |
download | xrdp-proprietary-b1db87ea216274aa479cfece5ab8c1bc2f9ed690.tar.gz xrdp-proprietary-b1db87ea216274aa479cfece5ab8c1bc2f9ed690.zip |
Use per-display VNC password files, remove old style password if found
Every session uses its own VNC password, so keep then in separate files.
The old style password file uses the user's password encrypted with a
known key. Since we are not replacing it anymore, we should remove it.
Diffstat (limited to 'sesman')
-rw-r--r-- | sesman/env.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sesman/env.c b/sesman/env.c index 1a4fa679..d8eb3106 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -150,7 +150,7 @@ env_set_user(const char *username, char **passwd_file, int display, if (0 == g_cfg->auth_file_path) { /* if no auth_file_path is set, then we go for - $HOME/.vnc/sesman_username_passwd */ + $HOME/.vnc/sesman_username_passwd:DISPLAY */ if (!g_directory_exist(".vnc")) { if (g_mkdir(".vnc") < 0) @@ -161,12 +161,24 @@ env_set_user(const char *username, char **passwd_file, int display, } } - len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd", pw_dir, username); + len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd:%d", + pw_dir, username, display); *passwd_file = (char *) g_malloc(len + 1, 1); if (*passwd_file != NULL) { - g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username); + /* Try legacy name first, remove if found */ + g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd", + pw_dir, username); + if (g_file_exist(*passwd_file)) + { + log_message(LOG_LEVEL_WARNING, "Removing insecure " + "password file %s", *passwd_file); + g_file_delete(*passwd_file); + } + + g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd:%d", + pw_dir, username, display); } } else |