[nsd-users] nsd looses timezone after chroot

W.C.A. Wijngaards wouter at nlnetlabs.nl
Fri Sep 21 07:44:23 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Camiel,

On 09/20/2012 10:25 PM, Camiel Dobbelaar wrote:
> 
> After chrooting the timezone is wrong in the logging:
> 
> See (unpatched daemon ran first): Sep 20 19:53:11 xmts nsd[32253]:
> nsd started (NSD 3.2.13), pid 32253 Sep 20 19:54:16 xmts
> nsd[32253]: signal received, shutting down... Sep 20 21:54:18 xmts
> nsd[13502]: nsd started (NSD 3.2.13), pid 13502
> 
> chdir() after chroot() is good practice.

Thanks for the patch. I updated unbound and nsd, to do tzset before
and chdir after the chroot.  (slightly different than your patch, with
more detailed error messages for the chdir).

Best regards,
   Wouter

> Note that unbound has the tzet() but not the chdir().  But I guess
> the unbound devs read this list too?  :-)
> 
> Regards, Cam
> 
> 
> (diff is against the OpenBSD tree)
> 
> Index: nsd.c 
> ===================================================================
>
> 
RCS file: /cvs/src/usr.sbin/nsd/nsd.c,v
> retrieving revision 1.12 diff -u -p -r1.12 nsd.c --- nsd.c	9 Jul
> 2012 21:56:41 -0000	1.12 +++ nsd.c	20 Sep 2012 20:01:24 -0000 @@
> -1083,7 +1083,8 @@ main(int argc, char *argv[]) 
> nsd.options->xfrdfile += l; nsd.options->difffile += l;
> 
> -		if (chroot(nsd.chrootdir)) { +		tzset(); +		if
> (chroot(nsd.chrootdir) != 0 || chdir("/") != 0) { log_msg(LOG_ERR,
> "unable to chroot: %s", strerror(errno)); exit(1); }
> 
> _______________________________________________ nsd-users mailing
> list nsd-users at NLnetLabs.nl 
> http://open.nlnetlabs.nl/mailman/listinfo/nsd-users
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQXBrSAAoJEJ9vHC1+BF+Nuu8QAInThbp87NkxJq0IIjA2BwmP
P3SlDy1X+J8xValUcsWsIfUmMFkyOcFQMtDNYdYOX99FObNv0H4OVAHHOHMbzd1d
c+SSY/MCSLA5cP1Xjau+sDzDkzlSRRIxE2PQ7Itn04OjqxhBWExZlU3t5mTwSZ3F
i8yzmS0a2NHXnZcW+aOrF2WdVWHSUwPx/ENHmpn26HhjXpZo2nG088fdb+/cZte8
lh5RtLGvZTaaI9M5rpD8bh9gBDLrz2Zx47BU7hBTbFvS9u/5O15VECypJdIrfxUU
JZXlNun+BK+PU7GWU73de1jgHqgpEH9UNiL2lhcIO2o+kFoDl9ZKEfvUCuQa078/
wo2C+MqqoS0m9z6/eGT99t3MEvaEVMCIWVgPeRS0fCYnUSeTMSgV6DlbwTJLPR3W
xgi4qYzuZGjp3P8sx1TRIZwRPqSSesOVu+/T2F5PpGRiRGwd88pwhotfNwSI0GCH
5lRniv8T3TXsIGifmLViK2CTquxyUN8druFyKAkbYQXg0MgyHT5L5sSuuoN6gnMH
nLypXMLasPQ0w4PjinGM10Wp0UQUppGzKtrCTjlIwdikwE6YktErFTAd17EWGrrv
Qm7agj90fjojKgCcqg3dl1W8GidymDQ8LGdyTvNrzoqnKOcid9ZzQW3Od+lUr42p
IYntYUh4CRbfE2IRhqaw
=t+OO
-----END PGP SIGNATURE-----



More information about the nsd-users mailing list