fix handling of IOExceptions when reading zone files (#20)
* fix handling of ioexceptions when reading zone files * bump the version
This commit is contained in:
parent
1406cd2e68
commit
12310b6b2d
@ -1,9 +1,13 @@
|
||||
2024-11-02 David Blacka <david@blacka.com>
|
||||
|
||||
* Handle I/O errors from ZoneUtils.readZoneFile() correctly (issue #19).
|
||||
|
||||
2024-04-13 David Blacka <david@blacka.com>
|
||||
|
||||
* Remove support for ECC_GOST
|
||||
* Create a new DSAlgorithm class, move DS creation into that
|
||||
* Add support for DS algorithms 3 and 4 -- bouncycastle crypto
|
||||
provider used for DS algoirthm 3 (GOST R 34.11-94)
|
||||
provider used for DS algorithm 3 (GOST R 34.11-94)
|
||||
* Moved support for loading the bouncycastle provider to the new
|
||||
DSAlgorithm class
|
||||
|
||||
|
@ -166,6 +166,10 @@
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
<target name="onejar"
|
||||
depends="build-onejar">
|
||||
</target>
|
||||
|
||||
<target name="dist"
|
||||
depends="bin-dist, src-dist, build-onejar, dist-clean">
|
||||
</target>
|
||||
|
@ -240,7 +240,12 @@ public class SignKeyset extends CLBase {
|
||||
|
||||
public void execute() throws Exception {
|
||||
// Read in the zone
|
||||
List<Record> records = ZoneUtils.readZoneFile(inputfile, null);
|
||||
List<Record> records = null;
|
||||
try {
|
||||
records = ZoneUtils.readZoneFile(inputfile, null);
|
||||
} catch (java.io.IOException e) {
|
||||
fail("Unable to read input file: " + e.getMessage());
|
||||
}
|
||||
if (records == null || records.isEmpty()) {
|
||||
fail("empty keyset file");
|
||||
}
|
||||
|
@ -211,7 +211,12 @@ public class SignRRset extends CLBase {
|
||||
|
||||
public void execute() throws Exception {
|
||||
// Read in the zone
|
||||
List<Record> records = ZoneUtils.readZoneFile(inputfile, null);
|
||||
List<Record> records = null;
|
||||
try {
|
||||
records = ZoneUtils.readZoneFile(inputfile, null);
|
||||
} catch (java.io.IOException e) {
|
||||
fail("Unable to read input file: " + e.getMessage());
|
||||
}
|
||||
if (records == null || records.isEmpty()) {
|
||||
fail("empty RRset file");
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class SignZone extends CLBase {
|
||||
private boolean fullySignKeyset = false;
|
||||
private List<Name> includeNames = null;
|
||||
private boolean useNsec3 = false;
|
||||
private byte[] salt = null;
|
||||
private byte[] salt = {};
|
||||
private int iterations = 0;
|
||||
private int digestId = DNSSEC.Digest.SHA256;
|
||||
private long nsec3paramttl = -1;
|
||||
@ -161,7 +161,7 @@ public class SignZone extends CLBase {
|
||||
start = Instant.now().minusSeconds(3600);
|
||||
}
|
||||
} catch (java.text.ParseException e) {
|
||||
fail("unable to parse start time specifiction: " + e);
|
||||
fail("unable to parse start time specifiction: " + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -172,7 +172,7 @@ public class SignZone extends CLBase {
|
||||
expire = Utils.convertDuration(start, "+2592000"); // 30 days
|
||||
}
|
||||
} catch (java.text.ParseException e) {
|
||||
fail("missing zone file and/or key files");
|
||||
fail("unable to parse end time specficiation: " + e.getMessage());
|
||||
}
|
||||
|
||||
outputfile = cli.getOptionValue('f');
|
||||
|
@ -100,7 +100,15 @@ public class VerifyZone extends CLBase {
|
||||
zoneverifier.getVerifier().setCurrentTime(currentTime);
|
||||
zoneverifier.setIgnoreDuplicateRRs(ignoreDups);
|
||||
|
||||
List<Record> records = ZoneUtils.readZoneFile(zonefile, null);
|
||||
List<Record> records = null;
|
||||
try {
|
||||
records = ZoneUtils.readZoneFile(zonefile, null);
|
||||
} catch (java.io.IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
if (records == null) {
|
||||
fail("Unable to read a zone file");
|
||||
}
|
||||
|
||||
log.fine("verifying zone...");
|
||||
int errors = zoneverifier.verifyZone(records);
|
||||
|
@ -58,13 +58,10 @@ public class ZoneUtils {
|
||||
*/
|
||||
public static List<Record> readZoneFile(String zonefile, Name origin) throws IOException {
|
||||
ArrayList<Record> records = new ArrayList<>();
|
||||
try (Master m = zonefile.equals("-") ? new Master(System.in) : new Master(zonefile, origin)) {
|
||||
Record r = null;
|
||||
while ((r = m.nextRecord()) != null) {
|
||||
records.add(r);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Master m = zonefile.equals("-") ? new Master(System.in) : new Master(zonefile, origin);
|
||||
Record r = null;
|
||||
while ((r = m.nextRecord()) != null) {
|
||||
records.add(r);
|
||||
}
|
||||
|
||||
return records;
|
||||
|
Loading…
Reference in New Issue
Block a user