From: adam Date: Tue, 17 Jan 2006 03:01:01 +0000 (+0000) Subject: check for WEB-INF file before creating a host X-Git-Url: http://git.megacz.com/?p=org.ibex.jinetd.git;a=commitdiff_plain;h=97722e0cfb8199cfa5bc18909d0103789e745678 check for WEB-INF file before creating a host darcs-hash:20060117030101-5007d-8002c2e91b34c7afef6d6addc1a04fd24458cd8b.gz --- diff --git a/src/org/ibex/jinetd/Host.java b/src/org/ibex/jinetd/Host.java index 8df789f..96dcf13 100644 --- a/src/org/ibex/jinetd/Host.java +++ b/src/org/ibex/jinetd/Host.java @@ -33,17 +33,31 @@ public class Host extends TreeClassLoader { } public static void init(String path, String host, int depth, ClassLoader pcl) { try { - InetAddress.getByName(host); - String pad = ""; - while(pad.length() + host.length() < 30) pad += " "; - Log.info(Main.class, pad + host + " => " + path); - hosts.put(host, pcl = new Host(path, host, pcl)); + InetAddress addr = InetAddress.getByName(host); + /* + boolean good = false; + try { + if (NetworkInterface.getByInetAddress(addr) != null) good = true; + if (!good) Log.warn(Host.class, "host " + host + "resolves to " + addr + " which is not local"); + } catch (Exception e) { + Log.warn(Host.class, "host " + host + "resolves to " + addr + " which is not local because:"); + Log.warn(Host.class, e); + } + if (!good) return; + */ + if (new File(path + File.separatorChar + "WEB-INF").exists()) { + String pad = ""; + while(pad.length() + host.length() < 30) pad += " "; + Log.info(Main.class, pad + host + " => " + path); + hosts.put(host, pcl = new Host(path, host, pcl)); + } } catch (UnknownHostException e) { if (depth >= 3) return; } String[] subdirs = new File(path).list(); - for(int i=0; i