[Opendnssec-commits] [svn.opendnssec.org/svn/dnssec] r6620 - in trunk/OpenDNSSEC: libhsm/src/bin signer/src/daemon signer/src/wire

matthijs at nlnetlabs.nl matthijs at nlnetlabs.nl
Wed Sep 5 09:56:36 CEST 2012


Author: matthijs
Date: 2012-09-05 09:56:36 +0200 (Wed, 05 Sep 2012)
New Revision: 6620

Modified:
   trunk/OpenDNSSEC/libhsm/src/bin/Makefile.am
   trunk/OpenDNSSEC/signer/src/daemon/cfg.c
   trunk/OpenDNSSEC/signer/src/wire/notify.c
   trunk/OpenDNSSEC/signer/src/wire/tsig.c
   trunk/OpenDNSSEC/signer/src/wire/xfrd.c
Log:
OPENDNSSEC-319: TSIG causes seg fault 

+ also libcompat for libhsm tools
+ fix leaks



Modified: trunk/OpenDNSSEC/libhsm/src/bin/Makefile.am
===================================================================
--- trunk/OpenDNSSEC/libhsm/src/bin/Makefile.am	2012-09-05 07:09:36 UTC (rev 6619)
+++ trunk/OpenDNSSEC/libhsm/src/bin/Makefile.am	2012-09-05 07:56:36 UTC (rev 6620)
@@ -2,6 +2,8 @@
 
 MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
 
+LIBCOMPAT = ${top_builddir}/common/libcompat.a
+
 AM_CPPFLAGS = \
 		-I$(top_srcdir)/common \
 		-I$(top_builddir)/common \
@@ -15,7 +17,7 @@
 man1_MANS = ods-hsmutil.1 ods-hsmspeed.1
 
 ods_hsmutil_SOURCES = hsmutil.c hsmtest.c hsmtest.h
-ods_hsmutil_LDADD = ../lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@
+ods_hsmutil_LDADD = ../lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
 
 ods_hsmspeed_SOURCES = hsmspeed.c
-ods_hsmspeed_LDADD = ../lib/libhsm.a -lpthread @LDNS_LIBS@ @XML2_LIBS@
+ods_hsmspeed_LDADD = ../lib/libhsm.a -lpthread @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)

Modified: trunk/OpenDNSSEC/signer/src/daemon/cfg.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/cfg.c	2012-09-05 07:09:36 UTC (rev 6619)
+++ trunk/OpenDNSSEC/signer/src/daemon/cfg.c	2012-09-05 07:56:36 UTC (rev 6620)
@@ -261,7 +261,6 @@
     allocator_deallocate(allocator, (void*) config->zonelist_filename);
     allocator_deallocate(allocator, (void*) config->log_filename);
     allocator_deallocate(allocator, (void*) config->pid_filename);
-    allocator_deallocate(allocator, (void*) config->notify_command);
     allocator_deallocate(allocator, (void*) config->clisock_filename);
     allocator_deallocate(allocator, (void*) config->working_dir);
     allocator_deallocate(allocator, (void*) config->username);

Modified: trunk/OpenDNSSEC/signer/src/wire/notify.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/wire/notify.c	2012-09-05 07:09:36 UTC (rev 6619)
+++ trunk/OpenDNSSEC/signer/src/wire/notify.c	2012-09-05 07:56:36 UTC (rev 6620)
@@ -34,6 +34,7 @@
 #include "config.h"
 #include "adapter/addns.h"
 #include "daemon/xfrhandler.h"
+#include "signer/domain.h"
 #include "signer/zone.h"
 #include "wire/notify.h"
 #include "wire/xfrd.h"
@@ -374,9 +375,10 @@
     notify->tsig_rr->algo_name =
         ldns_rdf_clone(notify->tsig_rr->algo->wf_name);
     notify->tsig_rr->key_name = ldns_rdf_clone(notify->tsig_rr->key->dname);
-    ods_log_debug("[%s] tsig sign notify with %s %s", notify_str,
-        ldns_rdf2str(notify->tsig_rr->key_name),
-        ldns_rdf2str(notify->tsig_rr->algo_name));
+    log_dname(notify->tsig_rr->key_name, "tsig sign notify with key %s",
+        LOG_DEBUG);
+    log_dname(notify->tsig_rr->algo_name, "tsig sign notify with algorithm %s",
+        LOG_DEBUG);
     tsig_rr_prepare(notify->tsig_rr);
     tsig_rr_update(notify->tsig_rr, buffer, buffer_position(buffer));
     tsig_rr_sign(notify->tsig_rr);

Modified: trunk/OpenDNSSEC/signer/src/wire/tsig.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/wire/tsig.c	2012-09-05 07:09:36 UTC (rev 6619)
+++ trunk/OpenDNSSEC/signer/src/wire/tsig.c	2012-09-05 07:56:36 UTC (rev 6620)
@@ -174,6 +174,8 @@
     kentry = tsig_key_table;
     while (kentry) {
         knext = kentry->next;
+        ldns_rdf_deep_free(kentry->key->dname);
+        allocator_deallocate(tsig_allocator, (void*)kentry->key->data);
         allocator_deallocate(tsig_allocator, (void*)kentry->key);
         allocator_deallocate(tsig_allocator, (void*)kentry);
         kentry = knext;
@@ -864,22 +866,6 @@
 
 
 /**
- * Clean up TSIG key.
- *
- */
-static void
-tsig_key_cleanup(tsig_key_type* key, allocator_type* allocator)
-{
-    if (!key || !allocator) {
-        return;
-    }
-    ldns_rdf_deep_free(key->dname);
-    allocator_deallocate(allocator, (void*) key->data);
-    return;
-}
-
-
-/**
  * Clean up TSIG.
  *
  */
@@ -890,7 +876,6 @@
         return;
     }
     tsig_cleanup(tsig->next, allocator);
-    tsig_key_cleanup(tsig->key, allocator);
     allocator_deallocate(allocator, (void*) tsig->name);
     allocator_deallocate(allocator, (void*) tsig->algorithm);
     allocator_deallocate(allocator, (void*) tsig->secret);

Modified: trunk/OpenDNSSEC/signer/src/wire/xfrd.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/wire/xfrd.c	2012-09-05 07:09:36 UTC (rev 6619)
+++ trunk/OpenDNSSEC/signer/src/wire/xfrd.c	2012-09-05 07:56:36 UTC (rev 6620)
@@ -38,6 +38,7 @@
 #include "shared/file.h"
 #include "shared/log.h"
 #include "shared/util.h"
+#include "signer/domain.h"
 #include "signer/zone.h"
 #include "wire/tcpset.h"
 #include "wire/xfrd.h"
@@ -339,6 +340,8 @@
 xfrd_tsig_sign(xfrd_type* xfrd, buffer_type* buffer)
 {
     tsig_algo_type* algo = NULL;
+    char* key_name = NULL;
+    char* algo_name = NULL;
     if (!xfrd || !xfrd->tsig_rr || !xfrd->master || !xfrd->master->tsig ||
         !xfrd->master->tsig->key || !buffer) {
         return; /* no tsig configured */
@@ -354,9 +357,9 @@
     xfrd->tsig_rr->original_query_id = buffer_pkt_id(buffer);
     xfrd->tsig_rr->algo_name = ldns_rdf_clone(xfrd->tsig_rr->algo->wf_name);
     xfrd->tsig_rr->key_name = ldns_rdf_clone(xfrd->tsig_rr->key->dname);
-    ods_log_debug("[%s] tsig sign query with %s %s", xfrd_str,
-        ldns_rdf2str(xfrd->tsig_rr->key_name),
-        ldns_rdf2str(xfrd->tsig_rr->algo_name));
+    log_dname(xfrd->tsig_rr->key_name, "tsig sign query with key ", LOG_DEBUG);
+    log_dname(xfrd->tsig_rr->algo_name, "tsig sign query with algorithm ",
+        LOG_DEBUG);
     tsig_rr_prepare(xfrd->tsig_rr);
     tsig_rr_update(xfrd->tsig_rr, buffer, buffer_position(buffer));
     tsig_rr_sign(xfrd->tsig_rr);




More information about the Opendnssec-commits mailing list