aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-30 12:06:11 -0500
committerTed Gould <ted@gould.cx>2012-08-30 12:06:11 -0500
commit6308a3d8b0356fd523d5162b04abd99bb4abb283 (patch)
tree029ae3f9ddc0de7cb2b3d91cb4324884628839f9 /src
parentef23e22300f10da9c1bb86e8148516994ae49033 (diff)
downloadlibpam-x2go-6308a3d8b0356fd523d5162b04abd99bb4abb283.tar.gz
libpam-x2go-6308a3d8b0356fd523d5162b04abd99bb4abb283.tar.bz2
libpam-x2go-6308a3d8b0356fd523d5162b04abd99bb4abb283.zip
Make sure to change the working directory for the subprocesses to the guest user's home directory
Diffstat (limited to 'src')
-rw-r--r--src/pam-freerdp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 90686a9..f097ae2 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -247,6 +247,10 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags, int argc, const char **argv)
_exit(EXIT_FAILURE);
}
+ if (chdir(pwdent->pw_dir) != 0) {
+ _exit(EXIT_FAILURE);
+ }
+
setenv("HOME", pwdent->pw_dir, 1);
execvp(args[0], args);
@@ -320,6 +324,11 @@ session_socket_handler (struct passwd * pwdent, int readypipe, const char * ruse
return EXIT_FAILURE;
}
+ if (chdir(pwdent->pw_dir) != 0) {
+ /* Don't need to clean up yet */
+ return EXIT_FAILURE;
+ }
+
/* Build this up as a buffer so we can just write it and see that
very, very clearly */
buffer_len += strlen(ruser) + 1; /* Add one for the space */