don't assume home is in /home/$USER

Adjustment of original fix by @abdullahibnnadjo
This commit is contained in:
Devin J. Pohly 2018-04-01 17:21:11 -05:00
parent 5a01a6e38f
commit 2899e07284
1 changed files with 1 additions and 1 deletions

View File

@ -556,7 +556,7 @@ int init_env(pam_handle_t* pam_handle, struct passwd* pw)
setenv("USER", pw->pw_name, 1); setenv("USER", pw->pw_name, 1);
setenv("SHELL", pw->pw_shell, 1); setenv("SHELL", pw->pw_shell, 1);
setenv("LOGNAME", pw->pw_name, 1); setenv("LOGNAME", pw->pw_name, 1);
snprintf(tmp, sizeof(tmp), "/home/%s/%s", pw->pw_name, LY_XAUTHORITY); snprintf(tmp, sizeof(tmp), "%s/%s", pw->pw_dir, LY_XAUTHORITY);
setenv("XAUTHORITY", tmp, 0); setenv("XAUTHORITY", tmp, 0);
buf = termenv ? strdup(termenv) : NULL; buf = termenv ? strdup(termenv) : NULL;
setenv("TERM", buf ? buf : "linux", 1); setenv("TERM", buf ? buf : "linux", 1);