[Opendnssec-commits] [svn.opendnssec.org/svn/dnssec] r6113 - in branches/OpenDNSSEC-1.3: . signer/src/adapter

matthijs at nlnetlabs.nl matthijs at nlnetlabs.nl
Mon Jan 30 16:39:04 CET 2012


Author: matthijs
Date: 2012-01-30 16:39:04 +0100 (Mon, 30 Jan 2012)
New Revision: 6113

Modified:
   branches/OpenDNSSEC-1.3/NEWS
   branches/OpenDNSSEC-1.3/signer/src/adapter/adfile.c
Log:
OPENDNSSEC-209: Make file output adapter atomic



Modified: branches/OpenDNSSEC-1.3/NEWS
===================================================================
--- branches/OpenDNSSEC-1.3/NEWS	2012-01-30 15:12:33 UTC (rev 6112)
+++ branches/OpenDNSSEC-1.3/NEWS	2012-01-30 15:39:04 UTC (rev 6113)
@@ -1,12 +1,16 @@
 $Id$
 
-OpenDNSSEC 1.3.6 -
+OpenDNSSEC 1.3.6
 
+* OPENDNSSEC-33: Signer Engine: Check HSM connection before use, attempt to
+  reconnect if it is not valid.
+
 Bugfixes:
 * Bugfix OPENDNSSEC-56: ods-ksmutil had the wrong option for config file in
   the help usage text.
+* Bugfix OPENDNSSEC-209: Signer Engine: Make output file adapter atomic by
+  writing signed file to an intermediate file first.
 
-
 OpenDNSSEC 1.3.5 -  2012-01-23
 
 * Auditor: Include the zone name in the log messages.

Modified: branches/OpenDNSSEC-1.3/signer/src/adapter/adfile.c
===================================================================
--- branches/OpenDNSSEC-1.3/signer/src/adapter/adfile.c	2012-01-30 15:12:33 UTC (rev 6112)
+++ branches/OpenDNSSEC-1.3/signer/src/adapter/adfile.c	2012-01-30 15:39:04 UTC (rev 6113)
@@ -430,6 +430,7 @@
 adfile_write(struct zone_struct* zone, const char* filename)
 {
     FILE* fd = NULL;
+    char* tmpname = NULL;
     zone_type* adzone = (zone_type*) zone;
     ods_status status = ODS_STATUS_OK;
 
@@ -449,13 +450,18 @@
     /* [end] sanity parameter checking */
 
     /* [start] write zone */
-    fd = ods_fopen(filename, NULL, "w");
+    tmpname = ods_build_path(filename, ".tmp", 0);
+    fd = ods_fopen(tmpname, NULL, "w");
     if (fd) {
         status = zone_print(fd, adzone);
         ods_fclose(fd);
     } else {
         status = ODS_STATUS_FOPEN_ERR;
     }
+    if (status == ODS_STATUS_OK) {
+        (void)rename((const char*) tmpname, filename);
+    }
+    free(tmpname);
     /* [end] write zone */
 
     return status;




More information about the Opendnssec-commits mailing list