Bug#355923: openssh-client: ssh-agent invocation in Xsession.d unsets TMPDIR environment variable
reassign 355923 x11-common
thanks
On Wed, Mar 08, 2006 at 06:33:57PM +0000, Sam Morris wrote:
> Package: openssh-client
> Version: 1:4.2p1-5
> Severity: normal
> Tags: patch
>
> Since /usr/bin/ssh-agent is setgid ssh, ld-linux removes harmful
> environment variables from its environment when it is run. This has the
> effect of breaking libpam-tmpdir and other methods of setting up
> per-user temporary directories.
>
> Fortunately, there is a simple fix; the attached patch uses env(1) in
> the Xsession.d script to preserve the value of TMPDIR through the
> invocation of ssh-agent.
Sounds reasonable to me (although I'd unhardcode the path to env
myself). However, this Xsession.d script is part of x11-common, so it'll
have to be changed there.
> --- /tmp/90x11-common_ssh-agent 2006-03-08 18:20:43.000000000 +0000
> +++ /etc/X11/Xsession.d/90x11-common_ssh-agent 2006-03-08 18:21:09.000000000 +0000
> @@ -18,7 +18,7 @@
> fi
>
> if [ -n "$STARTSSH" ]; then
> - STARTUP="$SSHAGENT $SSHAGENTARGS $STARTUP"
> + STARTUP="$SSHAGENT $SSHAGENTARGS /usr/bin/env TMPDIR=$TMPDIR $STARTUP"
> fi
>
> # vim:set ai et sts=2 sw=2 tw=80:
It occurs to me that this causes TMPDIR to be set (although to an empty
value) when it was previously unset. Perhaps something like:
if [ -n "$STARTSSH" ]; then
if [ -n "${TMPDIR+x$TMPDIR}" ]; then
STARTUP="env TMPDIR=$TMPDIR $STARTUP"
fi
STARTUP="$SSHAGENT $SSHAGENTARGS $STARTUP"
fi
... is called for to avoid this.
Cheers,
--
Colin Watson [cjwatson@debian.org]
Reply to: