[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r4138 - in trunk/OpenDNSSEC/signer/src: daemon signer tools

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Oct 25 14:59:43 CEST 2010


Author: matthijs
Date: 2010-10-25 14:59:43 +0200 (Mon, 25 Oct 2010)
New Revision: 4138

Modified:
   trunk/OpenDNSSEC/signer/src/daemon/engine.c
   trunk/OpenDNSSEC/signer/src/signer/tools.c
   trunk/OpenDNSSEC/signer/src/signer/zone.c
   trunk/OpenDNSSEC/signer/src/signer/zone.h
   trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c
Log:
fetch <zone>.axfr file



Modified: trunk/OpenDNSSEC/signer/src/daemon/engine.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-10-25 12:59:12 UTC (rev 4137)
+++ trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-10-25 12:59:43 UTC (rev 4138)
@@ -698,6 +698,7 @@
                     zone->signconf_filename?zone->signconf_filename:"(null)");
                 lock_basic_lock(&engine->tasklist->tasklist_lock);
                 tmp = zone_update_signconf(zone, engine->tasklist, buf);
+                zone->fetch = (engine->config->zonefetch_filename != NULL);
                 engine->tasklist->loading = 0;
                 lock_basic_unlock(&engine->tasklist->tasklist_lock);
                 lock_basic_unlock(&zone->zone_lock);
@@ -706,6 +707,7 @@
 
             lock_basic_lock(&engine->tasklist->tasklist_lock);
             tmp = zone_update_signconf(zone, engine->tasklist, buf);
+            zone->fetch = (engine->config->zonefetch_filename != NULL);
             lock_basic_unlock(&engine->tasklist->tasklist_lock);
 
             if (tmp < 0) {
@@ -830,7 +832,8 @@
         return 1;
     }
 
-    se_log_info("zone fetcher started (pid=%i)", getpid());
+    se_log_verbose("zone fetcher running as pid %lu",
+        (unsigned long) getpid());
 
     zf_filename = se_strdup(engine->config->zonefetch_filename);
     zl_filename = se_strdup(engine->config->zonelist_filename);

Modified: trunk/OpenDNSSEC/signer/src/signer/tools.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/tools.c	2010-10-25 12:59:12 UTC (rev 4137)
+++ trunk/OpenDNSSEC/signer/src/signer/tools.c	2010-10-25 12:59:43 UTC (rev 4138)
@@ -52,6 +52,7 @@
 tools_read_input(zone_type* zone)
 {
     char* tmpname = NULL;
+    char* axfrname = NULL;
     int error = 0;
     time_t start = 0;
     time_t end = 0;
@@ -68,6 +69,22 @@
 
     switch (zone->inbound_adapter->type) {
         case ADAPTER_FILE:
+            if (zone->fetch) {
+                se_log_verbose("fetch zone %s",
+                    zone->name?zone->name:"(null)");
+                axfrname = se_build_path(zone->inbound_adapter->filename,
+                    ".axfr", 0);
+                error = se_file_copy(axfrname,
+                    zone->inbound_adapter->filename);
+                if (error) {
+                    se_log_error("unable to copy axfr file %s to %s",
+                        axfrname, zone->inbound_adapter->filename);
+                    se_free((void*)axfrname);
+                    return 1;
+                }
+                se_free((void*)axfrname);
+            }
+
             se_log_verbose("read zone %s from input file adapter %s",
                 zone->name?zone->name:"(null)",
                 zone->inbound_adapter->filename ?

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-10-25 12:59:12 UTC (rev 4137)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-10-25 12:59:43 UTC (rev 4138)
@@ -78,6 +78,7 @@
     zone->tobe_removed = 0;
     zone->in_progress = 0;
     zone->processed = 0;
+    zone->fetch = 0;
     zone->zonedata = zonedata_create();
     zone->stats = stats_create();
     lock_basic_init(&zone->zone_lock);
@@ -704,6 +705,7 @@
         fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC);
         fprintf(fd, ";name: %s\n", zone->name?zone->name:"(null)");
         fprintf(fd, ";class: %i\n", (int) zone->klass);
+        fprintf(fd, ";fetch: %i\n", (int) zone->fetch);
         fprintf(fd, ";default_ttl: %u\n", zone->zonedata->default_ttl);
         fprintf(fd, ";inbound_serial: %u\n", zone->zonedata->inbound_serial);
         fprintf(fd, ";internal_serial: %u\n", zone->zonedata->internal_serial);
@@ -867,6 +869,7 @@
 zone_recover_from_backup(zone_type* zone, struct tasklist_struct* tl)
 {
     int klass = 0;
+    int fetch = 0;
     int error = 0;
     char* filename = NULL;
     task_type* task = NULL;
@@ -885,6 +888,8 @@
             !backup_read_check_str(fd, zone->name) ||
             !backup_read_check_str(fd, ";class:") ||
             !backup_read_int(fd, &klass) ||
+            !backup_read_check_str(fd, ";fetch:") ||
+            !backup_read_int(fd, &fetch) ||
             !backup_read_check_str(fd, ";default_ttl:") ||
             !backup_read_uint32_t(fd, &zone->zonedata->default_ttl) ||
             !backup_read_check_str(fd, ";inbound_serial:") ||
@@ -900,6 +905,9 @@
             se_fclose(fd);
             return;
         }
+        zone->klass = (ldns_rr_class) klass;
+        zone->fetch = fetch;
+
         se_fclose(fd);
     } else {
         se_log_deeebug("unable to recover zone state from file %s.state: ",

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.h	2010-10-25 12:59:12 UTC (rev 4137)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.h	2010-10-25 12:59:43 UTC (rev 4138)
@@ -61,6 +61,7 @@
 
     /* from conf.xml */
     const char* notify_ns; /* master name server reload command */
+    int fetch; /* zone fetcher enabled */
 
     /* from signconf.xml */
     signconf_type* signconf; /* signer configuration values */

Modified: trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c	2010-10-25 12:59:12 UTC (rev 4137)
+++ trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c	2010-10-25 12:59:43 UTC (rev 4138)
@@ -972,7 +972,8 @@
                 zone->input_file?zone->input_file:"(null)");
             if(rename(axfr_file, dest_file) == 0) {
                 snprintf(engine_sign_cmd, sizeof(engine_sign_cmd),
-                    "%s sign %s", ODS_SE_CLI, zone->name?zone->name:"--all");
+                    "%s sign %s > /dev/null 2>&1",
+                    ODS_SE_CLI, zone->name?zone->name:"--all");
                 if (system(engine_sign_cmd) != 0) {
                     se_log_error("zone fetcher could not kick "
                         "the signer engine to sign zone %s",
@@ -1367,7 +1368,7 @@
         list_settings(stdout, config, config_file);
         exit(0);
     }
- 
+
     if (config->serverlist == NULL) {
         se_log_alert("zone fetcher error: no master servers configured "
             "with <RequestTransfer>");




More information about the Opendnssec-commits mailing list