netftpserver-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Net::FTPServer] Fwd: Net::FTPServer chroot/TZ conflict.


From: Richard Jones
Subject: [Net::FTPServer] Fwd: Net::FTPServer chroot/TZ conflict.
Date: Sat, 27 Dec 2003 13:21:36 +0000
User-agent: Mutt/1.5.4i

----- Forwarded message from John Jetmore <address@hidden> -----

It appears that ftpd must _access_ (not just set) $ENV{TZ} before a chroot
is done.  I am currently experimenting with 1.118 and chroot and have
found that although $ENV{TZ} is set to US/Central in FTPServer.pm:4543,
every subsequent call to _log_line is logged in GMT.  Here is an example
of the log output in the (default) case:

[Fri Dec 26 10:33:56 2003][29554:-][CONNECTION FROM 216.135.3.9:48264] #2
[Fri Dec 26 10:34:02 2003][29554:-]USER address@hidden
[Fri Dec 26 16:34:04 2003][29554:address@hidden
[Fri Dec 26 16:34:05 2003][29554:address@hidden
[Fri Dec 26 16:34:05 2003][29554:address@hidden

In trying to ensure that $ENV{TZ} was being set to the correct value, I
added the line $self->_log_line("$ENV{TZ}"); to FTPServer.pm:4546.  When I
did this I discovered that everything logged correctly.  I eventually
tracked this down to whether or not the relevant information for
US/Central was read before the chroot.

After adding the line to FTPServer.pm:4561 (directly above
user_login_hook()), I got the following output (with correct timezones):

[Fri Dec 26 12:53:46 2003][30946:-][CONNECTION FROM 216.135.3.2:42512] #2
[Fri Dec 26 12:53:55 2003][30946:-]USER address@hidden
[Fri Dec 26 12:53:56 2003][30946:address@hidden/Central
[Fri Dec 26 12:53:56 2003][30946:address@hidden
[Fri Dec 26 12:54:02 2003][30946:address@hidden
[Fri Dec 26 12:54:02 2003][30946:address@hidden

I then moved the line to FTPServer.pm:4564 (directly after
user_login_hook()) and saw the following logs (with incorrect timezones):

[Fri Dec 26 12:52:18 2003][30921:-][CONNECTION FROM 216.135.3.2:42211] #2
[Fri Dec 26 12:52:23 2003][30921:-]USER address@hidden
[Fri Dec 26 18:52:24 2003][30921:address@hidden/Central
[Fri Dec 26 18:52:24 2003][30921:address@hidden
[Fri Dec 26 18:53:40 2003][30921:address@hidden
[Fri Dec 26 18:53:40 2003][30921:address@hidden

This seems to show that perl doesn't read the zoneinfo files until they
are needed and that after the chroot it no longer has access to this
information.  This is currently confirmed broken in a redhat linux 2.4.9
installation.  This is confirmed as not broken in a Solaris 2.8 install.
Below is the patch I am currently using, though it seems a bit weak to me.
Thanks for a great product.

--John Jetmore
--Cinergy Communications

*** FTPServer.pm        Mon Dec 22 14:54:20 2003
--- FTPServer.pm.new    Fri Dec 26 13:43:04 2003
***************
*** 4543,4548 ****
--- 4543,4549 ----
      $ENV{TZ} = defined $self->config ("time zone")
        ? $self->config ("time zone")
        : "GMT";
+     scalar(localtime(time));

      # Open /etc/protocols etc., in case we chroot. And yes, doing the
      # setprotoent _twice_ is necessary to work around a bug in Perl or

----- End forwarded message -----

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
Perl4Caml lets you use any Perl library in your type-safe Objective
CAML programs. http://www.merjis.com/developers/perl4caml/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]