[Opendnssec-commits] [svn.opendnssec.org/svn/dnssec] r5440 - in trunk/OpenDNSSEC/signer/src: adapter daemon parser scheduler shared signer

Matthijs Mekking matthijs at nlnetlabs.nl
Tue Aug 23 10:35:49 CEST 2011


Author: matthijs
Date: 2011-08-23 10:35:48 +0200 (Tue, 23 Aug 2011)
New Revision: 5440

Modified:
   trunk/OpenDNSSEC/signer/src/adapter/adapi.c
   trunk/OpenDNSSEC/signer/src/adapter/adapter.c
   trunk/OpenDNSSEC/signer/src/adapter/adapter.h
   trunk/OpenDNSSEC/signer/src/adapter/adfile.c
   trunk/OpenDNSSEC/signer/src/daemon/cfg.c
   trunk/OpenDNSSEC/signer/src/daemon/cfg.h
   trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c
   trunk/OpenDNSSEC/signer/src/daemon/engine.c
   trunk/OpenDNSSEC/signer/src/daemon/signal.c
   trunk/OpenDNSSEC/signer/src/parser/confparser.c
   trunk/OpenDNSSEC/signer/src/parser/signconfparser.c
   trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c
   trunk/OpenDNSSEC/signer/src/scheduler/fifoq.c
   trunk/OpenDNSSEC/signer/src/scheduler/schedule.c
   trunk/OpenDNSSEC/signer/src/scheduler/task.c
   trunk/OpenDNSSEC/signer/src/shared/file.c
   trunk/OpenDNSSEC/signer/src/shared/hsm.c
   trunk/OpenDNSSEC/signer/src/shared/util.c
   trunk/OpenDNSSEC/signer/src/signer/denial.c
   trunk/OpenDNSSEC/signer/src/signer/rrset.c
Log:
style, layout, documentation and other nits from branch.



Modified: trunk/OpenDNSSEC/signer/src/adapter/adapi.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adapi.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/adapter/adapi.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -56,8 +56,6 @@
             "no zone data", adapi_str);
         return 0;
     }
-    ods_log_assert(zone);
-    ods_log_assert(zone->zonedata);
     return zone->zonedata->inbound_serial;
 }
 
@@ -74,8 +72,6 @@
             "no zone data", adapi_str);
         return;
     }
-    ods_log_assert(zone);
-    ods_log_assert(zone->zonedata);
     zone->zonedata->inbound_serial = serial;
     return;
 }
@@ -93,7 +89,6 @@
             "no zone", adapi_str);
         return NULL;
     }
-    ods_log_assert(zone);
     return zone->apex;
 }
 
@@ -110,7 +105,6 @@
             "no zone", adapi_str);
         return LDNS_RR_CLASS_FIRST;
     }
-    ods_log_assert(zone);
     return zone->klass;
 }
 
@@ -127,7 +121,6 @@
             "no zone data", adapi_str);
         return 0;
     }
-    ods_log_assert(zone);
     return zone->default_ttl;
 }
 
@@ -144,8 +137,6 @@
             "no zone data", adapi_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(zone);
-    ods_log_assert(zone->zonedata);
     if (!zone->signconf) {
         ods_log_error("[%s] unable to start full zone transaction: "
             "no signer configuration", adapi_str);
@@ -169,9 +160,6 @@
             "no zone data", adapi_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(zone);
-    ods_log_assert(zone->zonedata);
-
     return ODS_STATUS_OK;
 }
 

Modified: trunk/OpenDNSSEC/signer/src/adapter/adapter.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adapter.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/adapter/adapter.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -109,16 +109,12 @@
 {
     zone_type* adzone = (zone_type*) zone;
     ods_status status = ODS_STATUS_OK;
-
     if (!adzone || !adzone->adinbound) {
         ods_log_error("[%s] unable to read zone: no input adapter",
             adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(adzone);
-    ods_log_assert(adzone->adinbound);
     ods_log_assert(adzone->adinbound->configstr);
-
     switch(adzone->adinbound->type) {
         case ADAPTER_FILE:
             ods_log_verbose("[%s] read zone %s from file input adapter %s",
@@ -132,7 +128,6 @@
             return ODS_STATUS_ERR;
             break;
     }
-
     /* not reached */
     return ODS_STATUS_ERR;
 }
@@ -147,22 +142,17 @@
 {
     zone_type* adzone = (zone_type*) zone;
     ods_status status = ODS_STATUS_OK;
-
     if (!adzone || !adzone->adoutbound) {
         ods_log_error("[%s] unable to write zone: no output adapter",
             adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(adzone);
-    ods_log_assert(adzone->adoutbound);
     ods_log_assert(adzone->adoutbound->configstr);
     if (!adzone->zonedata) {
         ods_log_error("[%s] unable to write zone %s: no zone data",
             adapter_str, adzone->name);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(adzone->zonedata);
-
     switch(adzone->adoutbound->type) {
         case ADAPTER_FILE:
             ods_log_verbose("[%s] write zone %s serial %u to output file "
@@ -178,8 +168,7 @@
             return ODS_STATUS_ERR;
             break;
     }
-
-    /* NOT REACHED */
+    /* not reached */
     return ODS_STATUS_ERR;
 }
 

Modified: trunk/OpenDNSSEC/signer/src/adapter/adapter.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adapter.h	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/adapter/adapter.h	2011-08-23 08:35:48 UTC (rev 5440)
@@ -62,10 +62,10 @@
  */
 typedef struct adapter_struct adapter_type;
 struct adapter_struct {
+    allocator_type* allocator;
     const char* configstr;
     adapter_mode type;
     int inbound;
-    allocator_type* allocator;
     adapter_data* data;
 };
 

Modified: trunk/OpenDNSSEC/signer/src/adapter/adfile.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -86,10 +86,8 @@
     if (ttl) {
         new_ttl = *ttl;
     }
-
     len = adutil_readline_frm_file(fd, line, l);
     adutil_rtrim_line(line, &len);
-
     if (len >= 0) {
         switch (line[0]) {
             /* directive */
@@ -172,7 +170,6 @@
                     goto adfile_read_line; /* perhaps next line is rr */
                     break;
                 }
-
                 *status = ldns_rr_new_frm_str(&rr, line, new_ttl, *orig, prev);
                 if (*status == LDNS_STATUS_OK) {
                     ldns_rr2canonical(rr); /* TODO: canonicalize or not? */
@@ -201,7 +198,6 @@
                 break;
         }
     }
-
     /* -1, EOF */
     *status = LDNS_STATUS_OK;
     return NULL;
@@ -243,33 +239,29 @@
             adapter_str);
         return ODS_STATUS_ERR;
     }
-
     /* $TTL <default ttl> */
     ttl = adapi_get_ttl(zone);
-
     /* read RRs */
     while ((rr = adfile_read_rr(fd, zone, line, &orig, &prev, &ttl,
         &status, &l)) != NULL) {
-
+        /* check status */
         if (status != LDNS_STATUS_OK) {
             ods_log_error("[%s] error reading RR at line %i (%s): %s",
                 adapter_str, l, ldns_get_errorstr_by_id(status), line);
             result = ODS_STATUS_ERR;
             break;
         }
-
+        /* debug update */
         if (l > line_update) {
             ods_log_debug("[%s] ...at line %i: %s", adapter_str, l, line);
             line_update += line_update_interval;
         }
-
         /* filter out DNSSEC RRs (except DNSKEY) from the Input File Adapter */
         if (util_is_dnssec_rr(rr)) {
             ldns_rr_free(rr);
             rr = NULL;
             continue;
         }
-
         /* add to the zonedata */
         result = adapi_add_rr(zone, rr);
         if (result != ODS_STATUS_OK) {
@@ -278,7 +270,6 @@
             break;
         }
     }
-
     /* and done */
     if (orig) {
         ldns_rdf_deep_free(orig);
@@ -288,7 +279,6 @@
         ldns_rdf_deep_free(prev);
         prev = NULL;
     }
-
     if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) {
         ods_log_error("[%s] error reading RR at line %i (%s): %s",
             adapter_str, l, ldns_get_errorstr_by_id(status), line);
@@ -317,13 +307,11 @@
             adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(adzone);
     if (!filename) {
         ods_log_error("[%s] unable to read file: no filename given",
             adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(filename);
     /* [end] sanity parameter checking */
 
     /* [start] read zone */
@@ -389,13 +377,11 @@
             adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(adzone);
     if (!filename) {
         ods_log_error("[%s] unable to read file: no filename given",
             adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(filename);
     /* [end] sanity parameter checking */
 
     /* [start] read zone */
@@ -442,13 +428,11 @@
             "name given)", adapter_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(adzone);
     if (!filename) {
         ods_log_error("[%s] unable to write file: no filename given",
             adapter_str);
         return ODS_STATUS_ERR;
     }
-    ods_log_assert(filename);
     /* [end] sanity parameter checking */
 
     /* [start] write zone */
@@ -460,6 +444,5 @@
         status = ODS_STATUS_FOPEN_ERR;
     }
     /* [end] write zone */
-
     return status;
 }

Modified: trunk/OpenDNSSEC/signer/src/daemon/cfg.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/cfg.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/daemon/cfg.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -63,12 +63,10 @@
             conf_str);
         return NULL;
     }
-    ods_log_assert(allocator);
     if (!cfgfile) {
         ods_log_error("[%s] failed to read: no filename given", conf_str);
         return NULL;
     }
-    ods_log_assert(cfgfile);
     ods_log_verbose("[%s] read cfgfile: %s", conf_str, cfgfile);
 
     ecfg = (engineconfig_type*) allocator_alloc(allocator,
@@ -141,9 +139,7 @@
         ods_log_error("[%s] check failed: no socket filename", conf_str);
         return ODS_STATUS_CFG_ERR;
     }
-
     /*  [TODO] room for more checks here */
-
     return ODS_STATUS_OK;
 }
 
@@ -158,7 +154,6 @@
     if (!out) {
         return;
     }
-
     fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
     if (config) {
         fprintf(out, "<Configuration>\n");

Modified: trunk/OpenDNSSEC/signer/src/daemon/cfg.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/cfg.h	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/daemon/cfg.h	2011-08-23 08:35:48 UTC (rev 5440)
@@ -70,7 +70,7 @@
 
 /**
  * Configure engine.
- * \param[in] allocator memory allocation
+ * \param[in] allocator memory allocator
  * \param[in] cfgfile config file
  * \param[in] cmdline_verbosity log level
  * \return engineconfig_type* engine configuration
@@ -83,6 +83,8 @@
  * Check configuration.
  * \param[in] config engine configuration
  * \return ods_status status
+ *         ODS_STATUS_OK: configuration settings ok
+ *         else: error in configuration settings
  *
  */
 ods_status engine_config_check(engineconfig_type* config);

Modified: trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -116,7 +116,6 @@
     size_t i;
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     zone_type* zone = NULL;
-
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
     if (!cmdc->engine->zonelist || !cmdc->engine->zonelist->zones) {
@@ -124,14 +123,11 @@
         ods_writen(sockfd, buf, strlen(buf));
         return;
     }
-
-    lock_basic_lock(&cmdc->engine->zonelist->zl_lock);
     /* how many zones */
-    /* [LOCK] zonelist */
+    lock_basic_lock(&cmdc->engine->zonelist->zl_lock);
     (void)snprintf(buf, ODS_SE_MAXLINE, "I have %i zones configured\n",
         (int) cmdc->engine->zonelist->zones->count);
     ods_writen(sockfd, buf, strlen(buf));
-
     /* list zones */
     node = ldns_rbtree_first(cmdc->engine->zonelist->zones);
     while (node && node != LDNS_RBTREE_NULL) {
@@ -143,7 +139,6 @@
         ods_writen(sockfd, buf, strlen(buf));
         node = ldns_rbtree_next(node);
     }
-    /* [UNLOCK] zonelist */
     lock_basic_unlock(&cmdc->engine->zonelist->zl_lock);
     return;
 }
@@ -162,18 +157,14 @@
     zone_type* zone = NULL;
     task_type* task = NULL;
     int zl_changed = 0;
-
     ods_log_assert(tbd);
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
     ods_log_assert(cmdc->engine->taskq);
-
     if (ods_strcmp(tbd, "--all") == 0) {
-        /* [LOCK] zonelist */
         lock_basic_lock(&cmdc->engine->zonelist->zl_lock);
         zl_changed = zonelist_update(cmdc->engine->zonelist,
             cmdc->engine->config->zonelist_filename);
-        /* [UNLOCK] zonelist */
         if (zl_changed == ODS_STATUS_UNCHANGED) {
             lock_basic_unlock(&cmdc->engine->zonelist->zl_lock);
             (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list has not changed."
@@ -186,12 +177,10 @@
                 cmdc->engine->zonelist->just_added,
                 cmdc->engine->zonelist->just_updated);
             ods_writen(sockfd, buf, strlen(buf));
-
             cmdc->engine->zonelist->just_removed = 0;
             cmdc->engine->zonelist->just_added = 0;
             cmdc->engine->zonelist->just_updated = 0;
             lock_basic_unlock(&cmdc->engine->zonelist->zl_lock);
-
             ods_log_debug("[%s] commit zone list changes", cmdh_str);
             engine_update_zones(cmdc->engine);
             ods_log_debug("[%s] signer configurations updated", cmdh_str);
@@ -204,15 +193,14 @@
     } else {
         /* look up zone */
         lock_basic_lock(&cmdc->engine->zonelist->zl_lock);
-        /* [LOCK] zonelist */
         zone = zonelist_lookup_zone_by_name(cmdc->engine->zonelist, tbd,
             LDNS_RR_CLASS_IN);
         /* If this zone is just added, don't update (it might not have a task yet) */
         if (zone && zone->just_added) {
             zone = NULL;
         }
-        /* [UNLOCK] zonelist */
         lock_basic_unlock(&cmdc->engine->zonelist->zl_lock);
+
         if (!zone) {
             (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s not found.\n",
                 tbd);
@@ -226,7 +214,6 @@
         ods_log_assert(zone->task);
 
         lock_basic_lock(&cmdc->engine->taskq->schedule_lock);
-        /* [LOCK] schedule */
         task = unschedule_task(cmdc->engine->taskq, (task_type*) zone->task);
         if (task != NULL) {
             ods_log_debug("[%s] reschedule task for zone %s", cmdh_str,
@@ -246,7 +233,6 @@
             task->interrupt = TASK_SIGNCONF;
             /* task->halted set by worker */
         }
-        /* [UNLOCK] schedule */
         lock_basic_unlock(&cmdc->engine->taskq->schedule_lock);
 
         zone->task = task;
@@ -288,9 +274,7 @@
 
     if (ods_strcmp(tbd, "--all") == 0) {
         lock_basic_lock(&cmdc->engine->taskq->schedule_lock);
-        /* [LOCK] schedule */
         schedule_flush(cmdc->engine->taskq, TASK_READ);
-        /* [UNLOCK] schedule */
         lock_basic_unlock(&cmdc->engine->taskq->schedule_lock);
         engine_wakeup_workers(cmdc->engine);
         (void)snprintf(buf, ODS_SE_MAXLINE, "All zones scheduled for "
@@ -301,14 +285,12 @@
         return;
     } else {
         lock_basic_lock(&cmdc->engine->zonelist->zl_lock);
-        /* [LOCK] zonelist */
         zone = zonelist_lookup_zone_by_name(cmdc->engine->zonelist, tbd,
             LDNS_RR_CLASS_IN);
         /* If this zone is just added, don't update (it might not have a task yet) */
         if (zone && zone->just_added) {
             zone = NULL;
         }
-        /* [UNLOCK] zonelist */
         lock_basic_unlock(&cmdc->engine->zonelist->zl_lock);
 
         if (!zone) {
@@ -322,7 +304,6 @@
         ods_log_assert(zone->task);
 
         lock_basic_lock(&cmdc->engine->taskq->schedule_lock);
-        /* [LOCK] schedule */
         task = unschedule_task(cmdc->engine->taskq, (task_type*) zone->task);
         if (task != NULL) {
             ods_log_debug("[%s] reschedule task for zone %s", cmdh_str,
@@ -342,23 +323,22 @@
             task->interrupt = TASK_READ;
             /* task->halted set by worker */
         }
-        /* [UNLOCK] schedule */
         lock_basic_unlock(&cmdc->engine->taskq->schedule_lock);
 
         zone->task = task;
         lock_basic_unlock(&zone->zone_lock);
 
         if (status != ODS_STATUS_OK) {
-            (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Cannot schedule task for "
-                "zone %s.\n", tbd);
+            (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Cannot schedule task "
+                "for zone %s.\n", tbd);
             ods_writen(sockfd, buf, strlen(buf));
             ods_log_crit("[%s] cannot schedule task for zone %s: %s",
                 cmdh_str, zone->name, ods_status2str(status));
             task_cleanup(task);
             zone->task = NULL;
         } else {
-            (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s scheduled for immediate "
-                "re-sign.\n", tbd);
+            (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s scheduled for "
+                "immediate re-sign.\n", tbd);
             ods_writen(sockfd, buf, strlen(buf));
             ods_log_verbose("[%s] zone %s scheduled for immediate re-sign",
                 cmdh_str, tbd);
@@ -478,7 +458,6 @@
     time_t now = 0;
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     task_type* task = NULL;
-
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
     if (!cmdc->engine->taskq || !cmdc->engine->taskq->tasks) {
@@ -486,18 +465,14 @@
         ods_writen(sockfd, buf, strlen(buf));
         return;
     }
-
-    lock_basic_lock(&cmdc->engine->taskq->schedule_lock);
-    /* [LOCK] schedule */
-
-    /* time */
+    /* current time */
     now = time_now();
     strtime = ctime(&now);
     (void)snprintf(buf, ODS_SE_MAXLINE, "It is now %s",
         strtime?strtime:"(null)");
     ods_writen(sockfd, buf, strlen(buf));
-
     /* current work */
+    lock_basic_lock(&cmdc->engine->taskq->schedule_lock);
     for (i=0; i < (size_t) cmdc->engine->config->num_worker_threads; i++) {
         task = cmdc->engine->workers[i]->task;
         if (task) {
@@ -508,12 +483,10 @@
             ods_writen(sockfd, buf, strlen(buf));
         }
     }
-
     /* how many tasks */
     (void)snprintf(buf, ODS_SE_MAXLINE, "\nI have %i tasks scheduled.\n",
         (int) cmdc->engine->taskq->tasks->count);
     ods_writen(sockfd, buf, strlen(buf));
-
     /* list tasks */
     node = ldns_rbtree_first(cmdc->engine->taskq->tasks);
     while (node && node != LDNS_RBTREE_NULL) {
@@ -525,8 +498,6 @@
         ods_writen(sockfd, buf, strlen(buf));
         node = ldns_rbtree_next(node);
     }
-
-    /* [UNLOCK] schedule */
     lock_basic_unlock(&cmdc->engine->taskq->schedule_lock);
     return;
 }
@@ -540,19 +511,13 @@
 cmdhandler_handle_cmd_flush(int sockfd, cmdhandler_type* cmdc)
 {
     char buf[ODS_SE_MAXLINE];
-
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
     ods_log_assert(cmdc->engine->taskq);
-
     lock_basic_lock(&cmdc->engine->taskq->schedule_lock);
-    /* [LOCK] schedule */
     schedule_flush(cmdc->engine->taskq, TASK_NONE);
-    /* [UNLOCK] schedule */
     lock_basic_unlock(&cmdc->engine->taskq->schedule_lock);
-
     engine_wakeup_workers(cmdc->engine);
-
     (void)snprintf(buf, ODS_SE_MAXLINE, "All tasks scheduled immediately.\n");
     ods_writen(sockfd, buf, strlen(buf));
     ods_log_verbose("[%s] all tasks scheduled immediately", cmdh_str);
@@ -568,18 +533,12 @@
 cmdhandler_handle_cmd_reload(int sockfd, cmdhandler_type* cmdc)
 {
     char buf[ODS_SE_MAXLINE];
-
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
-
     cmdc->engine->need_to_reload = 1;
-
     lock_basic_lock(&cmdc->engine->signal_lock);
-    /* [LOCK] signal */
     lock_basic_alarm(&cmdc->engine->signal_cond);
-    /* [UNLOCK] signal */
     lock_basic_unlock(&cmdc->engine->signal_lock);
-
     (void)snprintf(buf, ODS_SE_MAXLINE, "Reloading engine.\n");
     ods_writen(sockfd, buf, strlen(buf));
     return;
@@ -594,18 +553,12 @@
 cmdhandler_handle_cmd_stop(int sockfd, cmdhandler_type* cmdc)
 {
     char buf[ODS_SE_MAXLINE];
-
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
-
     cmdc->engine->need_to_exit = 1;
-
     lock_basic_lock(&cmdc->engine->signal_lock);
-    /* [LOCK] signal */
     lock_basic_alarm(&cmdc->engine->signal_cond);
-    /* [UNLOCK] signal */
     lock_basic_unlock(&cmdc->engine->signal_lock);
-
     (void)snprintf(buf, ODS_SE_MAXLINE, ODS_SE_STOP_RESPONSE);
     ods_writen(sockfd, buf, strlen(buf));
     return;
@@ -620,7 +573,6 @@
 cmdhandler_handle_cmd_start(int sockfd)
 {
     char buf[ODS_SE_MAXLINE];
-
     (void)snprintf(buf, ODS_SE_MAXLINE, "Engine already running.\n");
     ods_writen(sockfd, buf, strlen(buf));
     return;
@@ -635,7 +587,6 @@
 cmdhandler_handle_cmd_running(int sockfd)
 {
     char buf[ODS_SE_MAXLINE];
-
     (void)snprintf(buf, ODS_SE_MAXLINE, "Engine running.\n");
     ods_writen(sockfd, buf, strlen(buf));
     return;
@@ -650,16 +601,14 @@
 cmdhandler_handle_cmd_verbosity(int sockfd, cmdhandler_type* cmdc, int val)
 {
     char buf[ODS_SE_MAXLINE];
-
     ods_log_assert(cmdc);
     ods_log_assert(cmdc->engine);
     ods_log_assert(cmdc->engine->config);
-
     ods_log_init(cmdc->engine->config->log_filename,
         cmdc->engine->config->use_syslog, val);
-
     (void)snprintf(buf, ODS_SE_MAXLINE, "Verbosity level set to %i.\n", val);
     ods_writen(sockfd, buf, strlen(buf));
+    return;
 }
 
 
@@ -856,13 +805,10 @@
         ods_log_error("[%s] unable to create: no allocator", cmdh_str);
         return NULL;
     }
-    ods_log_assert(allocator);
-
     if (!filename) {
         ods_log_error("[%s] unable to create: no socket filename", cmdh_str);
         return NULL;
     }
-    ods_log_assert(filename);
     ods_log_debug("[%s] create socket %s", cmdh_str, filename);
 
     /* new socket */
@@ -887,15 +833,13 @@
         close(listenfd);
         return NULL;
     }
-
-    /* no surprises */
+    /* no surprises so far */
     if (filename) {
-        unlink(filename);
+        (void)unlink(filename);
     }
     bzero(&servaddr, sizeof(servaddr));
     servaddr.sun_family = AF_UNIX;
     strncpy(servaddr.sun_path, filename, sizeof(servaddr.sun_path) - 1);
-
     /* bind and listen... */
     ret = bind(listenfd, (const struct sockaddr*) &servaddr,
         SUN_LEN(&servaddr));
@@ -942,11 +886,9 @@
     fd_set rset;
     int connfd = 0;
     int ret = 0;
-
     ods_log_assert(cmdhandler);
     ods_log_assert(cmdhandler->engine);
     ods_log_debug("[%s] start", cmdh_str);
-
     engine = cmdhandler->engine;
     ods_thread_detach(cmdhandler->thread_id);
     FD_ZERO(&rset);
@@ -966,7 +908,7 @@
                 (struct sockaddr *) &cliaddr, &clilen);
             if (connfd < 0) {
                 if (errno != EINTR && errno != EWOULDBLOCK) {
-                    ods_log_warning("[%s] accept error: %s", cmdh_str,
+                    ods_log_warning("[%s] accept() error: %s", cmdh_str,
                         strerror(errno));
                 }
                 continue;
@@ -975,7 +917,7 @@
             cmdc = (cmdhandler_type*) malloc(sizeof(cmdhandler_type));
             if (!cmdc) {
                 ods_log_crit("[%s] unable to create thread for client: "
-                    "malloc failed", cmdh_str);
+                    "malloc() failed", cmdh_str);
                 cmdhandler->need_to_exit = 1;
                 break;
             }
@@ -990,7 +932,6 @@
             ods_log_debug("[%s] %i clients in progress...", cmdh_str, count);
         }
     }
-
     ods_log_debug("[%s] done", cmdh_str);
     engine = cmdhandler->engine;
     engine->cmdhandler_done = 1;

Modified: trunk/OpenDNSSEC/signer/src/daemon/engine.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/engine.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/daemon/engine.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -97,13 +97,11 @@
     engine->daemonize = 0;
     engine->need_to_exit = 0;
     engine->need_to_reload = 0;
-
     lock_basic_init(&engine->signal_lock);
     lock_basic_set(&engine->signal_cond);
     lock_basic_lock(&engine->signal_lock);
     engine->signal = SIGNAL_INIT;
     lock_basic_unlock(&engine->signal_lock);
-
     engine->zonelist = zonelist_create(engine->allocator);
     if (!engine->zonelist) {
         engine_cleanup(engine);
@@ -155,26 +153,23 @@
     int sockfd, ret;
     struct sockaddr_un servaddr;
     const char* servsock_filename = ODS_SE_SOCKFILE;
-
     ods_log_assert(engine);
     ods_log_assert(engine->cmdhandler);
-
     sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
     if (sockfd <= 0) {
-        ods_log_error("[%s] cannot connect to command handler: "
-            "socket() failed: %s\n", engine_str, strerror(errno));
+        ods_log_error("[%s] unable to connect to command handler: "
+            "socket() failed (%s)", engine_str, strerror(errno));
         return 1;
     } else {
         bzero(&servaddr, sizeof(servaddr));
         servaddr.sun_family = AF_UNIX;
         strncpy(servaddr.sun_path, servsock_filename,
             sizeof(servaddr.sun_path) - 1);
-
         ret = connect(sockfd, (const struct sockaddr*) &servaddr,
             sizeof(servaddr));
         if (ret != 0) {
-            ods_log_error("[%s] cannot connect to command handler: "
-                "connect() failed: %s\n", engine_str, strerror(errno));
+            ods_log_error("[%s] unable to connect to command handler: "
+                "connect() failed (%s)", engine_str, strerror(errno));
             close(sockfd);
             return 1;
         } else {
@@ -296,7 +291,6 @@
 engine_start_workers(engine_type* engine)
 {
     size_t i = 0;
-
     ods_log_assert(engine);
     ods_log_assert(engine->config);
     ods_log_debug("[%s] start workers", engine_str);
@@ -312,7 +306,6 @@
 engine_start_drudgers(engine_type* engine)
 {
     size_t i = 0;
-
     ods_log_assert(engine);
     ods_log_assert(engine->config);
     ods_log_debug("[%s] start drudgers", engine_str);
@@ -328,7 +321,6 @@
 engine_stop_workers(engine_type* engine)
 {
     size_t i = 0;
-
     ods_log_assert(engine);
     ods_log_assert(engine->config);
     ods_log_debug("[%s] stop workers", engine_str);
@@ -349,7 +341,6 @@
 engine_stop_drudgers(engine_type* engine)
 {
     size_t i = 0;
-
     ods_log_assert(engine);
     ods_log_assert(engine->config);
     ods_log_debug("[%s] stop drudgers", engine_str);
@@ -358,7 +349,6 @@
         engine->drudgers[i]->need_to_exit = 1;
     }
     worker_notify_all(&engine->signq->q_lock, &engine->signq->q_threshold);
-
     /* head count */
     for (i=0; i < (size_t) engine->config->num_signer_threads; i++) {
         ods_log_debug("[%s] join drudger %i", engine_str, i+1);
@@ -377,7 +367,6 @@
 engine_wakeup_workers(engine_type* engine)
 {
     size_t i = 0;
-
     ods_log_assert(engine);
     ods_log_assert(engine->config);
     ods_log_debug("[%s] wake up workers", engine_str);
@@ -576,7 +565,6 @@
     if (!engine || !engine->config) {
         return ODS_STATUS_ASSERT_ERR;
     }
-
     /* create command handler (before chowning socket file) */
     engine->cmdhandler = cmdhandler_create(engine->allocator,
         engine->config->clisock_filename);
@@ -585,20 +573,17 @@
             engine_str, engine->config->clisock_filename);
         return ODS_STATUS_CMDHANDLER_ERR;
     }
-
     /* fork of fetcher */
     if (start_zonefetcher(engine) != 0) {
         ods_log_error("[%s] cannot start zonefetcher", engine_str);
         return ODS_STATUS_ERR;
     }
-
     /* initialize adapters */
     status = engine_init_adapters(engine);
     if (status != ODS_STATUS_OK) {
         ods_log_error("[%s] initializing adapters failed", engine_str);
         return status;
     }
-
     /* privdrop */
     engine->uid = privuid(engine->config->username);
     engine->gid = privgid(engine->config->group);
@@ -620,7 +605,6 @@
         ods_log_error("[%s] unable to drop privileges", engine_str);
         return ODS_STATUS_PRIVDROP_ERR;
     }
-
     /* daemonize */
     if (engine->daemonize) {
         switch ((engine->pid = fork())) {
@@ -647,7 +631,6 @@
     engine->pid = getpid();
     ods_log_verbose("[%s] running as pid %lu", engine_str,
         (unsigned long) engine->pid);
-
     /* catch signals */
     signal_set_engine(engine);
     action.sa_handler = signal_handler;
@@ -655,7 +638,6 @@
     action.sa_flags = 0;
     sigaction(SIGHUP, &action, NULL);
     sigaction(SIGTERM, &action, NULL);
-
     /* set up hsm */ /* LEAK */
     result = hsm_open(engine->config->cfg_filename, hsm_prompt_pin, NULL);
     if (result != HSM_OK) {
@@ -668,14 +650,11 @@
             engine_str, result);
         return ODS_STATUS_HSM_ERR;
     }
-
     /* create workers */
     engine_create_workers(engine);
     engine_create_drudgers(engine);
-
     /* start command handler */
     engine_start_cmdhandler(engine);
-
     /* write pidfile */
     if (util_write_pidfile(engine->config->pid_filename, engine->pid) == -1) {
         hsm_close();
@@ -723,20 +702,15 @@
     if (!engine) {
         return;
     }
-    ods_log_assert(engine);
-
     engine_start_workers(engine);
     engine_start_drudgers(engine);
 
     lock_basic_lock(&engine->signal_lock);
-    /* [LOCK] signal */
     engine->signal = SIGNAL_RUN;
-    /* [UNLOCK] signal */
     lock_basic_unlock(&engine->signal_lock);
 
     while (!engine->need_to_exit && !engine->need_to_reload) {
         lock_basic_lock(&engine->signal_lock);
-        /* [LOCK] signal */
         engine->signal = signal_capture(engine->signal);
         switch (engine->signal) {
             case SIGNAL_RUN:
@@ -754,7 +728,6 @@
                 engine->signal = SIGNAL_RUN;
                 break;
         }
-        /* [UNLOCK] signal */
         lock_basic_unlock(&engine->signal_lock);
 
         if (single_run) {
@@ -762,12 +735,10 @@
         }
 
         lock_basic_lock(&engine->signal_lock);
-        /* [LOCK] signal */
         if (engine->signal == SIGNAL_RUN && !single_run) {
            ods_log_debug("[%s] taking a break", engine_str);
            lock_basic_sleep(&engine->signal_cond, &engine->signal_lock, 3600);
         }
-        /* [UNLOCK] signal */
         lock_basic_unlock(&engine->signal_lock);
     }
     ods_log_debug("[%s] signer halted", engine_str);
@@ -826,15 +797,11 @@
             engine_str);
         return;
     }
-    ods_log_assert(engine);
-    ods_log_assert(engine->zonelist);
-    ods_log_assert(engine->zonelist->zones);
 
     now = time_now();
     reload_zonefetcher(engine);
 
     lock_basic_lock(&engine->zonelist->zl_lock);
-    /* [LOCK] zonelist */
     node = ldns_rbtree_first(engine->zonelist->zones);
     while (node && node != LDNS_RBTREE_NULL) {
         zone = (zone_type*) node->data;
@@ -842,23 +809,17 @@
 
         if (zone->tobe_removed) {
             node = ldns_rbtree_next(node);
-
             lock_basic_lock(&zone->zone_lock);
-            /* [LOCK] zone */
             delzone = zonelist_del_zone(engine->zonelist, zone);
             if (delzone) {
                 lock_basic_lock(&engine->taskq->schedule_lock);
-                /* [LOCK] schedule */
                 task = unschedule_task(engine->taskq,
                     (task_type*) zone->task);
-                /* [UNLOCK] schedule */
                 lock_basic_unlock(&engine->taskq->schedule_lock);
             }
             task_cleanup(task);
             task = NULL;
-            /* [UNLOCK] zone */
             lock_basic_unlock(&zone->zone_lock);
-
             zone_cleanup(zone);
             zone = NULL;
             continue;
@@ -878,9 +839,7 @@
                     engine_str, zone->name);
             } else {
                 lock_basic_lock(&engine->taskq->schedule_lock);
-                /* [LOCK] schedule */
                 status = schedule_task(engine->taskq, task, 0);
-                /* [UNLOCK] schedule */
                 lock_basic_unlock(&engine->taskq->schedule_lock);
                 wake_up = 1;
            }
@@ -893,7 +852,6 @@
             zone->just_updated = 0;
             /* reschedule task */
             lock_basic_lock(&engine->taskq->schedule_lock);
-            /* [LOCK] schedule */
             task = unschedule_task(engine->taskq, (task_type*) zone->task);
             if (task != NULL) {
                 ods_log_debug("[%s] reschedule task for zone %s", engine_str,
@@ -913,13 +871,10 @@
                 task->interrupt = TASK_SIGNCONF;
                 /* task->halted set by worker */
             }
-            /* [UNLOCK] schedule */
             lock_basic_unlock(&engine->taskq->schedule_lock);
             lock_basic_unlock(&zone->zone_lock);
-
             wake_up = 1;
         }
-
         zone->task = task;
         if (status != ODS_STATUS_OK) {
             ods_log_crit("[%s] failed to schedule task for zone %s: %s",
@@ -929,7 +884,6 @@
         }
         node = ldns_rbtree_next(node);
     }
-    /* [UNLOCK] zonelist */
     lock_basic_unlock(&engine->zonelist->zl_lock);
     if (wake_up) {
         engine_wakeup_workers(engine);
@@ -1077,13 +1031,11 @@
     while (engine->need_to_exit == 0) {
         /* update zone list */
         lock_basic_lock(&engine->zonelist->zl_lock);
-        /* [LOCK] zonelist */
         zl_changed = zonelist_update(engine->zonelist,
             engine->config->zonelist_filename);
         engine->zonelist->just_removed = 0;
         engine->zonelist->just_added = 0;
         engine->zonelist->just_updated = 0;
-        /* [UNLOCK] zonelist */
         lock_basic_unlock(&engine->zonelist->zl_lock);
 
         if (engine->need_to_reload) {
@@ -1093,7 +1045,6 @@
             ods_log_info("[%s] signer started", engine_str);
             zl_changed = engine_recover(engine);
         }
-
         /* update zones */
         if (zl_changed == ODS_STATUS_OK) {
             ods_log_debug("[%s] commit zone list changes", engine_str);
@@ -1101,7 +1052,7 @@
             ods_log_debug("[%s] signer configurations updated", engine_str);
             zl_changed = ODS_STATUS_UNCHANGED;
         }
-
+        /* run */
         engine_run(engine, single_run);
     }
 
@@ -1145,14 +1096,12 @@
     allocator_type* allocator;
     cond_basic_type signal_cond;
     lock_basic_type signal_lock;
-
     if (!engine) {
         return;
     }
     allocator = engine->allocator;
     signal_cond = engine->signal_cond;
     signal_lock = engine->signal_lock;
-
     if (engine->workers && engine->config) {
         for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
             worker_cleanup(engine->workers[i]);
@@ -1171,7 +1120,6 @@
     cmdhandler_cleanup(engine->cmdhandler);
     engine_config_cleanup(engine->config);
     allocator_deallocate(allocator, (void*) engine);
-
     lock_basic_destroy(&signal_lock);
     lock_basic_off(&signal_cond);
     allocator_cleanup(allocator);

Modified: trunk/OpenDNSSEC/signer/src/daemon/signal.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/signal.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/daemon/signal.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -53,6 +53,7 @@
 signal_set_engine(struct engine_struct* engine)
 {
     signal_engine = (engine_type*) engine;
+    return;
 }
 
 

Modified: trunk/OpenDNSSEC/signer/src/parser/confparser.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/parser/confparser.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/parser/confparser.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -64,11 +64,8 @@
         ods_log_error("[%s] no cfgfile or rngfile", parser_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(cfgfile);
-    ods_log_assert(rngfile);
     ods_log_debug("[%s] check cfgfile %s with rngfile %s", parser_str,
         cfgfile, rngfile);
-
     /* Load XML document */
     doc = xmlParseFile(cfgfile);
     if (doc == NULL) {
@@ -154,11 +151,9 @@
     adapter_type** adapters = NULL;
     int ret = 0;
     size_t adcount = 0;
-
     xmlTextReaderPtr reader = NULL;
     xmlDocPtr doc = NULL;
     xmlXPathContextPtr xpathCtx = NULL;
-
     xmlChar* expr = (xmlChar*) "//Adapter";
 
     ods_log_assert(allocator);
@@ -169,7 +164,6 @@
         ods_log_error("[%s] unable to open file %s", parser_str, cfgfile);
         return NULL;
     }
-
     ret = xmlTextReaderRead(reader);
     adapters = (adapter_type**) allocator_alloc(allocator,
         ADMAX * sizeof(adapter_type*));
@@ -179,9 +173,7 @@
                 "skipping additional adapters", parser_str, cfgfile);
             break;
         }
-
         tag_name = (char*) xmlTextReaderLocalName(reader);
-
         /* This assumes that there is no other <Adapters> element in
          * conf.xml
          */

Modified: trunk/OpenDNSSEC/signer/src/parser/signconfparser.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/parser/signconfparser.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/parser/signconfparser.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -143,7 +143,6 @@
             free((void*)flags);
         }
     }
-
     xmlXPathFreeObject(xpathObj);
     xmlXPathFreeContext(xpathCtx);
     if (doc) {

Modified: trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -35,9 +35,9 @@
 #include "parser/zonelistparser.h"
 #include "shared/file.h"
 #include "shared/log.h"
+#include "shared/status.h"
 #include "signer/zonelist.h"
 #include "signer/zone.h"
-#include "shared/status.h"
 
 #include <libxml/xpath.h>
 #include <libxml/xmlreader.h>
@@ -88,7 +88,6 @@
             inbound?"input":"output");
         return NULL;
     }
-
     adapter = adapter_create(file, type, inbound);
     free((void*)file);
     return adapter;
@@ -111,14 +110,12 @@
     if (!xpathCtx || !expr) {
         return NULL;
     }
-
     xpathObj = xmlXPathEvalExpression(expr, xpathCtx);
     if (xpathObj == NULL) {
         ods_log_error("[%s] unable to evaluate xpath expression %s",
             parser_str, expr);
         return NULL;
     }
-
     if (xpathObj->nodesetval) {
         for (i=0; i < xpathObj->nodesetval->nodeNr; i++) {
             curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
@@ -151,7 +148,6 @@
     if (!xpathCtx || !zone) {
         return;
     }
-
     zone->adinbound  = parse_zonelist_adapter(xpathCtx, i_expr, 1);
     zone->adoutbound = parse_zonelist_adapter(xpathCtx, o_expr, 0);
     return;
@@ -169,11 +165,9 @@
     char* zone_name = NULL;
     zone_type* new_zone = NULL;
     int ret = 0;
-
     xmlTextReaderPtr reader = NULL;
     xmlDocPtr doc = NULL;
     xmlXPathContextPtr xpathCtx = NULL;
-
     xmlChar* name_expr = (unsigned char*) "name";
     xmlChar* policy_expr = (unsigned char*) "//Zone/Policy";
     xmlChar* signconf_expr = (unsigned char*) "//Zone/SignerConfiguration";
@@ -217,7 +211,6 @@
                 ret = xmlTextReaderRead(reader);
                 continue;
             }
-
             /* Expand this node to get the rest of the info */
             xmlTextReaderExpand(reader);
             doc = xmlTextReaderCurrentDoc(reader);
@@ -236,7 +229,6 @@
                 }
                 continue;
             }
-
             /* That worked, now read out the contents... */
             new_zone = zone_create(zone_name, LDNS_RR_CLASS_IN);
             new_zone->policy_name = parse_zonelist_element(xpathCtx,

Modified: trunk/OpenDNSSEC/signer/src/scheduler/fifoq.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/scheduler/fifoq.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/scheduler/fifoq.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -55,15 +55,11 @@
             fifoq_str);
         return NULL;
     }
-    ods_log_assert(allocator);
-
     fifoq = (fifoq_type*) allocator_alloc(allocator, sizeof(fifoq_type));
     if (!fifoq) {
         ods_log_error("[%s] unable to create: allocator failed", fifoq_str);
         return NULL;
     }
-    ods_log_assert(fifoq);
-
     fifoq->allocator = allocator;
     fifoq_wipe(fifoq);
     lock_basic_init(&fifoq->q_lock);
@@ -80,7 +76,6 @@
 fifoq_wipe(fifoq_type* q)
 {
     size_t i = 0;
-
     for (i=0; i < FIFOQ_MAX_COUNT; i++) {
         q->blob[i] = NULL;
         q->owner[i] = NULL;
@@ -99,14 +94,12 @@
 {
     void* pop = NULL;
     size_t i = 0;
-
     if (!q) {
         return NULL;
     }
     if (q->count <= 0) {
         return NULL;
     }
-
     pop = q->blob[0];
     *worker = q->owner[0];
     for (i = 0; i < q->count-1; i++) {
@@ -127,29 +120,23 @@
 fifoq_push(fifoq_type* q, void* item, worker_type* worker)
 {
     size_t count = 0;
-
     if (!item) {
         ods_log_error("[%s] unable to push item: no item", fifoq_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(item);
     if (!q) {
         ods_log_error("[%s] unable to push item: no queue", fifoq_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(q);
-
     if (q->count >= FIFOQ_MAX_COUNT) {
         ods_log_deeebug("[%s] unable to push item: max cap reached",
             fifoq_str);
         return ODS_STATUS_UNCHANGED;
     }
     count = q->count;
-
     q->blob[q->count] = item;
     q->owner[q->count] = worker;
     q->count += 1;
-
     if (count == 0 && q->count == 1) {
         lock_basic_broadcast(&q->q_threshold);
         ods_log_deeebug("[%s] threshold %u reached, notify drudgers",
@@ -169,15 +156,12 @@
     allocator_type* allocator;
     lock_basic_type q_lock;
     cond_basic_type q_cond;
-
     if (!q) {
         return;
     }
-    ods_log_assert(q);
     allocator = q->allocator;
     q_lock = q->q_lock;
     q_cond = q->q_threshold;
-
     allocator_deallocate(allocator, (void*) q);
     lock_basic_off(&q_cond);
     lock_basic_destroy(&q_lock);

Modified: trunk/OpenDNSSEC/signer/src/scheduler/schedule.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/scheduler/schedule.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/scheduler/schedule.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -56,16 +56,12 @@
             schedule_str);
         return NULL;
     }
-    ods_log_assert(allocator);
-
     schedule = (schedule_type*) allocator_alloc(allocator,
         sizeof(schedule_type));
     if (!schedule) {
         ods_log_error("[%s] unable to create: allocator failed", schedule_str);
         return NULL;
     }
-    ods_log_assert(schedule);
-
     schedule->allocator = allocator;
     schedule->loading = 0;
     schedule->flushcount = 0;
@@ -89,9 +85,6 @@
     if (!schedule || !schedule->tasks) {
         return;
     }
-    ods_log_assert(schedule);
-    ods_log_assert(schedule->tasks);
-
     node = ldns_rbtree_first(schedule->tasks);
     while (node && node != LDNS_RBTREE_NULL) {
         task = (task_type*) node->data;
@@ -129,14 +122,10 @@
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     task_type* lookup = NULL;
-
     if (!schedule || !task) {
         return NULL;
     }
-    ods_log_assert(task);
-    ods_log_assert(schedule);
     ods_log_assert(schedule->tasks);
-
     node = ldns_rbtree_search(schedule->tasks, task);
     if (node && node != LDNS_RBTREE_NULL) {
         lookup = (task_type*) node->data;
@@ -159,13 +148,11 @@
         ods_log_error("[%s] unable to schedule task: no task", schedule_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(task);
     if (!schedule) {
         ods_log_error("[%s] unable to schedule task: no schedule",
             schedule_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(schedule);
     ods_log_assert(schedule->tasks);
 
     ods_log_debug("[%s] schedule task %s for zone %s", schedule_str,
@@ -209,13 +196,11 @@
         /* we are done */
         return NULL;
     }
-    ods_log_assert(task);
     if (!schedule) {
         ods_log_error("[%s] unable to unschedule task: no schedule",
             schedule_str);
         return NULL;
     }
-    ods_log_assert(schedule);
     ods_log_assert(schedule->tasks);
 
     ods_log_debug("[%s] unschedule task %s for zone %s",
@@ -251,7 +236,6 @@
     if (!task) {
         return ODS_STATUS_ASSERT_ERR;
     }
-
     del_task = unschedule_task(schedule, task);
     if (!del_task) {
         del_task = task;
@@ -276,14 +260,12 @@
     if (!schedule) {
         return NULL;
     }
-    ods_log_assert(schedule);
     ods_log_assert(schedule->tasks);
 
     first_node = ldns_rbtree_first(schedule->tasks);
     if (!first_node) {
         return NULL;
     }
-
     if (schedule->flushcount > 0) {
         /* find remaining to be flushed tasks */
         node = first_node;
@@ -295,7 +277,7 @@
             node = ldns_rbtree_next(node);
         }
         /* no more to be flushed tasks found */
-        ods_log_warning("[%s] unable to get first scheduled: could not "
+        ods_log_warning("[%s] unable to get first scheduled task: could not "
             "find flush-task, while there should be %i flush-tasks left",
             schedule_str, schedule->flushcount);
         ods_log_info("[%s] reset flush count to 0", schedule_str);
@@ -321,7 +303,6 @@
         ods_log_error("[%s] unable to pop task: no schedule", schedule_str);
         return NULL;
     }
-    ods_log_assert(schedule);
     ods_log_assert(schedule->tasks);
 
     now = time_now();
@@ -353,10 +334,6 @@
     if (!out || !schedule || !schedule->tasks) {
         return;
     }
-    ods_log_assert(out);
-    ods_log_assert(schedule);
-    ods_log_assert(schedule->tasks);
-
     node = ldns_rbtree_first(schedule->tasks);
     while (node && node != LDNS_RBTREE_NULL) {
         task = (task_type*) node->data;
@@ -407,10 +384,8 @@
         ldns_rbtree_free(schedule->tasks);
         schedule->tasks = NULL;
     }
-
     allocator = schedule->allocator;
     schedule_lock = schedule->schedule_lock;
-
     allocator_deallocate(allocator, (void*) schedule);
     lock_basic_destroy(&schedule_lock);
     return;

Modified: trunk/OpenDNSSEC/signer/src/scheduler/task.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/scheduler/task.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/scheduler/task.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -202,7 +202,6 @@
         /* if dname is the same, consider the same task */
         return 0;
     }
-
     /* order task on time, what to do, dname */
     if (x->when != y->when) {
         return (int) x->when - y->when;

Modified: trunk/OpenDNSSEC/signer/src/shared/file.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/shared/file.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/shared/file.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -361,11 +361,9 @@
     char str[SYSTEM_MAXLEN];
     FILE* fd = NULL;
     int retval = 0;
-
     if (!file1 || !file2) {
         return ODS_STATUS_ASSERT_ERR;
     }
-
     if ((fd = ods_fopen(file1, NULL, "r")) != NULL) {
         ods_fclose(fd);
         snprintf(str, SYSTEM_MAXLEN, "%s %s %s > /dev/null",

Modified: trunk/OpenDNSSEC/signer/src/shared/hsm.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/shared/hsm.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/shared/hsm.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -51,9 +51,6 @@
             hsm_str);
         return ODS_STATUS_ASSERT_ERR;
     }
-    ods_log_assert(owner);
-    ods_log_assert(key_id);
-
     /* set parameters */
     if (!key_id->params) {
         key_id->params = hsm_sign_params_new();
@@ -73,7 +70,6 @@
             return ODS_STATUS_ERR;
         }
     }
-
     /* lookup key */
     if (!key_id->hsmkey) {
         key_id->hsmkey = hsm_find_key_by_id(ctx, key_id->locator);
@@ -89,7 +85,6 @@
             key_id->locator?key_id->locator:"(null)");
         return ODS_STATUS_ERR;
     }
-
     /* get dnskey */
     if (!key_id->dnskey) {
         key_id->dnskey = hsm_get_dnskey(ctx, key_id->hsmkey, key_id->params);
@@ -126,12 +121,7 @@
             hsm_str);
         return NULL;
     }
-    ods_log_assert(owner);
-    ods_log_assert(key_id);
-    ods_log_assert(rrset);
-    ods_log_assert(inception);
-    ods_log_assert(expiration);
-
+    /* get dnskey */
     if (!key_id->dnskey) {
         status = lhsm_get_key(ctx, owner, key_id);
         if (status != ODS_STATUS_OK) {
@@ -147,7 +137,7 @@
     ods_log_assert(key_id->dnskey);
     ods_log_assert(key_id->hsmkey);
     ods_log_assert(key_id->params);
-
+    /* adjust parameters */
     params = hsm_sign_params_new();
     params->owner = ldns_rdf_clone(key_id->params->owner);
     params->algorithm = key_id->algorithm;
@@ -160,7 +150,6 @@
         key_id->locator?key_id->locator:"(null)", params->keytag);
     result = hsm_sign_rrset(ctx, rrset, key_id->hsmkey, params);
     hsm_sign_params_free(params);
-
     if (!result) {
         error = hsm_get_error(ctx);
         if (error) {

Modified: trunk/OpenDNSSEC/signer/src/shared/util.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/shared/util.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/shared/util.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -50,11 +50,9 @@
 util_is_dnssec_rr(ldns_rr* rr)
 {
     ldns_rr_type type = 0;
-
     if (!rr) {
         return 0;
     }
-
     type = ldns_rr_get_type(rr);
     return (type == LDNS_RR_TYPE_RRSIG ||
             type == LDNS_RR_TYPE_NSEC ||
@@ -72,7 +70,6 @@
 {
     size_t i = 0;
     size_t rdata_count = SE_SOA_RDATA_MINIMUM;
-
     for (i = 0; i <= rdata_count; i++) {
         if (i != SE_SOA_RDATA_SERIAL &&
             ldns_rdf_compare(ldns_rr_rdf(rr1, i), ldns_rr_rdf(rr2, i)) != 0) {
@@ -93,11 +90,9 @@
     size_t rr1_len = 0;
     size_t rr2_len = 0;
     size_t offset = 0;
-
     if (!rr1 || !rr2) {
         return 1;
     }
-
     rr1_len = ldns_rr_uncompressed_size(rr1);
     rr2_len = ldns_rr_uncompressed_size(rr2);
     if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) != 0) {
@@ -118,7 +113,6 @@
         }
         return 1;
     }
-
     return util_soa_compare_rdata(rr1, rr2);
 }
 
@@ -140,12 +134,10 @@
     if (!rr1 || !rr2) {
         return LDNS_STATUS_ERR;
     }
-
     rr1_len = ldns_rr_uncompressed_size(rr1);
     rr2_len = ldns_rr_uncompressed_size(rr2);
     rr1_buf = ldns_buffer_new(rr1_len);
     rr2_buf = ldns_buffer_new(rr2_len);
-
     /* name, class and type should already be equal */
     status = ldns_rr2buffer_wire_canonical(rr1_buf, rr1, LDNS_SECTION_ANY);
     if (status != LDNS_STATUS_OK) {

Modified: trunk/OpenDNSSEC/signer/src/signer/denial.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/denial.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/signer/denial.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -106,6 +106,7 @@
     domain_type* domain = NULL;
     rrset_type* rrset = NULL;
 
+    ods_log_assert(denial);
     ods_log_assert(denial->domain);
 
     domain = (domain_type*) denial->domain;

Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.c	2011-08-22 14:23:56 UTC (rev 5439)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.c	2011-08-23 08:35:48 UTC (rev 5440)
@@ -1125,7 +1125,7 @@
     }
     ods_log_assert(q);
 
-    while (status == ODS_STATUS_UNCHANGED) {
+    while (status == ODS_STATUS_UNCHANGED && !worker->need_to_exit) {
         lock_basic_lock(&q->q_lock);
         status = fifoq_push(q, (void*) rrset, worker);
         lock_basic_unlock(&q->q_lock);




More information about the Opendnssec-commits mailing list