[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3702 - in trunk/OpenDNSSEC: . signer/src signer/src/adapter signer/src/daemon signer/src/parser signer/src/scheduler signer/src/signer signer/src/tools signer/src/util

Matthijs Mekking matthijs at nlnetlabs.nl
Tue Aug 10 13:05:04 CEST 2010


Author: matthijs
Date: 2010-08-10 13:05:04 +0200 (Tue, 10 Aug 2010)
New Revision: 3702

Modified:
   trunk/OpenDNSSEC/configure.ac
   trunk/OpenDNSSEC/signer/src/adapter/adfile.c
   trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c
   trunk/OpenDNSSEC/signer/src/daemon/config.c
   trunk/OpenDNSSEC/signer/src/daemon/engine.c
   trunk/OpenDNSSEC/signer/src/daemon/worker.c
   trunk/OpenDNSSEC/signer/src/ods-signerd.c
   trunk/OpenDNSSEC/signer/src/parser/confparser.c
   trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c
   trunk/OpenDNSSEC/signer/src/scheduler/task.c
   trunk/OpenDNSSEC/signer/src/signer/domain.c
   trunk/OpenDNSSEC/signer/src/signer/hsm.c
   trunk/OpenDNSSEC/signer/src/signer/nsec3params.c
   trunk/OpenDNSSEC/signer/src/signer/rrset.c
   trunk/OpenDNSSEC/signer/src/signer/se_key.c
   trunk/OpenDNSSEC/signer/src/signer/signconf.c
   trunk/OpenDNSSEC/signer/src/signer/stats.c
   trunk/OpenDNSSEC/signer/src/signer/tools.c
   trunk/OpenDNSSEC/signer/src/signer/zone.c
   trunk/OpenDNSSEC/signer/src/signer/zonedata.c
   trunk/OpenDNSSEC/signer/src/signer/zonelist.c
   trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c
   trunk/OpenDNSSEC/signer/src/util/duration.c
   trunk/OpenDNSSEC/signer/src/util/file.c
   trunk/OpenDNSSEC/signer/src/util/log.c
   trunk/OpenDNSSEC/signer/src/util/privdrop.c
Log:
printf(3) should not be fed NULL pointers (http://www.pivotaltracker.com/story/show/4637168)

fill PACKAGE_BUGREPORT in configure.ac



Modified: trunk/OpenDNSSEC/configure.ac
===================================================================
--- trunk/OpenDNSSEC/configure.ac	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/configure.ac	2010-08-10 11:05:04 UTC (rev 3702)
@@ -3,7 +3,7 @@
 m4_sinclude([version.m4])
 
 AC_PREREQ(2.61)
-AC_INIT([opendnssec], OPENDNSSEC_VERSION)
+AC_INIT([opendnssec], OPENDNSSEC_VERSION, [http://trac.opendnssec.org/newticket])
 
 AM_INIT_AUTOMAKE
 AC_CONFIG_MACRO_DIR([m4])

Modified: trunk/OpenDNSSEC/signer/src/adapter/adfile.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -121,7 +121,7 @@
         if (c == EOF) {
             if (depth != 0) {
                 se_log_error("read line: bracket mismatch discovered at "
-                    "line %i, missing ')'", *l);
+                    "line %i, missing ')'", l&&*l?*l:0);
             }
             if (li > 0) {
                 line[li] = '\0';
@@ -152,7 +152,7 @@
             } else if (lc != '\\') {
                 if (depth < 1) {
                     se_log_error("read line: bracket mismatch discovered at "
-                        "line %i, missing '('", *l);
+                        "line %i, missing '('", l&&*l?*l:0);
                     line[li] = '\0';
                     return li;
                 }
@@ -190,7 +190,7 @@
     /* done */
     if (depth != 0) {
         se_log_error("read line: bracket mismatch discovered at line %i, "
-            "missing ')'", *l);
+            "missing ')'", l&&*l?*l:0);
         return li;
     }
     line[li] = '\0';
@@ -294,13 +294,14 @@
                         se_fclose(fd_include);
                     } else {
                         se_log_error("unable to open include file '%s'",
-                            line + 9);
+                            (line+9)?(line+9):"(null)");
                         *status = LDNS_STATUS_SYNTAX_ERR;
                         return NULL;
                     }
                     if (error) {
                         *status = LDNS_STATUS_ERR;
-                        se_log_error("error in include file '%s'", line + 9);
+                        se_log_error("error in include file '%s'",
+                            (line+9)?(line+9):"(null)");
                         return NULL;
                     }
                     goto adfile_read_line; /* perhaps next line is rr */
@@ -335,8 +336,9 @@
                     goto adfile_read_line; /* perhaps next line is rr */
                     break;
                 } else {
-                    se_log_error("error parsing RR at line %i (%s): %s", *l,
-                        ldns_get_errorstr_by_id(*status), line);
+                    se_log_error("error parsing RR at line %i (%s): %s",
+                        l&&*l?*l:0, ldns_get_errorstr_by_id(*status),
+                        line?line:"(null)");
                     while (len >= 0) {
                         len = adfile_read_line(fd, line, l);
                     }
@@ -427,8 +429,7 @@
         /* add to the zonedata */
         result = zone_add_rr(zone_in, rr);
         if (result != 0) {
-            se_log_error("error adding RR at line %i: %s", l,
-               line);
+            se_log_error("error adding RR at line %i: %s", l, line);
             break;
         }
         zone_in->stats->sort_count += 1;
@@ -472,12 +473,13 @@
     se_log_assert(zone_in->name);
     se_log_assert(filename);
     se_log_debug("read zone %s from file %s",
-        zone_in->name, filename);
+        zone_in->name?zone_in->name:"(null)", filename?filename:"(null)");
 
     /* remove current rrs */
     error = zonedata_del_rrs(zone_in->zonedata);
     if (error) {
-        se_log_error("error removing current RRs in zone %s", zone_in->name);
+        se_log_error("error removing current RRs in zone %s",
+            zone_in->name?zone_in->name:"(null)");
         return error;
     }
 
@@ -490,8 +492,9 @@
         error = 1;
     }
     if (error) {
-        se_log_error("error reading from input file adapter zone %s file %s",
-            zone_in->name, filename);
+        se_log_error("error reading zone %s from file %s",
+            zone_in->name?zone_in->name:"(null)",
+            filename?filename:"(null)");
     }
     return error;
 }
@@ -509,13 +512,16 @@
 
     se_log_assert(zone_out);
     se_log_assert(zone_out->name);
-    se_log_assert(zone_out->outbound_adapter);
-    se_log_debug("write to output file adapter zone %s file %s",
-        zone_out->name, zone_out->outbound_adapter->filename);
 
-    if (filename != NULL) {
+    if (filename) {
+        se_log_debug("write zone %s to file %s",
+            zone_out->name, filename);
         fd = se_fopen(filename, NULL, "w");
     } else {
+        se_log_assert(zone_out->outbound_adapter);
+        se_log_debug("write zone %s to output file adapter %s",
+            zone_out->name,
+            zone_out->outbound_adapter->filename?zone_out->outbound_adapter->filename:"(null)");
         fd = se_fopen(zone_out->outbound_adapter->filename, NULL, "w");
     }
     if (fd) {
@@ -524,4 +530,3 @@
     }
     return 0;
 }
-

Modified: trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/daemon/cmdhandler.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -130,7 +130,8 @@
         for (i=0; i < ODS_SE_MAXLINE; i++) {
             buf[i] = 0;
         }
-        (void)snprintf(buf, ODS_SE_MAXLINE, "- %s\n", zone->name);
+        (void)snprintf(buf, ODS_SE_MAXLINE, "- %s\n",
+            zone->name?zone->name:"(null)");
         se_writen(sockfd, buf, strlen(buf));
         node = ldns_rbtree_next(node);
     }
@@ -234,7 +235,7 @@
         }
     } else if (found && scheduled) {
         (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s scheduled for "
-            "immediate re-sign.\n", tbd);
+            "immediate re-sign.\n", tbd?tbd:"(null)");
         se_writen(sockfd, buf, strlen(buf));
 
         /* wake up sleeping workers */
@@ -243,11 +244,11 @@
         }
     } else if (found && !scheduled) {
         (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s not scheduled, "
-            "already being signed right now!\n", tbd);
+            "already being signed right now!\n", tbd?tbd:"(null)");
         se_writen(sockfd, buf, strlen(buf));
     } else {
         (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s not being signed yet, "
-            "updating sign configuration\n", tbd);
+            "updating sign configuration\n", tbd?tbd:"(null)");
         se_writen(sockfd, buf, strlen(buf));
         cmdhandler_handle_cmd_update(sockfd, cmdc, tbd);
     }
@@ -290,7 +291,7 @@
 
 
     (void)snprintf(buf, ODS_SE_MAXLINE, "Internal information about "
-        "%s cleared", tbd);
+        "%s cleared", tbd?tbd:"(null)");
     se_writen(sockfd, buf, strlen(buf));
 
     return;
@@ -323,7 +324,8 @@
     now = time_now();
     strtime = ctime(&now);
     (void)snprintf(buf, ODS_SE_MAXLINE, "I have %i tasks scheduled\nIt is "
-        "now %s", (int) cmdc->engine->tasklist->tasks->count, strtime);
+        "now %s", (int) cmdc->engine->tasklist->tasks->count,
+        strtime?strtime:"(null)");
     se_writen(sockfd, buf, strlen(buf));
 
     /* list tasks */
@@ -464,7 +466,7 @@
 cmdhandler_handle_cmd_error(int sockfd, const char* str)
 {
     char buf[ODS_SE_MAXLINE];
-    (void)snprintf(buf, ODS_SE_MAXLINE, "Error: %s.\n", str);
+    (void)snprintf(buf, ODS_SE_MAXLINE, "Error: %s.\n", str?str:"(null)");
     se_writen(sockfd, buf, strlen(buf));
     return;
 }
@@ -478,7 +480,8 @@
 cmdhandler_handle_cmd_unknown(int sockfd, const char* str)
 {
     char buf[ODS_SE_MAXLINE];
-    (void)snprintf(buf, ODS_SE_MAXLINE, "Unknown command %s.\n", str);
+    (void)snprintf(buf, ODS_SE_MAXLINE, "Unknown command %s.\n",
+        str?str:"(null)");
     se_writen(sockfd, buf, strlen(buf));
     return;
 }
@@ -520,7 +523,7 @@
         if (n <= 0) {
             return;
         }
-        se_log_verbose("received command %s[%i]", buf, n);
+        se_log_verbose("received command %s[%i]", buf?buf:"(null)", n);
 
         if (n == 4 && strncmp(buf, "help", n) == 0) {
             se_log_debug("help command");
@@ -589,7 +592,7 @@
             cmdhandler_handle_cmd_unknown(sockfd, buf);
         }
 
-        se_log_debug("done handling command %s[%i]", buf, n);
+        se_log_debug("done handling command %s[%i]", buf?buf:"(null)", n);
         (void)snprintf(buf, SE_CMDH_CMDLEN, "\ncmd> ");
         se_writen(sockfd, buf, strlen(buf));
     }
@@ -639,7 +642,8 @@
     int ret = 0;
 
     se_log_assert(filename);
-    se_log_debug("create command handler to socket %s", filename);
+    se_log_debug("create command handler to socket %s",
+        filename?filename:"(null)");
 
     /* new socket */
     listenfd = socket(AF_UNIX, SOCK_STREAM, 0);

Modified: trunk/OpenDNSSEC/signer/src/daemon/config.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/config.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/daemon/config.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -54,11 +54,11 @@
     FILE* cfgfd = NULL;
 
     se_log_assert(cfgfile);
-    se_log_debug("load config file: %s", cfgfile);
+    se_log_debug("load config file: %s", cfgfile?cfgfile:"(null)");
 
     /* check syntax (slows down parsing configuration file) */
     if (parse_file_check(cfgfile, rngfile) != 0) {
-        se_log_error("unable to parse cfgfile %s", cfgfile);
+        se_log_error("unable to parse cfgfile %s", cfgfile?cfgfile:"(null)");
         return NULL;
     }
 
@@ -87,7 +87,7 @@
         return ecfg;
     }
 
-    se_log_error("unable to read cfgfile %s", cfgfile);
+    se_log_error("unable to read cfgfile %s", cfgfile?cfgfile:"(null)");
     return NULL;
 }
 

Modified: trunk/OpenDNSSEC/signer/src/daemon/engine.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -257,7 +257,7 @@
     se_log_assert(pidfile);
     se_log_assert(pid);
     se_log_debug("writing pid %lu to pidfile %s", (unsigned long) pid,
-        pidfile);
+        pidfile?pidfile:"(null)");
     snprintf(pidbuf, sizeof(pidbuf), "%lu\n", (unsigned long) pid);
     fd = se_fopen(pidfile, NULL, "w");
     if (!fd) {
@@ -270,10 +270,11 @@
         result = fwrite((const void*) pidbuf, 1, size, fd);
     }
     if (result == 0) {
-        se_log_error("write to pidfile %s failed: %s", pidfile,
+        se_log_error("write to pidfile %s failed: %s", pidfile?pidfile:"(null)",
             strerror(errno));
     } else if (result < size) {
-        se_log_error("short write to pidfile %s: disk full?", pidfile);
+        se_log_error("short write to pidfile %s: disk full?",
+            pidfile?pidfile:"(null)");
         result = 0;
     } else {
         result = 1;
@@ -407,7 +408,8 @@
         /* chown logfile */
         se_chown(engine->config->log_filename, engine->uid, engine->gid, 0);
     }
-    if (chdir(engine->config->working_dir) != 0) {
+    if (engine->config->working_dir &&
+        chdir(engine->config->working_dir) != 0) {
         se_log_error("setup failed: chdir to %s failed: %s",
             engine->config->working_dir, strerror(errno));
         return 1;
@@ -582,8 +584,8 @@
 
         if (!zone_name || se_strcmp(zone->name, zone_name) == 0) {
             if (zone_name) {
-                se_log_debug("update zone %s (signconf file %s)",
-                    zone->name, zone->signconf_filename);
+                se_log_debug("update zone %s (signconf file %s)", zone->name,
+                    zone->signconf_filename?zone->signconf_filename:"(null)");
                 lock_basic_lock(&engine->tasklist->tasklist_lock);
                 tmp = zone_update_signconf(zone, engine->tasklist, buf);
                 lock_basic_unlock(&engine->tasklist->tasklist_lock);
@@ -737,7 +739,7 @@
     /* configure */
     engine->config = engine_config(cfgfile, cmdline_verbosity);
     if (engine_check_config(engine->config) != 0) {
-        se_log_error("cfgfile %s has errors", cfgfile);
+        se_log_error("cfgfile %s has errors", cfgfile?cfgfile:"(null)");
         engine->need_to_exit = 1;
     }
     if (info) {

Modified: trunk/OpenDNSSEC/signer/src/daemon/worker.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/worker.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/daemon/worker.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -85,7 +85,7 @@
         task = tasklist_pop_task(worker->tasklist);
         if (task) {
             se_log_debug("worker[%i] perform task for zone %s",
-                worker->thread_num, task->who);
+                worker->thread_num, task->who?task->who:"(null)");
             zone = task->zone;
             zone->in_progress = 1;
 
@@ -147,11 +147,12 @@
 
     switch (task->what) {
         case TASK_NONE:
-            se_log_warning("no task for zone %s", task->who);
+            se_log_warning("no task for zone %s", task->who?task->who:"(null)");
             break;
         case TASK_READ:
             if (tools_read_input(zone) != 0) {
-                se_log_error("task [read zone %s] failed", task->who);
+                se_log_error("task [read zone %s] failed",
+                    task->who?task->who:"(null)");
                 goto task_perform_fail;
                 break;
             }
@@ -159,7 +160,7 @@
         case TASK_ADDKEYS:
             if (tools_add_dnskeys(zone) != 0) {
                 se_log_error("task [add dnskeys to zone %s] failed",
-                    task->who);
+                    task->who?task->who:"(null)");
                 goto task_perform_fail;
                 break;
             }
@@ -167,28 +168,31 @@
         case TASK_UPDATE:
             if (tools_update(zone) != 0) {
                 se_log_error("task [update zone %s] failed",
-                    task->who);
+                    task->who?task->who:"(null)");
                 goto task_perform_fail;
                 break;
             }
             task->what = TASK_NSECIFY;
         case TASK_NSECIFY:
             if (tools_nsecify(zone) != 0) {
-                se_log_error("task [nsecify zone %s] failed", task->who);
+                se_log_error("task [nsecify zone %s] failed",
+                    task->who?task->who:"(null)");
                 goto task_perform_fail;
                 break;
             }
             task->what = TASK_SIGN;
         case TASK_SIGN:
             if (tools_sign(zone) != 0) {
-                se_log_error("task [sign zone %s] failed", task->who);
+                se_log_error("task [sign zone %s] failed",
+                    task->who?task->who:"(null)");
                 goto task_perform_fail;
                 break;
             }
             task->what = TASK_AUDIT;
         case TASK_AUDIT:
             if (tools_audit(zone, engine->config) != 0) {
-                se_log_error("task [audit zone %s] failed", task->who);
+                se_log_error("task [audit zone %s] failed",
+                    task->who?task->who:"(null)");
                 task->what = TASK_SIGN;
                 goto task_perform_fail;
                 break;
@@ -196,7 +200,8 @@
             task->what = TASK_WRITE;
         case TASK_WRITE:
             if (tools_write_output(zone) != 0) {
-                se_log_error("task [write zone %s] failed", task->who);
+                se_log_error("task [write zone %s] failed",
+                    task->who?task->who:"(null)");
                 task->what = TASK_SIGN;
                 goto task_perform_fail;
                 break;
@@ -207,7 +212,7 @@
             break;
         default:
             se_log_warning("unknown task[id %i zone %s], "
-                "trying full sign", task->what, task->who);
+                "trying full sign", task->what, task->who?task->who:"(null)");
             task->what = TASK_READ;
             task->when = time_now();
             break;

Modified: trunk/OpenDNSSEC/signer/src/ods-signerd.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/ods-signerd.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/ods-signerd.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -45,7 +45,7 @@
 static void
 usage(FILE* out)
 {
-    fprintf(out, "Usage: %s [OPTIONS]\n", PACKAGE_TARNAME);
+    fprintf(out, "Usage: %s [OPTIONS]\n", "ods-signerd");
     fprintf(out, "Start the OpenDNSSEC signer engine daemon.\n\n");
     fprintf(out, "Supported options:\n");
     fprintf(out, " -c | --config <cfgfile> Read configuration from file.\n");

Modified: trunk/OpenDNSSEC/signer/src/parser/confparser.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/parser/confparser.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/parser/confparser.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -58,19 +58,21 @@
 
     se_log_assert(cfgfile);
     se_log_assert(rngfile);
-    se_log_debug("check config file: %s, use rng file: %s", cfgfile,
-        rngfile);
+    se_log_debug("check config file: %s, use rng file: %s",
+        cfgfile?cfgfile:"(null)", rngfile?rngfile:"(null)");
 
     /* Load XML document */
     doc = xmlParseFile(cfgfile);
     if (doc == NULL) {
-        se_log_error("unable to read config file '%s'", cfgfile);
+        se_log_error("unable to read config file %s",
+            cfgfile?cfgfile:"(null)");
         return 1;
     }
     /* Load rng document */
     rngdoc = xmlParseFile(rngfile);
     if (rngdoc == NULL) {
-        se_log_error("unable to read conf rng file '%s'", rngfile);
+        se_log_error("unable to read conf rng file %s",
+            rngfile?rngfile:"(null)");
         xmlFreeDoc(doc);
         return 1;
     }
@@ -106,8 +108,8 @@
     /* Validate a document tree in memory. */
     status = xmlRelaxNGValidateDoc(rngctx,doc);
     if (status != 0) {
-        se_log_error("configuration file validation failed '%s'",
-            cfgfile);
+        se_log_error("configuration file validation failed %s",
+            cfgfile?cfgfile:"(null)");
         xmlRelaxNGFreeValidCtxt(rngctx);
         xmlRelaxNGFree(schema);
         xmlRelaxNGFreeParserCtxt(rngpctx);
@@ -152,7 +154,7 @@
     xpathCtx = xmlXPathNewContext(doc);
     if (xpathCtx == NULL) {
         se_log_error("unable to create new XPath context for cfgile %s expr %s",
-            cfgfile, expr);
+            cfgfile?cfgfile:"(null)", expr?expr:"(null)");
         xmlFreeDoc(doc);
         return NULL;
     }
@@ -162,8 +164,8 @@
     if (xpathObj == NULL || xpathObj->nodesetval == NULL ||
         xpathObj->nodesetval->nodeNr <= 0) {
         if (required) {
-            se_log_error("unable to evaluate required "
-                "element %s in cfgfile %s", xexpr, cfgfile);
+            se_log_error("unable to evaluate required element %s in cfgfile %s",
+                xexpr?xexpr:"(null)", cfgfile?cfgfile:"(null)");
         }
         xmlXPathFreeContext(xpathCtx);
         if (xpathObj) {

Modified: trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/parser/zonelistparser.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -60,7 +60,8 @@
 
     xpathObj = xmlXPathEvalExpression(expr, xpathCtx);
     if (xpathObj == NULL) {
-        se_log_error("unable to evaluate xpath expression %s", expr);
+        se_log_error("unable to evaluate xpath expression %s",
+            expr?expr:"(null)");
         return NULL;
     }
     str = (const char*) xmlXPathCastToString(xpathObj);
@@ -88,7 +89,8 @@
 
     xpathObj = xmlXPathEvalExpression(expr, xpathCtx);
     if (xpathObj == NULL) {
-        se_log_error("unable to evaluate xpath expression %s", expr);
+        se_log_error("unable to evaluate xpath expression %s",
+            expr?expr:"(null)");
         return NULL;
     }
 
@@ -166,7 +168,7 @@
 
     reader = xmlNewTextReaderFilename(zlfile);
     if (!reader) {
-        se_log_error("unable to open zone list file %s", zlfile);
+        se_log_error("unable to open zone list file %s", zlfile?zlfile:"(null)");
         zonelist_cleanup(zl);
         return NULL;
     }
@@ -198,7 +200,7 @@
             }
             if (doc == NULL || xpathCtx == NULL) {
                 se_log_error("unable to read zone %s; skipping",
-                   zone_name);
+                   zone_name?zone_name:"(null)");
                 se_free((void*) zone_name);
                 ret = xmlTextReaderRead(reader);
                 se_free((void*) tag_name);
@@ -215,8 +217,8 @@
 
             /* and add it to the list */
             if (zonelist_add_zone(zl, new_zone) == NULL) {
-                se_log_error("unable to add zone '%s' to zone list",
-                    zone_name);
+                se_log_error("unable to add zone %s to zone list",
+                    zone_name?zone_name:"(null)");
             }
             se_free((void*) zone_name);
             xmlXPathFreeContext(xpathCtx);
@@ -228,7 +230,7 @@
     se_log_debug("no more zones");
     xmlFreeTextReader(reader);
     if (ret != 0) {
-        se_log_error("error parsing zone list file %s", zlfile);
+        se_log_error("error parsing zone list file %s", zlfile?zlfile:"(null)");
     }
     if (doc) {
         xmlFreeDoc(doc);

Modified: trunk/OpenDNSSEC/signer/src/scheduler/task.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/scheduler/task.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/scheduler/task.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -58,7 +58,7 @@
 
     se_log_assert(who);
     se_log_assert(zone);
-    se_log_debug("create task for zone %s", who);
+    se_log_debug("create task for zone %s", who?who:"(null)");
 
     task->what = what;
     task->when = when;
@@ -186,14 +186,18 @@
         } else {
             strtime = ctime(&task->when);
         }
-        strtime[strlen(strtime)-1] = '\0';
+        if (strtime) {
+            strtime[strlen(strtime)-1] = '\0';
+        }
         if (buftask) {
-            (void)snprintf(buftask, ODS_SE_MAXLINE, "On %s I will %s zone '%s'\n", strtime,
-                taskid2str(task->what), task->who);
+            (void)snprintf(buftask, ODS_SE_MAXLINE, "On %s I will %s zone %s\n",
+                strtime?strtime:"(null)", taskid2str(task->what),
+                task->who?task->who:"(null)");
             return buftask;
         } else {
-            snprintf(strtask, ODS_SE_MAXLINE, "On %s I will %s zone '%s'\n", strtime,
-                taskid2str(task->what), task->who);
+            snprintf(strtask, ODS_SE_MAXLINE, "On %s I will %s zone %s\n",
+                strtime?strtime:"(null)", taskid2str(task->what),
+                task->who?task->who:"(null)");
             return strtask;
         }
     }
@@ -220,9 +224,11 @@
         } else {
             strtime = ctime(&task->when);
         }
-        strtime[strlen(strtime)-1] = '\0';
-        fprintf(out, "On %s I will %s zone %s\n", strtime,
-            taskid2str(task->what), task->who);
+        if (strtime) {
+            strtime[strlen(strtime)-1] = '\0';
+        }
+        fprintf(out, "On %s I will %s zone %s\n", strtime?strtime:"(null)",
+            taskid2str(task->what), task->who?task->who:"(null)");
     }
     return;
 }
@@ -245,9 +251,11 @@
         } else {
             strtime = ctime(&task->when);
         }
-        strtime[strlen(strtime)-1] = '\0';
-        se_log_info("On %s I will %s zone %s", strtime,
-            taskid2str(task->what), task->who);
+        if (strtime) {
+            strtime[strlen(strtime)-1] = '\0';
+        }
+        se_log_info("On %s I will %s zone %s", strtime?strtime:"(null)",
+            taskid2str(task->what), task->who?task->who:"(null)");
     }
     return;
 }
@@ -360,14 +368,16 @@
     zone = task->zone;
     if (zone->in_progress) {
         se_log_error("unable to schedule task %s for zone %s: "
-            " zone in progress", taskid2str(task->what), task->who);
+            " zone in progress", taskid2str(task->what),
+            task->who?task->who:"(null)");
         task_cleanup(task);
         return NULL;
     }
 
     if (tasklist_lookup(list, task) != NULL) {
         se_log_error("unable to schedule task %s for zone %s: "
-            " already present", taskid2str(task->what), task->who);
+            " already present", taskid2str(task->what),
+            task->who?task->who:"(null)");
         task_cleanup(task);
         return NULL;
     }
@@ -375,7 +385,8 @@
     new_node = task2node(task);
     if (ldns_rbtree_insert(list->tasks, new_node) == NULL) {
         se_log_error("unable to schedule task %s for zone %s: "
-            " insert failed", taskid2str(task->what), task->who);
+            " insert failed", taskid2str(task->what),
+            task->who?task->who:"(null)");
         task_cleanup(task);
         se_free((void*) new_node);
         return NULL;
@@ -459,9 +470,9 @@
     pop = (task_type*) first_node->key;
     if (pop && (pop->flush || pop->when <= now)) {
         if (pop->flush) {
-            se_log_debug("flush task for zone %s", pop->who);
+            se_log_debug("flush task for zone %s", pop->who?pop->who:"(null)");
         } else {
-            se_log_debug("pop task for zone %s", pop->who);
+            se_log_debug("pop task for zone %s", pop->who?pop->who:"(null)");
         }
         first_node = ldns_rbtree_delete(list->tasks, pop);
         se_free((void*)first_node);

Modified: trunk/OpenDNSSEC/signer/src/signer/domain.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -134,7 +134,7 @@
     if (ldns_rbtree_insert(domain->rrsets, new_node) == NULL) {
         str = ldns_rdf2str(domain->name);
         se_log_error("unable to add RRset %i to domain %s: already present",
-            rrset->rr_type, domain->name);
+            rrset->rr_type, str?str:"(null)");
         se_free((void*)str);
         se_free((void*)new_node);
         return NULL;
@@ -170,7 +170,7 @@
     } else {
         str = ldns_rdf2str(domain->name);
         se_log_error("unable to delete RRset %i from domain %s: "
-            "not in tree", rrset->rr_type, domain->name);
+            "not in tree", rrset->rr_type, str?str:"(null)");
         se_free((void*)str);
         return rrset;
     }
@@ -717,7 +717,7 @@
     }
     while (node && node != LDNS_RBTREE_NULL) {
         rrset = (rrset_type*) node->data;
-		if (rrset_del_rrs(rrset) != 0) {
+        if (rrset_del_rrs(rrset) != 0) {
             return 1;
         }
         node = ldns_rbtree_next(node);
@@ -794,7 +794,7 @@
     if (internal) {
         se_log_assert(domain->name);
         str = ldns_rdf2str(domain->name);
-        fprintf(fd, "; DNAME: %s\n", str);
+        fprintf(fd, "; DNAME: %s\n", str?str:"(null)");
         se_free((void*)str);
     }
 

Modified: trunk/OpenDNSSEC/signer/src/signer/hsm.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/hsm.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/hsm.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -61,7 +61,8 @@
         hsm_key_free(hsmkey);
     } else {
         /* could not find key */
-        se_log_error("could not find key %s", key_id->locator);
+        se_log_error("could not find key %s",
+            key_id->locator?key_id->locator:"(null)");
         error = 1;
     }
     hsm_sign_params_free(params);
@@ -113,7 +114,8 @@
         hsm_key_free(hsmkey);
     } else {
         /* could not find key */
-        se_log_error("could not find key %s", key_id->locator);
+        se_log_error("could not find key %s",
+            key_id->locator?key_id->locator:"(null)");
         error = 1;
     }
 
@@ -122,4 +124,3 @@
     }
     return NULL;
 }
-

Modified: trunk/OpenDNSSEC/signer/src/signer/nsec3params.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/nsec3params.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/nsec3params.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -61,7 +61,7 @@
         *salt = NULL;
         return 0;
     } else if (*salt_len % 2 != 0) {
-        se_log_error("invalid salt %s", salt_str);
+        se_log_error("invalid salt %s", salt_str?salt_str:"(null)");
         *salt = NULL;
         return 1;
     }
@@ -73,7 +73,7 @@
             salt_tmp[c/2] = (uint8_t) ldns_hexdigit_to_int(salt_str[c]) * 16 +
                                       ldns_hexdigit_to_int(salt_str[c+1]);
         } else {
-            se_log_error("invalid salt %s", salt_str);
+            se_log_error("invalid salt %s", salt_str?salt_str:"(null)");
             se_free((void*)salt_tmp);
             *salt = NULL;
             return 1;

Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -132,17 +132,19 @@
     char* str = NULL;
 
     str = ldns_rr2str(rr);
-    str[(strlen(str))-1] = '\0';
+    if (str) {
+        str[(strlen(str))-1] = '\0';
+    }
     if (level == 1) {
-        se_log_error("%s %s", pre, str);
+        se_log_error("%s %s", pre?pre:"", str?str:"(null)");
     } else if (level == 2) {
-        se_log_warning("%s %s", pre, str);
+        se_log_warning("%s %s", pre?pre:"", str?str:"(null)");
     } else if (level == 3) {
-        se_log_info("%s %s", pre, str);
+        se_log_info("%s %s", pre?pre:"", str?str:"(null)");
     } else if (level == 4) {
-        se_log_verbose("%s %s", pre, str);
+        se_log_verbose("%s %s", pre?pre:"", str?str:"(null)");
     } else {
-        se_log_debug("%s %s", pre, str);
+        se_log_debug("%s %s", pre?pre:"", str?str:"(null)");
     }
     se_free((void*)str);
     return;

Modified: trunk/OpenDNSSEC/signer/src/signer/se_key.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/se_key.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/se_key.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -102,7 +102,9 @@
         fprintf(out, "\t\t\t<Key>\n");
         fprintf(out, "\t\t\t\t<Flags>%u</Flags>\n", key->flags);
         fprintf(out, "\t\t\t\t<Algorithm>%u</Algorithm>\n", key->algorithm);
-        fprintf(out, "\t\t\t\t<Locator>%s</Locator>\n", key->locator);
+        if (key->locator) {
+            fprintf(out, "\t\t\t\t<Locator>%s</Locator>\n", key->locator);
+        }
         if (key->ksk) {
             fprintf(out, "\t\t\t\t<KSK />\n");
         }
@@ -146,7 +148,7 @@
 
     se_log_assert(kl);
     se_log_assert(key);
-    se_log_debug("add key locator %s", key->locator);
+    se_log_debug("add key locator %s", key->locator?key->locator:"(null)");
 
     if (kl->count == 0) {
         kl->first_key = key;
@@ -186,7 +188,7 @@
 
     se_log_assert(kl);
     se_log_assert(key);
-    se_log_debug("delete key locator %s", key->locator);
+    se_log_debug("delete key locator %s", key->locator?key->locator:"(null)");
 
     walk = kl->first_key;
     while (walk) {
@@ -204,7 +206,8 @@
         walk = walk->next;
     }
 
-    se_log_error("key locator %s not found in list", key->locator);
+    se_log_error("key locator %s not found in list",
+        key->locator?key->locator:"(null)");
     return 1;
 }
 

Modified: trunk/OpenDNSSEC/signer/src/signer/signconf.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/signconf.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/signconf.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -91,12 +91,14 @@
 
     st_mtime = se_file_lastmodified(filename);
     if (st_mtime <= last_modified) {
-        se_log_debug("signconf file %s is unchanged", filename);
+        se_log_debug("signconf file %s is unchanged",
+            filename?filename:"(null)");
         return NULL;
     }
 
     if (parse_file_check(filename, rngfile) != 0) {
-        se_log_error("unable to parse signconf file %s", filename);
+        se_log_error("unable to parse signconf file %s",
+            filename?filename:"(null)");
         return NULL;
     }
 
@@ -129,7 +131,7 @@
         return signconf;
     }
 
-    se_log_error("unable to read signconf file %s", filename);
+    se_log_error("unable to read signconf file %s", filename?filename:"(null)");
     return NULL;
 }
 
@@ -221,8 +223,8 @@
         ret = 1;
     }
     if (signconf_soa_serial_check(sc->soa_serial) != 0) {
-        se_log_error("signconf-check: wrong soa serial type '%s'",
-            sc->soa_serial);
+        se_log_error("signconf-check: wrong soa serial type %s",
+            sc->soa_serial?sc->soa_serial:"(null)");
         ret = 1;
     }
 
@@ -357,36 +359,37 @@
 
     if (sc) {
         fprintf(out, "<SignerConfiguration>\n");
-        fprintf(out, "\t<Zone name=\"%s\">\n", name);
+        fprintf(out, "\t<Zone name=\"%s\">\n", name?name:"(null)");
 
         /* Signatures */
         fprintf(out, "\t\t<Signatures>\n");
         s = duration2string(sc->sig_resign_interval);
-        fprintf(out, "\t\t\t<Resign>%s</Resign>\n", s);
+        fprintf(out, "\t\t\t<Resign>%s</Resign>\n", s?s:"(null)");
         se_free((void*)s);
 
         s = duration2string(sc->sig_refresh_interval);
-        fprintf(out, "\t\t\t<Refresh>%s</Refresh>\n", s);
+        fprintf(out, "\t\t\t<Refresh>%s</Refresh>\n", s?s:"(null)");
         se_free((void*)s);
 
         fprintf(out, "\t\t\t<Validity>\n");
 
         s = duration2string(sc->sig_validity_default);
-        fprintf(out, "\t\t\t\t<Default>%s</Default>\n", s);
+        fprintf(out, "\t\t\t\t<Default>%s</Default>\n", s?s:"(null)");
         se_free((void*)s);
 
         s = duration2string(sc->sig_validity_denial);
-        fprintf(out, "\t\t\t\t<Denial>%s</Denial>\n", s);
+        fprintf(out, "\t\t\t\t<Denial>%s</Denial>\n", s?s:"(null)");
         se_free((void*)s);
 
         fprintf(out, "\t\t\t</Validity>\n");
 
         s = duration2string(sc->sig_jitter);
-        fprintf(out, "\t\t\t<Jitter>%s</Jitter>\n", s);
+        fprintf(out, "\t\t\t<Jitter>%s</Jitter>\n", s?s:"(null)");
         se_free((void*)s);
 
         s = duration2string(sc->sig_inception_offset);
-        fprintf(out, "\t\t\t<InceptionOffset>%s</InceptionOffset>\n", s);
+        fprintf(out, "\t\t\t<InceptionOffset>%s</InceptionOffset>\n",
+            s?s:"(null)");
         se_free((void*)s);
 
         fprintf(out, "\t\t</Signatures>\n");
@@ -406,7 +409,8 @@
                 sc->nsec3_algo);
             fprintf(out, "\t\t\t\t\t<Iterations>%i</Iterations>\n",
                 sc->nsec3_iterations);
-            fprintf(out, "\t\t\t\t\t<Salt>%s</Salt>\n", sc->nsec3_salt);
+            fprintf(out, "\t\t\t\t\t<Salt>%s</Salt>\n",
+                sc->nsec3_salt?sc->nsec3_salt:"(null)");
             fprintf(out, "\t\t\t\t</Hash>\n");
             fprintf(out, "\t\t\t</NSEC3>\n");
         }
@@ -416,7 +420,7 @@
         /* Keys */
         fprintf(out, "\t\t<Keys>\n");
         s = duration2string(sc->dnskey_ttl);
-        fprintf(out, "\t\t\t<TTL>%s</TTL>\n", s);
+        fprintf(out, "\t\t\t<TTL>%s</TTL>\n", s?s:"(null)");
         se_free((void*)s);
         fprintf(out, "\n");
         keylist_print(out, sc->keys);
@@ -426,14 +430,15 @@
         /* SOA */
         fprintf(out, "\t\t<SOA>\n");
         s = duration2string(sc->soa_ttl);
-        fprintf(out, "\t\t\t<TTL>%s</TTL>\n", s);
+        fprintf(out, "\t\t\t<TTL>%s</TTL>\n", s?s:"(null)");
         se_free((void*)s);
 
         s = duration2string(sc->soa_min);
-        fprintf(out, "\t\t\t<Minimum>%s</Minimum>\n", s);
+        fprintf(out, "\t\t\t<Minimum>%s</Minimum>\n", s?s:"(null)");
         se_free((void*)s);
 
-        fprintf(out, "\t\t\t<Serial>%s</Serial>\n", sc->soa_serial);
+        fprintf(out, "\t\t\t<Serial>%s</Serial>\n",
+            sc->soa_serial?sc->soa_serial:"(null)");
         fprintf(out, "\t\t</SOA>\n");
         fprintf(out, "\n");
 

Modified: trunk/OpenDNSSEC/signer/src/signer/stats.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/stats.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/stats.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -84,7 +84,7 @@
     se_log_info("[STATS] %s RR[count=%u time=%u(sec)) "
         "NSEC%s[count=%u time=%u(sec)] "
         "RRSIG[new=%u reused=%u time=%u(sec) avg=%u(sig/sec)]",
-        name, stats->sort_count, stats->sort_time,
+        name?name:"(null)", stats->sort_count, stats->sort_time,
         nsec_type==LDNS_RR_TYPE_NSEC3?"3":"", stats->nsec_count,
         stats->nsec_time,
         stats->sig_count, stats->sig_reuse, stats->sig_time, avsign);

Modified: trunk/OpenDNSSEC/signer/src/signer/tools.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/tools.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/tools.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -67,11 +67,12 @@
     zone->stats->sort_time = 0;
     start = time(NULL);
 
-    se_log_verbose("read zone %s from input adapter %i",
-        zone->name, zone->inbound_adapter->type);
-
     switch (zone->inbound_adapter->type) {
         case ADAPTER_FILE:
+            se_log_verbose("read zone %s from input file adapter %s",
+                zone->name?zone->name:"(null)",
+                zone->inbound_adapter->filename?zone->inbound_adapter->filename:"(null)");
+
             tmpname = se_build_path(zone->name, ".unsorted", 0);
             error = se_file_copy(zone->inbound_adapter->filename, tmpname);
             if (!error) {
@@ -82,7 +83,8 @@
         case ADAPTER_UNKNOWN:
         default:
             se_log_error("read zone %s failed: unknown inbound adapter type %i",
-                zone->name, (int) zone->inbound_adapter->type);
+                zone->name?zone->name:"(null)",
+                (int) zone->inbound_adapter->type);
             error = 1;
             break;
     }
@@ -102,7 +104,8 @@
 {
     se_log_assert(zone);
     se_log_assert(zone->signconf);
-    se_log_verbose("publish dnskeys to zone %s", zone->name);
+    se_log_verbose("publish dnskeys to zone %s",
+        zone->name?zone->name:"(null)");
     return zone_add_dnskeys(zone);
 }
 
@@ -115,7 +118,7 @@
 {
     se_log_assert(zone);
     se_log_assert(zone->signconf);
-    se_log_verbose("update zone %s", zone->name);
+    se_log_verbose("update zone %s", zone->name?zone->name:"(null)");
     return zone_update_zonedata(zone);
 }
 
@@ -134,7 +137,7 @@
     se_log_assert(zone);
     se_log_assert(zone->signconf);
     se_log_assert(zone->stats);
-    se_log_verbose("nsecify zone %s", zone->name);
+    se_log_verbose("nsecify zone %s", zone->name?zone->name:"(null)");
     start = time(NULL);
     error = zone_nsecify(zone);
     end = time(NULL);
@@ -157,7 +160,7 @@
     se_log_assert(zone);
     se_log_assert(zone->signconf);
     se_log_assert(zone->stats);
-    se_log_verbose("sign zone %s", zone->name);
+    se_log_verbose("sign zone %s", zone->name?zone->name:"(null)");
     start = time(NULL);
     error = zone_sign(zone);
     end = time(NULL);
@@ -181,22 +184,28 @@
     se_log_assert(zone->signconf);
 
     if (zone->signconf->audit) {
-        se_log_verbose("audit zone %s", zone->name);
+        se_log_verbose("audit zone %s", zone->name?zone->name:"(null)");
         finalized = se_build_path(zone->name, ".finalized", 0);
         error = adfile_write(zone, finalized);
         if (error != 0) {
-            se_log_error("audit zone %s failed: unable to write zone");
+            se_log_error("audit zone %s failed: unable to write zone",
+                zone->name?zone->name:"(null)");
             se_free((void*)finalized);
             return 1;
         }
 
         if (config->working_dir) {
             snprintf(str, SYSTEM_MAXLEN, "%s -c %s -s %s/%s -z %s > /dev/null",
-                ODS_SE_AUDITOR, config->cfg_filename, config->working_dir,
-                finalized, zone->name);
+                ODS_SE_AUDITOR,
+                config->cfg_filename?config->cfg_filename:ODS_SE_CFGFILE,
+                config->working_dir, finalized?finalized:"(null)",
+                zone->name?zone->name:"(null)");
         } else {
             snprintf(str, SYSTEM_MAXLEN, "%s -c %s -s %s -z %s > /dev/null",
-                ODS_SE_AUDITOR, config->cfg_filename, finalized, zone->name);
+                ODS_SE_AUDITOR,
+                config->cfg_filename?config->cfg_filename:ODS_SE_CFGFILE,
+                finalized?finalized:"(null)",
+                zone->name?zone->name:"(null)");
         }
 
         se_log_debug("system call: %s", str);
@@ -224,7 +233,7 @@
     se_log_assert(zone->signconf);
     se_log_assert(zone->outbound_adapter);
     se_log_assert(zone->stats);;
-    se_log_verbose("write zone %s", zone->name);
+    se_log_verbose("write zone %s", zone->name?zone->name:"(null)");
 
     switch (zone->outbound_adapter->type) {
         case ADAPTER_FILE:
@@ -233,14 +242,15 @@
         case ADAPTER_UNKNOWN:
         default:
             se_log_error("write zone %s failed: unknown outbound adapter "
-                "type %i", zone->name, (int) zone->inbound_adapter->type);
+                "type %i", zone->name?zone->name:"(null)",
+                (int) zone->inbound_adapter->type);
             error = 1;
             break;
     }
 
     /* log stats */
-    se_log_debug("log stats for zone %s", zone->name);
-    stats_log(zone->stats, zone->name, zone->signconf->nsec_type);
+    se_log_debug("log stats for zone %s", zone->name?zone->name:"(null)");
+    stats_log(zone->stats, (const char*) zone->name, zone->signconf->nsec_type);
     stats_clear(zone->stats);
 
     return error;

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -59,7 +59,7 @@
 {
     zone_type* zone = (zone_type*) se_calloc(1, sizeof(zone_type));
     se_log_assert(name);
-    se_log_debug("create zone %s", name);
+    se_log_debug("create zone %s", name?name:"(null)");
     zone->name = se_strdup(name);
     zone->dname = ldns_dname_new_frm_str(name);
     zone->klass = klass;
@@ -157,7 +157,9 @@
     time_t now;
 
     se_log_assert(zone);
-    se_log_debug("load zone %s signconf %s", zone->name, zone->signconf_filename);
+    se_log_debug("load zone %s signconf %s",
+        zone->name?zone->name:"(null)",
+        zone->signconf_filename?zone->signconf_filename:"(null)");
 
     if (zone->signconf) {
         last_modified = zone->signconf->last_modified;
@@ -166,39 +168,45 @@
     signconf = signconf_read(zone->signconf_filename, last_modified);
     if (!signconf) {
         if (!zone->policy_name) {
-            se_log_warning("zone %s has no policy", zone->name);
+            se_log_warning("zone %s has no policy",
+                zone->name?zone->name:"(null)");
         } else {
             signconf = signconf_read(zone->signconf_filename, 0);
             if (!signconf) {
                 se_log_warning("zone %s has policy %s configured, "
                     "but has no (valid) signconf file",
-                    zone->name, zone->policy_name);
+                    zone->name?zone->name:"(null)", zone->policy_name);
                 if (buf) {
                     (void)snprintf(buf, ODS_SE_MAXLINE,
-                        "Zone %s config has errors.\n", zone->name);
+                        "Zone %s config has errors.\n",
+                             zone->name?zone->name:"(null)");
                 }
                 return -1;
             } else {
-                se_log_debug("zone %s has not changed", zone->name);
+                se_log_debug("zone %s has not changed",
+                    zone->name?zone->name:"(null)");
             }
         }
         if (buf) {
             (void)snprintf(buf, ODS_SE_MAXLINE,
-                "Zone %s config has not changed.\n", zone->name);
+                "Zone %s config has not changed.\n",
+                zone->name?zone->name:"(null)");
         }
         return 0;
     } else if (signconf_check(signconf) != 0) {
-        se_log_warning("zone %s signconf has errors", zone->name);
+        se_log_warning("zone %s signconf has errors",
+            zone->name?zone->name:"(null)");
         if (buf) {
             (void)snprintf(buf, ODS_SE_MAXLINE,
-                "Zone %s config has errors.\n", zone->name);
+                "Zone %s config has errors.\n", zone->name?zone->name:"(null)");
         }
         return -1;
     } else if (!zone->signconf) {
         zone->signconf = signconf;
         /* we don't check if foo in <Zone name="foo"> matches zone->name */
         zone->signconf->name = zone->name;
-        se_log_debug("zone %s now has signconf", zone->name);
+        se_log_debug("zone %s now has signconf",
+            zone->name?zone->name:"(null)");
         /* zone state? */
         /* create task for new zone */
         now = time_now();
@@ -207,12 +215,14 @@
         if (!task) {
             if (buf) {
                 (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s now has config, "
-                    "but could not be scheduled.\n", zone->name);
+                    "but could not be scheduled.\n",
+                    zone->name?zone->name:"(null)");
             }
         } else {
             if (buf) {
                 (void)snprintf(buf, ODS_SE_MAXLINE,
-                    "Zone %s now has config.\n", zone->name);
+                    "Zone %s now has config.\n",
+                    zone->name?zone->name:"(null)");
             }
         }
         return 1;
@@ -225,10 +235,11 @@
         signconf_cleanup(zone->signconf);
         zone->signconf = signconf;
         zone->signconf->name = zone->name;
-        se_log_debug("zone %s signconf updated", zone->name);
+        se_log_debug("zone %s signconf updated",
+            zone->name?zone->name:"(null)");
         if (buf) {
             (void)snprintf(buf, ODS_SE_MAXLINE,
-                "Zone %s config updated.\n", zone->name);
+                "Zone %s config updated.\n", zone->name?zone->name:"(null)");
         }
         return 1;
     }
@@ -273,7 +284,7 @@
                 key->dnskey = hsm_get_key(ctx, zone->dname, key);
                 if (!key->dnskey) {
                     se_log_error("error creating DNSKEY for key %s",
-                        key->locator);
+                        key->locator?key->locator:"(null)");
                     error = 1;
                     break;
                 }
@@ -284,7 +295,8 @@
             error = zone_add_rr(zone, dnskey);
             if (error) {
                 se_log_error("error adding DNSKEY[%u] for key %s",
-                    ldns_calc_keytag(dnskey), key->locator);
+                    ldns_calc_keytag(dnskey),
+                    key->locator?key->locator:"(null)");
                 break;
             }
         }
@@ -313,7 +325,7 @@
             zone->signconf->nsec3_salt);
         if (!zone->nsec3params) {
             se_log_error("error creating NSEC3 parameters for zone %s",
-                zone->name);
+                zone->name?zone->name:"(null)");
             return 1;
         }
     }
@@ -336,7 +348,7 @@
     error = zone_add_rr(zone, nsec3params_rr);
     if (error) {
         se_log_error("error adding NSEC3PARAMS record to zone %s",
-            zone->name);
+            zone->name?zone->name:"(null)");
     }
     return error;
 }
@@ -371,13 +383,15 @@
 
     error = zone_publish_dnskeys(zone);
     if (error) {
-        se_log_error("error adding DNSKEYs to zone %s", zone->name);
+        se_log_error("error adding DNSKEYs to zone %s",
+            zone->name?zone->name:"(null)");
         return error;
     }
     if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3) {
         error = zone_publish_nsec3params(zone);
         if (error) {
-            se_log_error("error adding NSEC3PARAM RR to zone %s", zone->name);
+            se_log_error("error adding NSEC3PARAM RR to zone %s",
+                zone->name?zone->name:"(null)");
             return error;
         }
     }
@@ -406,7 +420,7 @@
     if (ldns_dname_compare(zone->dname, ldns_rr_owner(rr)) != 0 &&
         !ldns_dname_is_subdomain(ldns_rr_owner(rr), zone->dname)) {
         se_log_warning("zone %s contains out of zone data, skipping",
-            zone->name);
+            zone->name?zone->name:"(null)");
         ldns_rr_free(rr);
         return 0; /* consider success */
     }
@@ -418,19 +432,21 @@
     type = ldns_rr_get_type(rr);
     if (type == LDNS_RR_TYPE_DNSKEY && zone->signconf->dnskey_ttl) {
         tmp = (uint32_t) duration2time(zone->signconf->dnskey_ttl);
-        se_log_verbose("zone %s set DNSKEY TTL to %u", zone->name, tmp);
+        se_log_verbose("zone %s set DNSKEY TTL to %u",
+            zone->name?zone->name:"(null)", tmp);
         ldns_rr_set_ttl(rr, tmp);
     }
     if (type == LDNS_RR_TYPE_SOA) {
         if (zone->signconf->soa_ttl) {
             tmp = (uint32_t) duration2time(zone->signconf->soa_ttl);
-            se_log_verbose("zone %s set SOA TTL to %u", zone->name, tmp);
+            se_log_verbose("zone %s set SOA TTL to %u",
+                zone->name?zone->name:"(null)", tmp);
             ldns_rr_set_ttl(rr, tmp);
         }
         if (zone->signconf->soa_min) {
             tmp = (uint32_t) duration2time(zone->signconf->soa_min);
             se_log_verbose("zone %s set SOA MINIMUM to %u",
-                zone->name, tmp);
+                zone->name?zone->name:"(null)", tmp);
             soa_min = ldns_rr_set_rdf(rr,
                 ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, tmp),
                 SE_SOA_RDATA_MINIMUM);
@@ -438,7 +454,7 @@
                 ldns_rdf_deep_free(soa_min);
             } else {
                 se_log_error("zone %s failed to replace SOA MINIMUM "
-                    "rdata", zone->name);
+                    "rdata", zone->name?zone->name:"(null)");
             }
         }
     }
@@ -486,7 +502,7 @@
     error = zonedata_entize(zone->zonedata, zone->dname);
     if (error) {
         se_log_error("failed to add empty non-terminals to zone %s",
-            zone->name);
+            zone->name?zone->name:"(null)");
         return error;
     }
 
@@ -494,7 +510,8 @@
         error = zonedata_nsecify(zone->zonedata, zone->klass, zone->stats);
     } else if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3) {
         if (zone->signconf->nsec3_optout) {
-            se_log_debug("OptOut is being used for zone %s", zone->name);
+            se_log_debug("OptOut is being used for zone %s",
+                zone->name?zone->name:"(null)");
         }
         error = zonedata_nsecify3(zone->zonedata, zone->klass,
             zone->nsec3params, zone->stats);
@@ -514,7 +531,7 @@
             se_fclose(fd);
         } else {
             se_log_warning("cannot backup NSEC(3) records: cannot open file "
-            "%s for writing", filename);
+            "%s for writing", filename?filename:"(null)");
         }
         se_free((void*)filename);
     }
@@ -558,7 +575,7 @@
             se_fclose(fd);
         } else {
             se_log_warning("cannot backup RRSIG records: cannot open file "
-            "%s for writing", filename);
+            "%s for writing", filename?filename:"(null)");
         }
         se_free((void*)filename);
     }

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -178,7 +178,7 @@
         new_node = domain2node(nsec3_domain);
         if (!ldns_rbtree_insert(zd->nsec3_domains, new_node)) {
             str = ldns_rdf2str(nsec3_domain->name);
-            se_log_error("unable to add NSEC3 domain %s", str);
+            se_log_error("unable to add NSEC3 domain %s", str?str:"(null)");
             se_free((void*)str);
             se_free((void*)new_node);
             domain_cleanup(nsec3_domain);
@@ -200,7 +200,8 @@
     } else {
         str = ldns_rdf2str(hashed_ownername);
         ldns_rdf_deep_free(hashed_ownername);
-        se_log_error("unable to add NSEC3 domain %s (has collision?) ", str);
+        se_log_error("unable to add NSEC3 domain %s (has collision?) ",
+            str?str:"(null)");
         se_free((void*)str);
         return NULL;
     }
@@ -228,13 +229,14 @@
     new_node = domain2node(domain);
     if (ldns_rbtree_insert(zd->domains, new_node) == NULL) {
         str = ldns_rdf2str(domain->name);
-        se_log_error("unable to add domain %s: already present", str);
+        se_log_error("unable to add domain %s: already present",
+            str?str:"(null)");
         se_free((void*)str);
         se_free((void*)new_node);
         return NULL;
     }
     str = ldns_rdf2str(domain->name);
-    se_log_debug("+DD %s", str);
+    se_log_debug("+DD %s", str?str:"(null)");
     se_free((void*) str);
     domain->domain_status = DOMAIN_STATUS_NONE;
     domain->nsec_bitmap_changed = 1;
@@ -290,7 +292,8 @@
         return NULL;
     } else {
         str = ldns_rdf2str(domain->name);
-        se_log_error("unable to delete domain %s: not in tree", str);
+        se_log_error("unable to delete domain %s: not in tree",
+            str?str:"(null)");
         se_free((void*)str);
         return domain;
     }
@@ -325,7 +328,7 @@
     se_log_assert(zd->domains);
     se_log_assert(domain);
     str = ldns_rdf2str(domain->name);
-    se_log_debug("-DD %s", str);
+    se_log_debug("-DD %s", str?str:"(null)");
     se_free((void*) str);
     if (domain->nsec3) {
         nsec3_domain = zonedata_del_domain_nsec3(zd, domain->nsec3);
@@ -560,7 +563,7 @@
             domain->domain_status == DOMAIN_STATUS_OCCLUDED ||
             domain->domain_status == DOMAIN_STATUS_ENT_GLUE) {
             str = ldns_rdf2str(domain->name);
-            se_log_debug("nsecify3: skip glue domain %s", str);
+            se_log_debug("nsecify3: skip glue domain %s", str?str:"(null)");
             se_free((void*) str);
 
             node = ldns_rbtree_next(node);
@@ -574,9 +577,10 @@
                 str = ldns_rdf2str(domain->name);
                 if (domain->domain_status == DOMAIN_STATUS_ENT_NS) {
                     se_log_debug("opt-out %s: empty non-terminal (to unsigned "
-                        "delegation)", str);
+                        "delegation)", str?str:"(null)");
                 } else {
-                    se_log_debug("opt-out %s: unsigned delegation", str);
+                    se_log_debug("opt-out %s: unsigned delegation",
+                        str?str:"(null)");
                 }
                 se_free((void*) str);
                 node = ldns_rbtree_next(node);
@@ -595,7 +599,8 @@
                 nsec3params);
             if (domain->nsec3 == NULL) {
                 str = ldns_rdf2str(domain->name);
-                se_log_alert("failed to add NSEC3 domain for %s", str);
+                se_log_alert("failed to add NSEC3 domain for %s",
+                    str?str:"(null)");
                 se_free((void*) str);
                 return 1;
             }
@@ -702,7 +707,8 @@
         prev = soa;
         update = 0;
     } else {
-        se_log_error("unknown serial type %s", sc->soa_serial);
+        se_log_error("unknown serial type %s",
+            sc->soa_serial?sc->soa_serial:"(null)");
         return 1;
     }
 

Modified: trunk/OpenDNSSEC/signer/src/signer/zonelist.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonelist.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/signer/zonelist.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -93,17 +93,20 @@
     time_t st_mtime = 0;
 
     se_log_assert(zonelistfile);
-    se_log_verbose("read zone list file %s", zonelistfile);
+    se_log_verbose("read zone list file %s",
+        zonelistfile?zonelistfile:"(null)");
 
     /* is the file updated? */
     st_mtime = se_file_lastmodified(zonelistfile);
     if (st_mtime <= last_modified) {
-        se_log_debug("zone list file %s is unchanged", zonelistfile);
+        se_log_debug("zone list file %s is unchanged",
+            zonelistfile?zonelistfile:"(null)");
         return NULL;
     }
     /* does the file have no parse errors? */
     if (parse_file_check(zonelistfile, rngfile) != 0) {
-        se_log_error("unable to parse zone list file %s", zonelistfile);
+        se_log_error("unable to parse zone list file %s",
+            zonelistfile?zonelistfile:"(null)");
         return NULL;
     }
     /* ok, parse it! */
@@ -111,7 +114,8 @@
     if (zlist) {
         zlist->last_modified = st_mtime;
     } else {
-        se_log_error("unable to read zone list file %s", zonelistfile);
+        se_log_error("unable to read zone list file %s",
+            zonelistfile?zonelistfile:"(null)");
         return NULL;
     }
     return zlist;
@@ -212,14 +216,16 @@
     se_log_assert(zone);
 
     if (zonelist_lookup_zone(zonelist, zone) != NULL) {
-        se_log_warning("unable to add zone %s: already present", zone->name);
+        se_log_warning("unable to add zone %s: already present",
+            zone->name?zone->name:"(null)");
         zone_cleanup(zone);
         return NULL;
     }
 
     new_node = zone2node(zone);
     if (ldns_rbtree_insert(zonelist->zones, new_node) == NULL) {
-        se_log_error("unable to add zone %s: rbtree insert failed", zone->name);
+        se_log_error("unable to add zone %s: rbtree insert failed",
+            zone->name?zone->name:"(null)");
         zone_cleanup(zone);
         se_free((void*) new_node);
         return NULL;
@@ -244,7 +250,8 @@
 
     old_node = ldns_rbtree_delete(zonelist->zones, zone);
     if (!old_node) {
-        se_log_warning("unable to delete zone %s: not present", zone->name);
+        se_log_warning("unable to delete zone %s: not present",
+            zone->name?zone->name:"(null)");
         return zone;
     }
 
@@ -281,7 +288,8 @@
                 task_cleanup(task);
             }
             node = ldns_rbtree_next(node);
-            se_log_debug("delete zone %s from zone list", zone->name);
+            se_log_debug("delete zone %s from zone list",
+                zone->name?zone->name:"(null)");
             lock_basic_unlock(&zone->zone_lock);
             (void)zonelist_delete_zone(zl, zone);
             zone = NULL;
@@ -303,8 +311,9 @@
     }
 
     if (buf) {
-        (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list updated: %i removed, %i added, "
-            "%i updated.\n", just_removed, just_added, just_updated);
+        (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list updated: "
+            "%i removed, %i added, %i updated.\n",
+            just_removed, just_added, just_updated);
     }
     return;
 }
@@ -343,7 +352,8 @@
             return;
         } else if (!z1) {
             /* just add remaining zones from zl2 */
-            se_log_debug("add zone %s to zone list", z2->name);
+            se_log_debug("add zone %s to zone list",
+                z2->name?z2->name:"(null)");
             z2 = zonelist_add_zone(zl1, z2);
             if (!z2) {
                 se_log_error("zone list merge failed, z2 not added");
@@ -360,7 +370,8 @@
                 n1 = ldns_rbtree_next(n1);
             } else if (ret > 0) {
                 /* add the new zone z2 */
-                se_log_debug("add zone %s to zone list", z2->name);
+                se_log_debug("add zone %s to zone list",
+                    z2->name?z2->name:"(null)");
                 z2 = zonelist_add_zone(zl1, z2);
                 if (!z2) {
                     se_log_error("zone list merge failed, z2 not added");

Modified: trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/tools/zone_fetcher.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -192,14 +192,14 @@
                 doc = xmlTextReaderCurrentDoc(reader);
                 if (doc == NULL) {
                     se_log_error("can not read zone fetcher configfile "
-                        "%s", filename);
+                        "%s", filename?filename:"(null)");
                     se_log_info("zone fetcher exiting...");
                     exit(EXIT_FAILURE);
                 }
                 xpathCtx = xmlXPathNewContext(doc);
                 if (xpathCtx == NULL) {
                     se_log_error("zone fetcher can not create XPath "
-                        "context for %s", filename);
+                        "context for %s", filename?filename:"(null)");
                     se_log_info("zone fetcher exiting...");
                     exit(EXIT_FAILURE);
                 }
@@ -208,7 +208,7 @@
                 xpathObj = xmlXPathEvalExpression(server_expr, xpathCtx);
                 if (xpathObj == NULL || !xpathObj->nodesetval) {
                     se_log_error("zone fetcher can not locate master "
-                        "server(s) in %s", filename);
+                        "server(s) in %s", filename?filename:"(null)");
                     se_log_info("zone fetcher exiting...");
                     exit(EXIT_FAILURE);
                 }
@@ -351,13 +351,13 @@
         xmlFreeDoc(doc);
         if (ret != 0) {
             se_log_error("zone fetcher failed to parse config file %s",
-                filename);
+                filename?filename:"(null)");
             se_log_info("zone fetcher exiting...");
             exit(EXIT_FAILURE);
         }
     } else {
         se_log_error("zone fetcher was unable to open config file %s",
-            filename);
+            filename?filename:"(null)");
         se_log_info("zone fetcher exiting...");
         exit(EXIT_FAILURE);
     }
@@ -402,7 +402,7 @@
                 if (zone_name == NULL) {
                     /* error */
                     se_log_error("zone fetcher failed to extract zone "
-                        "name from %s", filename);
+                        "name from %s", filename?filename:"(null)");
                     /* Don't return? try to parse the rest of the zones? */
                     ret = xmlTextReaderRead(reader);
                     continue;
@@ -412,7 +412,7 @@
                 doc = xmlTextReaderCurrentDoc(reader);
                 if (doc == NULL) {
                     se_log_error("zone fetcher could not read zone "
-                        "\"%s\"; skipping", zone_name);
+                        "%s; skipping", zone_name?zone_name:"(null)");
                     /* Don't return? try to parse the rest of the zones? */
                     ret = xmlTextReaderRead(reader);
                     continue;
@@ -420,7 +420,8 @@
                 xpathCtx = xmlXPathNewContext(doc);
                 if (xpathCtx == NULL) {
                     se_log_error("zone fetcher can not create XPath "
-                        "context for \"%s\"; skipping zone", zone_name);
+                        "context for %s; skipping zone",
+                        zone_name?zone_name:"(null)");
                     /* Don't return? try to parse the rest of the zones? */
                     ret = xmlTextReaderRead(reader);
                     continue;
@@ -446,8 +447,8 @@
                     zonelist->next = new_zone(zone_name, input_file);
                     zonelist = zonelist->next;
                 }
-				free((void*) zone_name);
-				free((void*) input_file);
+                free((void*) zone_name);
+                free((void*) input_file);
 
                 xmlXPathFreeContext(xpathCtx);
             }
@@ -460,13 +461,13 @@
         xmlFreeDoc(doc);
         if (ret != 0) {
             se_log_error("zone fetcher failed to parse zonelist %s",
-                filename);
+                filename?filename:"(null)");
             se_log_info("zone fetcher exiting...");
             exit(EXIT_FAILURE);
         }
     } else {
         se_log_error("zone fetcher was unable to open zonelist %s",
-            filename);
+            filename?filename:"(null)");
         se_log_info("zone fetcher exiting...");
         exit(EXIT_FAILURE);
     }
@@ -485,7 +486,7 @@
     snprintf(pidbuf, sizeof(pidbuf), "%lu\n", (unsigned long) pid);
     if ((fd = fopen(pidfile, "w")) ==  NULL ) {
         se_log_error("zone fetcher could not open pidfile %s for "
-            "writing: %s", pidfile, strerror(errno));
+            "writing: %s", pidfile?pidfile:"(null)", strerror(errno));
         return -1;
     }
     size = strlen(pidbuf);
@@ -503,7 +504,7 @@
         result = 1;
     if (!result) {
         se_log_error("zone fetcher could not write pidfile %s: %s",
-            pidfile, strerror(errno));
+            pidfile?pidfile:"(null)", strerror(errno));
         fclose(fd);
         return -1;
     }
@@ -582,7 +583,8 @@
                 continue;
             }
             se_log_error("zone fetcher cannot parse address %s:%s: "
-                "getaddrinfo (%i): %s %s", node, port, walk->family,
+                "getaddrinfo (%i): %s %s", node?node:"(null)",
+                port?port:"(null)", walk->family,
                  gai_strerror(r), r==EAI_SYSTEM?strerror(errno):"");
         }
 
@@ -655,7 +657,8 @@
                 continue;
             }
             se_log_error("zone fetcher cannot parse address %s:%s: "
-                "getaddrinfo (%i): %s %s", node, port, walk->family,
+                "getaddrinfo (%i): %s %s", node?node:"(null)",
+                 port?port:"(null)", walk->family,
                  gai_strerror(r), r==EAI_SYSTEM?strerror(errno):"");
         }
         /* socket */
@@ -748,9 +751,9 @@
         i++;
     }
 
-	if (new_list) {
+    if (new_list) {
         free_serverlist(new_list);
-	}
+    }
 
     return ret;
 }
@@ -842,8 +845,7 @@
             snprintf(axfr_file, sizeof(axfr_file), "%s.%s", zone->input_file, lock_ext);
             fd = fopen(axfr_file, "w");
             if (!fd) {
-                se_log_error("zone fetcher cannot store AXFR to file %s",
-                    axfr_file);
+                se_log_error("zone fetcher cannot store AXFR to file %s", axfr_file);
                 return -1;
             }
         }
@@ -852,7 +854,8 @@
 
         axfr_rr = ldns_axfr_next(config->xfrd);
         if (!axfr_rr) {
-            se_log_error("zone fetcher AXFR for %s failed", zone->name);
+            se_log_error("zone fetcher AXFR for %s failed",
+                zone->name?zone->name:"(null)");
 	    fclose(fd);
             unlink(axfr_file);
             return -1;
@@ -871,19 +874,21 @@
                 axfr_rr = ldns_axfr_next(config->xfrd);
             }
             se_log_info("zone fetcher transferred zone %s serial %u "
-                "successfully", zone->name, new_serial);
+                "successfully", zone->name?zone->name:"(null)", new_serial);
 
 	    /* Close file before moving it */
 	    fclose(fd);
 
             /* moving and kicking */
-            snprintf(dest_file, sizeof(dest_file), "%s.axfr", zone->input_file);
+            snprintf(dest_file, sizeof(dest_file), "%s.axfr",
+                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);
+                    "%s sign %s", 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", zone->name);
+                        "the signer engine to sign zone %s",
+                        zone->name?zone->name:"--all");
                 }
             }
             else {
@@ -895,7 +900,7 @@
     }
     else {
         se_log_info("zone fetcher zone %s is already up to date, "
-            "serial is %u", zone->name, serial);
+            "serial is %u", zone->name?zone->name:"(null)", serial);
     }
 
     return 0;
@@ -935,11 +940,12 @@
                 status = ldns_resolver_push_nameserver(xfrd, ns);
             else {
                 se_log_error("zone fetcher could not use %s for transfer "
-                    "request: could not parse ip address", servers->ipaddr);
+                    "request: could not parse ip address",
+                    servers->ipaddr?servers->ipaddr:"(null)");
             }
             if (status != LDNS_STATUS_OK) {
                 se_log_error("zone fetcher could not use %s for transfer "
-                    "request: %s", servers->ipaddr,
+                    "request: %s", servers->ipaddr?servers->ipaddr:"(null)",
                     ldns_get_errorstr_by_id(status));
             }
             servers = servers->next;
@@ -1055,7 +1061,7 @@
         if (ldns_dname_compare(ldns_rr_owner(query_rr), zonelist->dname) == 0)
         {
             se_log_info("zone fetcher received NOTIFY for zone %s",
-                zonelist->name);
+                zonelist->name?zonelist->name:"(null)");
             /* get latest serial */
             fd = fopen(zonelist->input_file, "r");
             if (!fd) {
@@ -1065,7 +1071,8 @@
                 fclose(fd);
             }
             if (odd_xfer(zonelist, serial, config) != 0) {
-                se_log_error("AXFR for zone '%s' failed", zonelist->name);
+                se_log_error("AXFR for zone %s failed",
+                    zonelist->name?zonelist->name:"(null)");
             }
             ldns_pkt_free(query_pkt);
             return;
@@ -1075,7 +1082,7 @@
     }
     owner_name = ldns_rdf2str(ldns_rr_owner(query_rr));
     se_log_warning("zone fetcher notify received for unknown zone: %s",
-        owner_name);
+        owner_name?owner_name:"(null)");
     free((void*)owner_name);
     ldns_pkt_free(query_pkt);
 }
@@ -1168,8 +1175,7 @@
         remote = (char*) malloc(sizeof(char)*userdata.hislen);
         se_log_warning("zone fetcher refused message from "
             "unauthoritative source: %s",
-            addr2ip(userdata.addr_him, remote,
-            userdata.hislen));
+            addr2ip(userdata.addr_him, remote, userdata.hislen));
         free((void*)remote);
         return;
     }
@@ -1268,30 +1274,33 @@
 
     if (config) {
         fprintf(out, "configuration settings:\n");
-        fprintf(out, "filename: %s\n", filename);
-        fprintf(out, "pidfile: %s\n", config->pidfile);
+        fprintf(out, "filename: %s\n", filename?filename:"(null)");
+        fprintf(out, "pidfile: %s\n",
+            config->pidfile?config->pidfile:"(null)");
         fprintf(out, "tsig: %s\n", config->use_tsig?"yes":"no");
         if (config->use_tsig) {
-            fprintf(out, "tsig name: %s\n", config->tsig_name);
-            fprintf(out, "tsig algorithm: %s\n", config->tsig_algo);
+            fprintf(out, "tsig name: %s\n",
+                config->tsig_name?config->tsig_name:"(null)");
+            fprintf(out, "tsig algorithm: %s\n",
+                config->tsig_algo?config->tsig_algo:"(null)");
             fprintf(out, "tsig secret: ?\n");
         }
         fprintf(out, "zones: %s\n", config->zonelist?"":"none");
         zones = config->zonelist;
         while (zones) {
-            fprintf(out, "\t%s\n", zones->name);
+            fprintf(out, "\t%s\n", zones->name?zones->name:"(null)");
             zones = zones->next;
         }
         fprintf(out, "master servers: %s\n", config->serverlist?"":"none");
         servers = config->serverlist;
         while (servers) {
-            fprintf(out, "\t%s\n", servers->ipaddr);
+            fprintf(out, "\t%s\n", servers->ipaddr?servers->ipaddr:"(null)");
             servers = servers->next;
         }
         fprintf(out, "interfaces: %s\n", config->notifylist?"":"none");
         servers = config->notifylist;
         while (servers) {
-            fprintf(out, "\t%s\n", servers->ipaddr);
+            fprintf(out, "\t%s\n", servers->ipaddr?servers->ipaddr:"(null)");
             servers = servers->next;
         }
         if (config->xfrd) {
@@ -1348,7 +1357,8 @@
 
     /* write pidfile */
     if (writepid(config->pidfile, getpid()) != 0) {
-        se_log_error("write pidfile %s failed", config->pidfile);
+        se_log_error("write pidfile %s failed",
+            config->pidfile?config->pidfile:"(null)");
         se_log_info("zone fetcher exiting...");
         exit(EXIT_FAILURE);
     }
@@ -1368,7 +1378,8 @@
         }
         /* send the request */
         if (odd_xfer(zonelist, serial, config) != 0) {
-            se_log_error("AXFR for zone '%s' failed", zonelist->name);
+            se_log_error("AXFR for zone %s failed",
+                zonelist->name?zonelist->name:"(null)");
         }
         /* next */
         zonelist = zonelist->next;
@@ -1379,7 +1390,8 @@
     if (c == -1) {
         se_log_error("zone fetcher failed to initialize sockets");
         if (unlink(config->pidfile) == -1) {
-            se_log_error("unlink pidfile %s failed: %s", config->pidfile,
+            se_log_error("unlink pidfile %s failed: %s",
+                config->pidfile?config->pidfile:"(null)",
                 strerror(errno));
         }
         se_log_info("zone fetcher exiting...");
@@ -1390,7 +1402,8 @@
     if (privdrop(user, group, chroot) != 0) {
         se_log_error("zone fetcher failed to drop privileges");
         if (unlink(config->pidfile) == -1) {
-            se_log_error("unlink pidfile %s failed: %s", config->pidfile,
+            se_log_error("unlink pidfile %s failed: %s",
+                config->pidfile?config->pidfile:"(null)",
                 strerror(errno));
         }
         free_sockets(&sockets);
@@ -1401,7 +1414,8 @@
     xfrd_ns(&sockets, config);
 
     if (unlink(config->pidfile) == -1) {
-        se_log_warning("unlink pidfile %s failed: %s", config->pidfile,
+        se_log_warning("unlink pidfile %s failed: %s",
+            config->pidfile?config->pidfile:"(null)",
             strerror(errno));
     }
     free_sockets(&sockets);

Modified: trunk/OpenDNSSEC/signer/src/util/duration.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/util/duration.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/util/duration.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -77,7 +77,7 @@
 
     P = strchr(str, 'P');
     if (!P) {
-        se_log_error("unable to create duration from string '%s'", str);
+        se_log_error("unable to create duration from string %s", str);
         duration_cleanup(duration);
         return NULL;
     }
@@ -127,7 +127,8 @@
     W = strchr(str, 'W');
     if (W) {
         if (not_weeks) {
-            se_log_error("unable to create duration from string %s", P);
+            se_log_error("unable to create duration from string %s",
+                P?P:"(null)");
             duration_cleanup(duration);
             return NULL;
         } else {
@@ -285,7 +286,8 @@
         if (duration->months || duration->years) {
             /* TODO calculate correct number of days in this month/year */
             dstr = duration2string(duration);
-            se_log_warning("converting duration %s to approximate value", dstr);
+            se_log_warning("converting duration %s to approximate value",
+                dstr?dstr:"(null)");
             se_free((void*) dstr);
         }
     }

Modified: trunk/OpenDNSSEC/signer/src/util/file.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/util/file.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/util/file.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -159,8 +159,8 @@
     char* openf = NULL;
 
     se_log_assert(mode);
-    se_log_debug("open file: dir %s file %s for %s", 
-        (dir ? dir : "NULL"), (file ? file : "NULL"),
+    se_log_debug("open file: dir %s file %s for %s",
+        (dir?dir:"(null)"), (file?file:"(null)"),
         se_file_mode2str(mode));
 
     if (dir) {
@@ -184,8 +184,9 @@
         if (len_file) {
             fd = fopen(openf, mode);
             if (!fd) {
-                se_log_error("unable to open file '%s' for %s: %s",
-                    openf, se_file_mode2str(mode), strerror(errno));
+                se_log_error("unable to open file %s for %s: %s",
+                    openf?openf:"(null)",
+                    se_file_mode2str(mode), strerror(errno));
             }
         }
         se_free((void*) openf);
@@ -292,7 +293,7 @@
     se_log_assert(file2);
 
     snprintf(str, SYSTEM_MAXLEN, "cp %s %s", file1, file2);
-    se_log_debug("system call: %s", str);
+    se_log_debug("system call: %s", str?str:"(null)");
     return system(str);
 }
 
@@ -336,19 +337,21 @@
 
     if (!getdir) {
         se_log_debug("create and chown directory %s [user %ld] [group %ld]",
-           file, (signed long) uid, (signed long) gid);
+           file?file:"(null)", (signed long) uid, (signed long) gid);
         if (chown(file, uid, gid) != 0) {
-            se_log_error("chown() for %s failed: %s", file, strerror(errno));
+            se_log_error("chown() for %s failed: %s", file?file:"(null)",
+                strerror(errno));
         }
     } else if ((dir = se_dir_name(file)) != NULL) {
         se_log_debug("create and chown directory %s [user %ld] [group %ld]",
-           dir, (signed long) uid, (signed long) gid);
+           dir?dir:"(null)", (signed long) uid, (signed long) gid);
         if (chown(dir, uid, gid) != 0) {
-            se_log_error("chown() for %s failed: %s", dir, strerror(errno));
+            se_log_error("chown() for %s failed: %s", dir?dir:"(null)",
+                strerror(errno));
         }
         se_free((void*) dir);
     } else {
-        se_log_warning("use of relative path: %s", file);
+        se_log_warning("use of relative path: %s", file?file:"(null)");
     }
     return;
 }

Modified: trunk/OpenDNSSEC/signer/src/util/log.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/util/log.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/util/log.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -180,7 +180,7 @@
     else if (strncasecmp(facility, "LOCAL7", 6) && strlen(facility) == 6)
         return LOG_LOCAL7;
     se_log_warning("syslog facility %s not supported, logging to "
-                   "log_daemon", facility);
+                   "log_daemon", facility?facility:"(null)");
     return LOG_DAEMON;
 
 }
@@ -202,7 +202,7 @@
 
 #ifdef HAVE_SYSLOG_H
     if (logging_to_syslog) {
-        syslog(priority, "%s", message);
+        syslog(priority, "%s", message?message:"(null)");
         return;
     }
 #endif /* HAVE_SYSLOG_H */
@@ -211,8 +211,8 @@
         return;
     }
 
-    ctime_r(&now, nowstr);
-    nowstr[24] = '\0'; /* remove trailing linefeed */
+    (void) ctime_r(&now, nowstr);
+    nowstr[CTIME_LENGTH-2] = '\0'; /* remove trailing linefeed */
 
     fprintf(logfile, "[%s] %s[%i] %s: %s\n", nowstr,
         PACKAGE_TARNAME, priority, t, message);

Modified: trunk/OpenDNSSEC/signer/src/util/privdrop.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/util/privdrop.c	2010-08-10 09:39:40 UTC (rev 3701)
+++ trunk/OpenDNSSEC/signer/src/util/privdrop.c	2010-08-10 11:05:04 UTC (rev 3702)
@@ -244,7 +244,7 @@
 # ifndef SETEUID_BREAKS_SETUID
         status = seteuid(uid);
         if (status != 0) {
-           se_log_error("seteuid() for '%s' (%lu) failed: %s",
+           se_log_error("seteuid() for %s (%lu) failed: %s",
                username, (unsigned long) uid, strerror(errno));
            return -1;
         }




More information about the Opendnssec-commits mailing list