Time zone for chrooted internal-sftp?

John Olsson M john.m.olsson at ericsson.com
Sat Jun 8 06:19:52 EST 2013


Hi,

Sorry again for a *very* late response. We have not yet verified the suggested patch due to that I simply forgot forwarding it to those who builds the system. :(

I'll do that straight away and let you know the result as soon as I have it.


/John
________________________________________
From: Damien Miller [djm at mindrot.org]
Sent: Tuesday, 16 April 2013 13:37
To: John Olsson M
Cc: openssh-unix-dev at mindrot.org
Subject: RE: Time zone for chrooted internal-sftp?

it worked?

On Tue, 16 Apr 2013, John Olsson M wrote:

> Sorry for not replying earlier. :(
>
> Thank you!
>
> /John
>
> -----Original Message-----
> From: Damien Miller [mailto:djm at mindrot.org]
> Sent: den 20 mars 2013 18:57
> To: John Olsson M
> Cc: openssh-unix-dev at mindrot.org
> Subject: Re: Time zone for chrooted internal-sftp?
>
> On Wed, 13 Mar 2013, John Olsson M wrote:
>
> > Hi,
> >
> > A question regarding chroot, internal-sftp, and time zones: Is it
> > possible to get the time stamps presented by the chrooted
> > internal-sftp to always be aligned with the system global time zone
> > setting?
> >
> > What is the reason this not done by default, that is couldn't the
> > chrooted internal-sftp inherit the time zone information from the SSH
> > daemon?
>
> I'd expect that it would, but maybe something gets reset after fork().
> You might want to try this patch to see if it makes any difference.
>
> Index: session.c
> ===================================================================
> RCS file: /var/cvs/openssh/session.c,v
> retrieving revision 1.416
> diff -u -p -r1.416 session.c
> --- session.c 15 Mar 2013 00:22:37 -0000      1.416
> +++ session.c 20 Mar 2013 17:55:21 -0000
> @@ -58,6 +58,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <time.h>
>  #include <unistd.h>
>
>  #include "openbsd-compat/sys-queue.h"
> @@ -1461,6 +1462,7 @@ safely_chroot(const char *path, uid_t ui
>
>       }
>
> +     tzset();
>       if (chdir(path) == -1)
>               fatal("Unable to chdir to chroot path \"%s\": "
>                   "%s", path, strerror(errno));
> Index: sshd.c
> ===================================================================
> RCS file: /var/cvs/openssh/sshd.c,v
> retrieving revision 1.420
> diff -u -p -r1.420 sshd.c
> --- sshd.c    12 Feb 2013 00:04:48 -0000      1.420
> +++ sshd.c    20 Mar 2013 17:55:41 -0000
> @@ -607,6 +607,7 @@ privsep_preauth_child(void)
>       arc4random_stir();
>       arc4random_buf(rnd, sizeof(rnd));
>       RAND_seed(rnd, sizeof(rnd));
> +     tzset();
>
>       /* Demote the private keys to public keys. */
>       demote_sensitive_data();
>


More information about the openssh-unix-dev mailing list