fix infloop when skipping queries; add debug logging
This commit is contained in:
parent
3360e70e88
commit
f17ea4256e
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
<target name="usage">
|
<target name="usage">
|
||||||
<echo message=" " />
|
<echo message=" " />
|
||||||
<echo message="DNSSECReconciler v. ${version} Build System" />
|
<echo message="DNSSECValTool v. ${version} Build System" />
|
||||||
<echo message="--------------------------------" />
|
<echo message="--------------------------------" />
|
||||||
<echo message="Available Targets:" />
|
<echo message="Available Targets:" />
|
||||||
<echo message=" compile - compiles the source code" />
|
<echo message=" compile - compiles the source code" />
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
|
|
||||||
####################################################################
|
|
||||||
#
|
|
||||||
# L O G 4 j A P P E N D E R s
|
|
||||||
#
|
|
||||||
###################################################################
|
|
||||||
|
|
||||||
###################
|
|
||||||
# Write Output to Console (aka TTY)
|
|
||||||
#
|
|
||||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
|
|
||||||
|
|
||||||
####################################################################
|
|
||||||
#
|
|
||||||
# R O O T D E B U G G I N G L E V E L
|
|
||||||
#
|
|
||||||
###################################################################
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Set root logger level to an (Appender)
|
|
||||||
#
|
|
||||||
log4j.rootLogger=FATAL, console
|
|
@ -5,6 +5,8 @@ import java.net.SocketTimeoutException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.log4j.BasicConfigurator;
|
import org.apache.log4j.BasicConfigurator;
|
||||||
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.xbill.DNS.*;
|
import org.xbill.DNS.*;
|
||||||
|
|
||||||
import com.verisign.tat.dnssec.CaptiveValidator;
|
import com.verisign.tat.dnssec.CaptiveValidator;
|
||||||
@ -32,6 +34,7 @@ public class DNSSECValTool {
|
|||||||
public List<String> dnskeyNames;
|
public List<String> dnskeyNames;
|
||||||
public String errorFile;
|
public String errorFile;
|
||||||
public long count = 0;
|
public long count = 0;
|
||||||
|
public boolean debug = false;
|
||||||
|
|
||||||
DNSSECValTool() {
|
DNSSECValTool() {
|
||||||
validator = new CaptiveValidator();
|
validator = new CaptiveValidator();
|
||||||
@ -215,11 +218,20 @@ public class DNSSECValTool {
|
|||||||
Name zone = zoneFromQuery(query);
|
Name zone = zoneFromQuery(query);
|
||||||
// Skip queries in zones that we don't have keys for
|
// Skip queries in zones that we don't have keys for
|
||||||
if (zone == null) {
|
if (zone == null) {
|
||||||
|
if (debug) {
|
||||||
|
System.out.println("DEBUG: skipping query " + queryToString(query));
|
||||||
|
}
|
||||||
|
query = nextQuery();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
System.out.println("DEBUG: querying for: " + queryToString(query));
|
||||||
|
}
|
||||||
|
|
||||||
Message response = resolve(query);
|
Message response = resolve(query);
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
|
System.out.println("ERROR: No response for query: " + queryToString(query));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
byte result = validator.validateMessage(response, zone.toString());
|
byte result = validator.validateMessage(response, zone.toString());
|
||||||
@ -248,6 +260,7 @@ public class DNSSECValTool {
|
|||||||
errorCount++;
|
errorCount++;
|
||||||
break;
|
break;
|
||||||
case SecurityStatus.SECURE:
|
case SecurityStatus.SECURE:
|
||||||
|
if (debug) System.out.println("DEBUG: response for " + queryToString(query) + " was valid.");
|
||||||
validCount++;
|
validCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -258,6 +271,7 @@ public class DNSSECValTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count > 0 && total >= count) {
|
if (count > 0 && total >= count) {
|
||||||
|
if (debug) System.out.println("DEBUG: reached maximum number of queries, exiting");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +298,9 @@ public class DNSSECValTool {
|
|||||||
|
|
||||||
// Set up Log4J to just log to console.
|
// Set up Log4J to just log to console.
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
|
// And raise the log level quite high
|
||||||
|
Logger rootLogger = Logger.getRootLogger();
|
||||||
|
rootLogger.setLevel(Level.FATAL);
|
||||||
|
|
||||||
DNSSECValTool dr = new DNSSECValTool();
|
DNSSECValTool dr = new DNSSECValTool();
|
||||||
|
|
||||||
@ -318,6 +335,8 @@ public class DNSSECValTool {
|
|||||||
dr.dnskeyNames = new ArrayList<String>();
|
dr.dnskeyNames = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
dr.dnskeyNames.add(optarg);
|
dr.dnskeyNames.add(optarg);
|
||||||
|
} else if (opt.equals("debug")) {
|
||||||
|
dr.debug = Boolean.parseBoolean(optarg);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Unrecognized option: " + opt);
|
System.err.println("Unrecognized option: " + opt);
|
||||||
usage();
|
usage();
|
||||||
|
Loading…
Reference in New Issue
Block a user