summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-22 16:11:57 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-22 16:14:31 (GMT)
commit627feaab03df9153ae04f6e792e9a55ad6817d0c (patch) (side-by-side diff)
treed20926fa1246bcc2b66291bf07fd8de1ad5600fb
parentb2eb1ef329680f0faff37550954748fec4616001 (diff)
downloadnssync-627feaab03df9153ae04f6e792e9a55ad6817d0c.tar.gz
nssync-627feaab03df9153ae04f6e792e9a55ad6817d0c.tar.bz2
Provide global zone-conf statement.
* src/bindcf.c (zone_conf_file): New variable. * src/config.c (nssync_kw)<zone-conf>: New statement. (synclist_fixup): If sync-specific zone-conf is not set, use the global one. (cb_sync): Don't check zone_conf_file right away, wait until synclist_fixup instead. * src/nssync.h (zone_conf_file): New extern.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/bindcf.c1
-rw-r--r--src/config.c38
-rw-r--r--src/nssync.h1
3 files changed, 36 insertions, 4 deletions
diff --git a/src/bindcf.c b/src/bindcf.c
index 9dae53a..e5fdd67 100644
--- a/src/bindcf.c
+++ b/src/bindcf.c
@@ -19,6 +19,7 @@
char *named_conf_file;
struct grecs_list *bind_include_path;
char *zone_file_pattern = "$zone.$synctag";
+char *zone_conf_file;
static char *bind_working_dir;
static struct grecs_node *bind_tree;
diff --git a/src/config.c b/src/config.c
index a2d92b1..0f32dc0 100644
--- a/src/config.c
+++ b/src/config.c
@@ -65,10 +65,6 @@ cb_sync(enum grecs_callback_command cmd,
case grecs_callback_section_end:
sp = *pdata;
- if (!sp->zone_conf_file) {
- grecs_error(locus, 0, "zone-conf not defined");
- err = 1;
- }
if (!sp->soa_query) {
grecs_error(locus, 0, "soa-query not defined");
err = 1;
@@ -140,6 +136,9 @@ static struct grecs_keyword nssync_kw[] = {
{ "zonefile-pattern",
NULL, "Pattern for new zone file names",
grecs_type_string, &zone_file_pattern },
+ { "zone-conf",
+ NULL, "Pattern for zone configuration file",
+ grecs_type_string, &zone_conf_file },
{ "compare-command",
NULL, "Command to compare two zone files",
@@ -223,6 +222,37 @@ synclist_fixup()
} else
sp->zone_file_pattern = zone_file_pattern;
}
+ if (!sp->zone_conf_file) {
+ if (!zone_conf_file) {
+ error("%s: zone-conf not defined",
+ sp->tag);
+ err = 1;
+ } else {
+ sp->zone_conf_file =
+ grecs_strdup(zone_conf_file);
+ }
+ }
+
+ if (strchr(sp->zone_conf_file, '$')) {
+ char *env[3];
+ struct wordsplit ws;
+
+ env[0] = "synctag";
+ env[1] = sp->tag;
+ env[2] = NULL;
+ ws.ws_env = (const char**)env;
+ if (wordsplit(sp->zone_conf_file, &ws,
+ WRDSF_NOCMD | WRDSF_ENV | WRDSF_ENV_KV |
+ WRDSF_NOSPLIT | WRDSF_KEEPUNDEF)) {
+ error("cannot split zone-conf: %s",
+ wordsplit_strerror(&ws));
+ exit(EX_SOFTWARE);
+ }
+ grecs_free(zone_conf_file);
+ zone_conf_file = ws.ws_wordv[0];
+ ws.ws_wordv[0] = 0;
+ wordsplit_free(&ws);
+ }
}
return err;
}
diff --git a/src/nssync.h b/src/nssync.h
index d083e7f..db710eb 100644
--- a/src/nssync.h
+++ b/src/nssync.h
@@ -54,6 +54,7 @@ extern char *named_conf_file;
extern struct grecs_list *bind_include_path;
extern char *zone_file_pattern;
+extern char *zone_conf_file;
extern struct grecs_list *synclist;

Return to:

Send suggestions and report system problems to the System administrator.