[Pdns-users] Strange time drift in log

Christian Hofstaedtler ch at zeha.at
Thu Sep 9 08:27:55 UTC 2010


* Christian Hofstaedtler <ch at zeha.at> [100909 09:56]:
> Nikolas,
> 
> The LDAP backend does indeed re-set the timezone to UTC.
> Why this propagates to your syslogd and into your log files, is
> beyond my imagination right now.

You could try out the following patch. It is compile-tested only, as
I don't have a test environment with ldapbackend, but it should
probably work. What you need to especially test is the autoserial
feature (might now give wrong timezones or whatnot).

Index: modules/ldapbackend/ldapbackend.cc
===================================================================
--- modules/ldapbackend/ldapbackend.cc	(revision 1707)
+++ modules/ldapbackend/ldapbackend.cc	(working copy)
@@ -22,9 +22,6 @@
         	m_default_ttl = arg().asNum( "default-ttl" );
         	m_myname = "[LdapBackend]";
 
-        	// we need UTC time for timestamps
-        	setenv( "TZ", "", 1 ); tzset();
-
         	setArgPrefix( "ldap" + suffix );
 
         	m_getdn = false;
Index: modules/ldapbackend/utils.hh
===================================================================
--- modules/ldapbackend/utils.hh	(revision 1707)
+++ modules/ldapbackend/utils.hh	(working copy)
@@ -3,6 +3,7 @@
 #include <time.h>
 #include <stdlib.h>
 #include <pdns/misc.hh>
+#include <pdns/utility.hh>
 
 
 #ifndef LDAPBACKEND_UTILS_HH
@@ -146,7 +147,7 @@
 
         if( tmp != NULL && *tmp == 0 )
         {
-        	return mktime( &tm );
+        	return timegm( &tm );
         }
 
         return 0;

-- 
christian hofstaedtler



More information about the Pdns-users mailing list