Commit Diff
Diff:
ba333b378dced16fe9eb206f2a35729b8ce88367
2775dd69de42054ae6167ca4cd8d7db490d5f8b0
Commit:
2775dd69de42054ae6167ca4cd8d7db490d5f8b0
Tree:
2bfc98d323cd966c0ab439fff7c93b47702f4c09
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Thu Nov 14 18:02:12 2019 UTC
Message:
pulling remote zones is inconvenient at times when parse_file() is called. give dddctl configtest a -n flag to turn this off, turn it off on all other calls to this function other than delphinusdnsd which cannot not pull anything at start.
blob - 06f5410682d4ce1f7e425ceacb62750f1b91433b
blob + d22fdb47986a93035162ad4e037820af7723728b
--- ddd-db.h
+++ ddd-db.h
@@ -27,7 +27,7 @@
*/
/*
- * $Id: ddd-db.h,v 1.28 2019/11/11 05:22:50 pjp Exp $
+ * $Id: ddd-db.h,v 1.29 2019/11/14 18:02:12 pjp Exp $
*/
#ifndef _DB_H
@@ -41,6 +41,9 @@
#define CONFFILE "/etc/delphinusdns/delphinusdns.conf"
#define DEFAULT_SOCKET 64
+#define PARSEFILE_FLAG_NOSOCKET 0x1
+
+
#define IMSG_HELLO_MESSAGE 0 /* hello the master process a few */
#define IMSG_SPREAD_MESSAGE 1 /* spread a record to all childs */
#define IMSG_XFR_MESSAGE 2 /* forward message to axfr proc */
@@ -379,7 +382,7 @@ int dddbclose(ddDB *);
#define DDDB_NOTFOUND (-1)
-int parse_file(ddDB *db, char *);
+int parse_file(ddDB *db, char *, uint32_t);
ddDB * opendatabase(ddDB *);
/* dig stuff */
blob - 9bbe31830baf47c491d390bacfc2452fa665f1d4
blob + 967c445e871fe97ef185729689e160fa8dc663c5
--- dddctl.c
+++ dddctl.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: dddctl.c,v 1.87 2019/11/11 09:15:40 pjp Exp $
+ * $Id: dddctl.c,v 1.88 2019/11/14 18:02:12 pjp Exp $
*/
#include <sys/param.h>
@@ -449,6 +449,7 @@ signmain(int argc, char *argv[])
time_t now, serial = 0;
struct tm *tm;
+ uint32_t parseflags = PARSEFILE_FLAG_NOSOCKET;
#if __OpenBSD__
if (pledge("stdio rpath wpath cpath", NULL) < 0) {
@@ -837,7 +838,7 @@ signmain(int argc, char *argv[])
/* now we start reading our configfile */
- if ((mask & MASK_PARSE_FILE) && parse_file(db, zonefile) < 0) {
+ if ((mask & MASK_PARSE_FILE) && parse_file(db, zonefile, parseflags) < 0) {
dolog(LOG_INFO, "parsing config file failed\n");
exit(1);
}
@@ -7008,13 +7009,17 @@ configtest(int argc, char *argv[])
ddDB *db;
char *zonefile = CONFFILE;
int ch, count = 0;
+ uint32_t flags = 0;
- while ((ch = getopt(argc, argv, "c")) != -1) {
+ while ((ch = getopt(argc, argv, "cn")) != -1) {
switch (ch) {
case 'c':
count = 1;
break;
+ case 'n':
+ flags = PARSEFILE_FLAG_NOSOCKET;
+ break;
default:
fprintf(stderr, "usage: dddctl configtest [-c] [input]\n");
exit(1);
@@ -7039,7 +7044,7 @@ configtest(int argc, char *argv[])
/* now we start reading our configfile */
- if (parse_file(db, zonefile) < 0) {
+ if (parse_file(db, zonefile, flags) < 0) {
dolog(LOG_INFO, "parsing config file failed\n");
return 1;
}
@@ -7569,6 +7574,7 @@ bindfile(int argc, char *argv[])
char *zonename;
FILE *of = stdout;
int len;
+ uint32_t flags = PARSEFILE_FLAG_NOSOCKET;
if (argc != 3) {
usage(argc, argv);
@@ -7610,7 +7616,7 @@ bindfile(int argc, char *argv[])
/* now we start reading our configfile */
- if (parse_file(db, zonefile) < 0) {
+ if (parse_file(db, zonefile, flags) < 0) {
dolog(LOG_INFO, "parsing config file failed\n");
return 1;
}
blob - 424067ab9de6f9981731e9738d023d9feecbc3b4
blob + 4a8921c0b89510af41ed9f814fc611c0aa20c138
--- delphinusdnsd.c
+++ delphinusdnsd.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: delphinusdnsd.c,v 1.84 2019/11/11 09:15:40 pjp Exp $
+ * $Id: delphinusdnsd.c,v 1.85 2019/11/14 18:02:12 pjp Exp $
*/
@@ -532,7 +532,7 @@ main(int argc, char *argv[], char *environ[])
init_tsig();
TAILQ_INIT(&tcphead);
- if (parse_file(db, conffile) < 0) {
+ if (parse_file(db, conffile, 0) < 0) {
dolog(LOG_INFO, "parsing config file failed\n");
slave_shutdown();
exit(1);
blob - 4fd55147da0aac36f8bbafd6e8c3890d59b8cde2
blob + 35f2bf4364872c124ee6e0b09a7c68cdd58dd314
--- parse.y
+++ parse.y
@@ -21,7 +21,7 @@
*/
/*
- * $Id: parse.y,v 1.85 2019/11/12 07:14:59 pjp Exp $
+ * $Id: parse.y,v 1.86 2019/11/14 18:02:12 pjp Exp $
*/
%{
@@ -177,6 +177,7 @@ static uint8_t region = 0;
static uint64_t confstatus = 0;
static ddDB *mydb;
static char *current_zone = NULL;
+static int pullzone = 1;
YYSTYPE yylval;
@@ -220,7 +221,7 @@ int hex2bin(char *, int, char *);
int lgetc(int);
struct tab * lookup(struct tab *, char *);
int lungetc(int);
-int parse_file(ddDB *, char *);
+int parse_file(ddDB *, char *, uint32_t);
struct file *pushfile(const char *, int, int, int);
int popfile(void);
static int temp_inet_net_pton_ipv6(const char *, void *, size_t);
@@ -632,7 +633,7 @@ rzone:
return -1;
}
if (lstat(lrz->filename, &sb) < 0 || sb.st_size == 0) {
- if (pull_remote_zone(lrz) < 0) {
+ if (pullzone && pull_remote_zone(lrz) < 0) {
dolog(LOG_ERR, "can't pull zone %s into filename %s, stop.\n", lrz->zonename, lrz->filename);
return -1;
}
@@ -1760,11 +1761,14 @@ yywrap()
}
int
-parse_file(ddDB *db, char *filename)
+parse_file(ddDB *db, char *filename, uint32_t flags)
{
int errors = 0;
mydb = db;
+
+ if (flags & PARSEFILE_FLAG_NOSOCKET)
+ pullzone = 0;
memset(&logging, 0, sizeof(struct logging));
logging.active = 0;
repomaster@centroid.eu