Issues w/ timezones on gssftpd

Russ Allbery rra at
Mon Nov 27 23:45:04 EST 2006

Philip Prindeville <philipp at> writes:

> *** src/appl/gssftp/ftpd/ftpd.c.graylist	2006-11-27 13:36:38.000000000 -0700
> --- src/appl/gssftp/ftpd/ftpd.c	2006-11-27 20:18:40.000000000 -0700
> ***************
> *** 472,477 ****
> --- 552,560 ----
>   		if (ns > 2)
>   		  (void) close(ns);
>   	}
> + #if defined(__USE_POSIX)
> + 	tzset();
> + #endif

I'd like to try to understand more about what's going on here.  The basic
problem is that gssftpd's logs don't have appropriate timestamps in your
environment, and running tzset() fixes that?

According to the Linux tzset man page:

    This function is automatically called by the other time conversion
    functions that depend on the time zone.

This implies to me that you should never have to call tzset explicitly,
and if you do, something else is wrong.

I believe what it's doing in this case is initializing the TZ environment
variable based on the contents of /etc/localtime, which is then used by
child processes in a chroot to figure out the appropriate time zone in the
absence of the normal configuration file (although I no longer have the
original message that started this thread at hand, and may be
misunderstanding).  If that's the case, why not just ensure that the
localtime file exists in the chroot?  /etc/localtime is a fairly standard
configuration file to have to copy into a chroot.

Russ Allbery (rra at             <>

More information about the krbdev mailing list