Skip to content

Commit

Permalink
agent: don't skip PAM setup outside of tests
Browse files Browse the repository at this point in the history
We need the PAM setup to initialize environment for user session,
even if we do not actually change the user. Keep the simplified
behaviour to tests.
  • Loading branch information
pwmarcz committed Feb 7, 2020
1 parent c26af84 commit 6429de2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions agent/qrexec-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,19 @@ void do_exec(char *cmd)
signal(SIGCHLD, SIG_DFL);
signal(SIGPIPE, SIG_DFL);

pw = getpwuid(geteuid());
if (!pw) {
perror("getpwuid");
exit(1);
}
if (!strcmp(pw->pw_name, user)) {
if (geteuid() != 0) {
/* We're not root, assume this is a testing environment. */

pw = getpwuid(geteuid());
if (!pw) {
perror("getpwuid");
exit(1);
}
if (strcmp(pw->pw_name, user)) {
fprintf(stderr, "requested user %s, but qrexec-agent is running as user %s\n",
user, pw->pw_name);
exit(1);
}
/* call QUBESRPC if requested */
exec_qubes_rpc_if_requested(realcmd, environ);

Expand Down

0 comments on commit 6429de2

Please sign in to comment.