[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r4048 - trunk/OpenDNSSEC/signer/src/daemon

Matthijs Mekking matthijs at nlnetlabs.nl
Tue Oct 5 10:45:56 CEST 2010


Author: matthijs
Date: 2010-10-05 10:45:56 +0200 (Tue, 05 Oct 2010)
New Revision: 4048

Modified:
   trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c
   trunk/OpenDNSSEC/signer/src/daemon/engine.c
   trunk/OpenDNSSEC/signer/src/daemon/engine.h
Log:
update zone list if zone not found: Pivotal Story 4861312



Modified: trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c	2010-10-05 07:58:22 UTC (rev 4047)
+++ trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c	2010-10-05 08:45:56 UTC (rev 4048)
@@ -166,9 +166,19 @@
         tbd = NULL;
     }
     se_log_info("cmdhandler: updating signer configuration (%s)", tbd?tbd:"--all");
-    engine_update_zones(cmdc->engine, tbd, buf);
+    ret = engine_update_zones(cmdc->engine, tbd, buf);
     se_writen(sockfd, buf, strlen(buf));
 
+    if (tbd && ret != 0) {
+        /* zone was not found */
+        ret = engine_update_zonelist(cmdc->engine, buf);
+        se_writen(sockfd, buf, strlen(buf));
+
+        /* try again */
+        ret = engine_update_zones(cmdc->engine, tbd, buf);
+        se_writen(sockfd, buf, strlen(buf));
+    }
+
     /* wake up sleeping workers */
     for (i=0; i < (size_t) cmdc->engine->config->num_worker_threads; i++) {
         worker_wakeup(cmdc->engine->workers[i]);

Modified: trunk/OpenDNSSEC/signer/src/daemon/engine.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-10-05 07:58:22 UTC (rev 4047)
+++ trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-10-05 08:45:56 UTC (rev 4048)
@@ -633,7 +633,7 @@
  * Update zones.
  *
  */
-void
+int
 engine_update_zones(engine_type* engine, const char* zone_name, char* buf)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
@@ -666,7 +666,7 @@
                 engine->tasklist->loading = 0;
                 lock_basic_unlock(&engine->tasklist->tasklist_lock);
                 lock_basic_unlock(&zone->zone_lock);
-                return;
+                return 0;
             }
 
             lock_basic_lock(&engine->tasklist->tasklist_lock);
@@ -694,8 +694,9 @@
         se_log_debug("zone %s not found", zone_name);
         if (buf) {
             (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s not found, "
-                "updating all zones.\n", zone_name);
+                "updating zone list.\n", zone_name);
         }
+        return 1;
     } else {
         se_log_debug("configurations updated");
         if (buf) {
@@ -703,7 +704,7 @@
                 "errors: %i; unchanged: %i.\n", updated, errors, unchanged);
         }
     }
-    return;
+    return 0;
 }
 
 
@@ -913,8 +914,8 @@
         }
 
         if (zl_changed) {
+            zl_changed = engine_update_zones(engine, NULL, NULL);
             zl_changed = 0;
-            engine_update_zones(engine, NULL, NULL);
         }
 
         if (start_zonefetcher(engine) != 0) {

Modified: trunk/OpenDNSSEC/signer/src/daemon/engine.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/engine.h	2010-10-05 07:58:22 UTC (rev 4047)
+++ trunk/OpenDNSSEC/signer/src/daemon/engine.h	2010-10-05 08:45:56 UTC (rev 4048)
@@ -109,9 +109,10 @@
  * \param[in] the signer engine
  * \paran[in] zone_name update only this zone
  * \param[in] buf response message
+ * \return int 1 if zone was not found (zone_name != NULL)
  *
  */
-void engine_update_zones(engine_type* engine, const char* zone_name, char* buf);
+int engine_update_zones(engine_type* engine, const char* zone_name, char* buf);
 
 
 /**




More information about the Opendnssec-commits mailing list