Weird TZ Behavior in 4.1p1 and 4.3p2 on AIX

Darren Tucker dtucker at
Wed Sep 13 08:17:33 EST 2006

On Tue, Sep 12, 2006 at 10:37:58AM -0400, Strickler, Scott - Scott F wrote:
> I want to upgrade from 3.8p1 so I can use PAM for PasswordAuthentication
> in addition to keyboard-interactive.  I have compiled both 4.1p1 and
> 4.3p2 and the PAM authentication for both methods works fine in both
> releases, but I have a weird annoyance in the logging.  The timestamp
> code appears to be ignoring the TZ setting.  Here is a snippet from the
> logfile where I changed back and forth from 3.8p1 and 4.1p1 as I logged
> in ~ 9:30 this morning:

Maybe we should save and restore TZ, like the following?  (untested)

Index: auth-pam.c
RCS file: /usr/local/src/security/openssh/cvs/openssh/auth-pam.c,v
retrieving revision 1.140
diff -u -p -r1.140 auth-pam.c
--- auth-pam.c	1 Sep 2006 05:38:36 -0000	1.140
+++ auth-pam.c	12 Sep 2006 22:13:49 -0000
@@ -437,10 +437,16 @@ sshpam_thread(void *ctxtp)
 	u_int i;
 	const char *pam_user;
 	const char **ptr_pam_user = &pam_user;
+	char *tz = getenv("TZ");
 	pam_get_item(sshpam_handle, PAM_USER,
 	    (sshpam_const void **)ptr_pam_user);
 	environ[0] = NULL;
+	if (tz != NULL)
+		if (putenv("TZ", tz) == -1)
+			error("PAM: could not set TZ environment: %s",
+			    strerror(errno));
 	if (sshpam_authctxt != NULL) {
 		setproctitle("%s [pam]",

Darren Tucker (dtucker at
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.
openssh-unix-dev mailing list
openssh-unix-dev at

More information about the openssh-unix-dev mailing list