Commit Diff
Diff:
b0646dbc628fef9bc0c0f70d888f0e4a9b07fa10
154de500285e095972cd25e03fd5f4e41781f9bd
Commit:
154de500285e095972cd25e03fd5f4e41781f9bd
Tree:
0f2f95a0cd205fc10c38eea8030d0cb3ab9d2527
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Tue Mar 10 07:42:53 2020 UTC
Message:
because axfr.c is run mostly in a chroot it cannot access timezone information unless that's also copied into the chroot. But that's too much overhead for the sysadmin. So we read out the tm_gmtoff with localtime at start of program before any chroot and save that variable globally. We then set it back. This sould fix a bug that I unearthed by resigning a zone at 00:47 in the morning (not my usual operating hours) and noticed that notifies were not sent until I reloaded the zone at 01:00, I want it to honor local host time so this patch. I will test it later tonight at 00:30 or something. not tested, but compiles.
blob - 16c9a3e819d6d92ff8a8d9569baa3ccba80765ba
blob + 0e4534296b180299ff02a33cff5c9d5162e471f7
--- axfr.c
+++ axfr.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: axfr.c,v 1.40 2020/01/14 12:42:04 pjp Exp $
+ * $Id: axfr.c,v 1.41 2020/03/10 07:42:53 pjp Exp $
*/
#include <sys/types.h>
@@ -131,6 +131,7 @@ int notify = 0; /* do not notify when set to 0 */
extern int debug, verbose;
extern time_t time_changed;
extern int tsig;
+extern long glob_time_offset;
SLIST_HEAD(, axfrentry) axfrhead;
@@ -1454,6 +1455,10 @@ gather_notifydomains(ddDB *db)
now = time(NULL);
tm = localtime(&now);
+
+ /* adjust for offset taken before chroot */
+ tm->tm_gmtoff = glob_time_offset;
+
if (tm != NULL)
strftime(timestring, sizeof(timestring), "%Y%m%d", tm);
else
blob - e3db6e7902e01d792a4274903a15d8481c7b7ea0
blob + ca20591a5a980fac6f433e1beb3b73f38c8f7735
--- delphinusdnsd.c
+++ delphinusdnsd.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: delphinusdnsd.c,v 1.99 2020/01/16 13:29:03 pjp Exp $
+ * $Id: delphinusdnsd.c,v 1.100 2020/03/10 07:42:53 pjp Exp $
*/
@@ -284,6 +284,7 @@ char *versionstring = DD_VERSION;
uint8_t vslen = DD_VERSION_LEN;
#endif
int *ptr = NULL;
+long glob_time_offset = 0;
/*
* MAIN - set up arguments, set up database, set up sockets, call mainloop
@@ -322,12 +323,20 @@ main(int argc, char *argv[], char *environ[])
struct imsgbuf **parent_ibuf, **child_ibuf;
static ddDB *db;
+
+ time_t now;
+ struct tm *ltm;
if (geteuid() != 0) {
fprintf(stderr, "must be started as root\n");
exit(1);
}
+
+
+ now = time(NULL);
+ ltm = localtime(&now);
+ glob_time_offset = ltm->tm_gmtoff;
av = argv;
repomaster@centroid.eu