3.8p1 not honoring TZ environment variable

Darren Tucker dtucker at zip.com.au
Sat Mar 6 08:39:30 EST 2004


Tom Orban wrote:

> Hello,
> 
> I just built openssh 3.8p1 on an HP-UX 11i machine.  All looks well
> except for the timezone.  I'm noticing now that when it logs stuff to
> syslog, it's off by 2 hours for me.  What I've figured is this:
> 
> My timezone is MST7MDT (mountain time).
> The timezone in /etc/default/tz is EST5EDT  (eastern time).
> 
> There's a 2 hour difference between  mountain & eastern time.
> 
> What I'm thinking is the real problem, is that it is not looking at the
> TZ environment variable to get its own setting for the timezone when it
> starts up, and so it just uses the default in /etc/default/tz.  This
> behavior is definitely new to 3.8p1.  I was previously running 3.7.1p2,
> which did not exhibit this behavior.  Of course, my workaround is to
> change the value in /etc/default/tz, but it seems like it should be able
> to get the right value out of the TZ environment variable.
> 
> If I'm not mistaken, sshd looks for the value of TZ with a getenv call
> in session.c.  Not much magic there, but it doesn't seem to be working.

In 3.8p1 sshd clears its environment at startup.  You can disable this 
by deleting these lines from sshd.c:

         /* Clear environment */
         environ[0] = NULL;

That will probably be changed for the next release.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
     Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.




More information about the openssh-unix-dev mailing list