file = File.createTempFile("zero", ".txt");
file.deleteOnExit();
(new FileWriter(file)).close();
aclDefault = new ServerAcl(file);
if (verbose) {
aclDefault.setPrintWriter(new PrintWriter(System.out));
}
acls.clear();
file = File.createTempFile("aclDenyAll1", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Deny all test ACL\n");
pw.println("deny 0.0.0.0/0");
pw.close();
acls.add(new ServerAcl(file));
aclDenyAlls = (ServerAcl[]) acls.toArray(new ServerAcl[0]);
if (verbose) {
for (int i = 0; i < aclDenyAlls.length; i++) {
aclDenyAlls[i].setPrintWriter(new PrintWriter(System.out));
}
}
acls.clear();
file = File.createTempFile("aclPermitLocalhost1", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Permit Localhost test ACL\n");
pw.println("permit 127.0.0.1");
pw.close();
acls.add(new ServerAcl(file));
file = File.createTempFile("aclPermitLocalhost2", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Permit Localhost test ACL\n");
pw.println("permit 127.0.0.1/32");
pw.close();
acls.add(new ServerAcl(file));
aclPermitLocalhosts = (ServerAcl[]) acls.toArray(new ServerAcl[0]);
if (verbose) {
for (int i = 0; i < aclPermitLocalhosts.length; i++) {
aclPermitLocalhosts[i].setPrintWriter(
new PrintWriter(System.out));
}
}
acls.clear();
file = File.createTempFile("aclPermitLocalNet1", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Permit Local Net test ACL\n");
pw.println("permit 127.0.0.0/24");
pw.close();
acls.add(new ServerAcl(file));
aclPermitLocalNets = (ServerAcl[]) acls.toArray(new ServerAcl[0]);
if (verbose) {
for (int i = 0; i < aclPermitLocalNets.length; i++) {
aclPermitLocalNets[i].setPrintWriter(
new PrintWriter(System.out));
}
}
acls.clear();
file = File.createTempFile("aclDenyLocalNet1", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Deny Local Net test ACL\n");
pw.println("deny 127.0.0.0/24");
pw.println("allow 0.0.0.0/0");
pw.close();
acls.add(new ServerAcl(file));
aclDenyLocalNets = (ServerAcl[]) acls.toArray(new ServerAcl[0]);
if (verbose) {
for (int i = 0; i < aclDenyLocalNets.length; i++) {
aclDenyLocalNets[i].setPrintWriter(
new PrintWriter(System.out));
}
}
acls.clear();
file = File.createTempFile("aclDenyLocalhost1", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Deny Localhost test ACL\n");
pw.println("deny 127.0.0.1/32");
pw.println("allow 0.0.0.0/0");
pw.close();
acls.add(new ServerAcl(file));
aclDenyLocalhosts = (ServerAcl[]) acls.toArray(new ServerAcl[0]);
if (verbose) {
for (int i = 0; i < aclDenyLocalhosts.length; i++) {
aclDenyLocalhosts[i].setPrintWriter(
new PrintWriter(System.out));
}
}
acls.clear();
file = File.createTempFile("aclPermitAll1", ".txt");
file.deleteOnExit();
pw = new PrintWriter(new FileWriter(file));
pw.println("# Permit all test ACL\n");
pw.println("permit 0.0.0.0/0");
pw.close();
acls.add(new ServerAcl(file));
aclPermitAlls = (ServerAcl[]) acls.toArray(new ServerAcl[0]);
if (verbose) {
for (int i = 0; i < aclPermitAlls.length; i++) {