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>
|
2024-04-13 David Blacka <david@blacka.com>
|
||||||
|
|
||||||
* Remove support for ECC_GOST
|
* Remove support for ECC_GOST
|
||||||
* Create a new DSAlgorithm class, move DS creation into that
|
* Create a new DSAlgorithm class, move DS creation into that
|
||||||
* Add support for DS algorithms 3 and 4 -- bouncycastle crypto
|
* 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
|
* Moved support for loading the bouncycastle provider to the new
|
||||||
DSAlgorithm class
|
DSAlgorithm class
|
||||||
|
|
||||||
|
@ -166,6 +166,10 @@
|
|||||||
</tar>
|
</tar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="onejar"
|
||||||
|
depends="build-onejar">
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="dist"
|
<target name="dist"
|
||||||
depends="bin-dist, src-dist, build-onejar, dist-clean">
|
depends="bin-dist, src-dist, build-onejar, dist-clean">
|
||||||
</target>
|
</target>
|
||||||
|
@ -240,7 +240,12 @@ public class SignKeyset extends CLBase {
|
|||||||
|
|
||||||
public void execute() throws Exception {
|
public void execute() throws Exception {
|
||||||
// Read in the zone
|
// 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()) {
|
if (records == null || records.isEmpty()) {
|
||||||
fail("empty keyset file");
|
fail("empty keyset file");
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,12 @@ public class SignRRset extends CLBase {
|
|||||||
|
|
||||||
public void execute() throws Exception {
|
public void execute() throws Exception {
|
||||||
// Read in the zone
|
// 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()) {
|
if (records == null || records.isEmpty()) {
|
||||||
fail("empty RRset file");
|
fail("empty RRset file");
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class SignZone extends CLBase {
|
|||||||
private boolean fullySignKeyset = false;
|
private boolean fullySignKeyset = false;
|
||||||
private List<Name> includeNames = null;
|
private List<Name> includeNames = null;
|
||||||
private boolean useNsec3 = false;
|
private boolean useNsec3 = false;
|
||||||
private byte[] salt = null;
|
private byte[] salt = {};
|
||||||
private int iterations = 0;
|
private int iterations = 0;
|
||||||
private int digestId = DNSSEC.Digest.SHA256;
|
private int digestId = DNSSEC.Digest.SHA256;
|
||||||
private long nsec3paramttl = -1;
|
private long nsec3paramttl = -1;
|
||||||
@ -161,7 +161,7 @@ public class SignZone extends CLBase {
|
|||||||
start = Instant.now().minusSeconds(3600);
|
start = Instant.now().minusSeconds(3600);
|
||||||
}
|
}
|
||||||
} catch (java.text.ParseException e) {
|
} catch (java.text.ParseException e) {
|
||||||
fail("unable to parse start time specifiction: " + e);
|
fail("unable to parse start time specifiction: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -172,7 +172,7 @@ public class SignZone extends CLBase {
|
|||||||
expire = Utils.convertDuration(start, "+2592000"); // 30 days
|
expire = Utils.convertDuration(start, "+2592000"); // 30 days
|
||||||
}
|
}
|
||||||
} catch (java.text.ParseException e) {
|
} 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');
|
outputfile = cli.getOptionValue('f');
|
||||||
|
@ -100,7 +100,15 @@ public class VerifyZone extends CLBase {
|
|||||||
zoneverifier.getVerifier().setCurrentTime(currentTime);
|
zoneverifier.getVerifier().setCurrentTime(currentTime);
|
||||||
zoneverifier.setIgnoreDuplicateRRs(ignoreDups);
|
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...");
|
log.fine("verifying zone...");
|
||||||
int errors = zoneverifier.verifyZone(records);
|
int errors = zoneverifier.verifyZone(records);
|
||||||
|
@ -58,14 +58,11 @@ public class ZoneUtils {
|
|||||||
*/
|
*/
|
||||||
public static List<Record> readZoneFile(String zonefile, Name origin) throws IOException {
|
public static List<Record> readZoneFile(String zonefile, Name origin) throws IOException {
|
||||||
ArrayList<Record> records = new ArrayList<>();
|
ArrayList<Record> records = new ArrayList<>();
|
||||||
try (Master m = zonefile.equals("-") ? new Master(System.in) : new Master(zonefile, origin)) {
|
Master m = zonefile.equals("-") ? new Master(System.in) : new Master(zonefile, origin);
|
||||||
Record r = null;
|
Record r = null;
|
||||||
while ((r = m.nextRecord()) != null) {
|
while ((r = m.nextRecord()) != null) {
|
||||||
records.add(r);
|
records.add(r);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user