mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Uppity: clear some key environment vars in subprocesses.
My helper scripts for invoking Uppity have been manually unsetting things like XAUTHORITY and SSH_AUTH_SOCK, to avoid accidentally passing them through from my primary login session, so that I don't get confused about whether agent forwarding is happening, or end up with one DISPLAY going with a different XAUTHORITY. Now I clear these within Uppity itself, so the wrapping script won't have to.
This commit is contained in:
10
unix/uxpty.c
10
unix/uxpty.c
@ -857,7 +857,8 @@ static void copy_ttymodes_into_termios(
|
||||
*/
|
||||
Backend *pty_backend_create(
|
||||
Seat *seat, LogContext *logctx, Conf *conf, char **argv, const char *cmd,
|
||||
struct ssh_ttymodes ttymodes, bool pipes_instead)
|
||||
struct ssh_ttymodes ttymodes, bool pipes_instead,
|
||||
const char *const *env_vars_to_unset)
|
||||
{
|
||||
int slavefd;
|
||||
pid_t pid, pgrp;
|
||||
@ -1088,6 +1089,11 @@ Backend *pty_backend_create(
|
||||
close(ptyfd);
|
||||
}
|
||||
setpgid(pgrp, pgrp);
|
||||
|
||||
if (env_vars_to_unset)
|
||||
for (const char *const *p = env_vars_to_unset; *p; p++)
|
||||
unsetenv(*p);
|
||||
|
||||
if (!pipes_instead) {
|
||||
char *term_env_var = dupprintf("TERM=%s",
|
||||
conf_get_str(conf, CONF_termtype));
|
||||
@ -1268,7 +1274,7 @@ static const char *pty_init(Seat *seat, Backend **backend_handle,
|
||||
cmd = pty_argv[0];
|
||||
|
||||
*backend_handle= pty_backend_create(
|
||||
seat, logctx, conf, pty_argv, cmd, modes, false);
|
||||
seat, logctx, conf, pty_argv, cmd, modes, false, NULL);
|
||||
*realhost = dupstr("");
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user