2004-11-06 jrandom

* Expose a drop down on the /configclients.jsp to enter the outbound
      tunnel depth.
    * Improved *hosts.txt loading
    * Explicitly override the JVM's timezone settings to use GMT so that
      any client applications which use timezones won't leak sensitive
      data (thanks gott!)
    * Bundle sam.jar in the update (thanks duck!)
This commit is contained in:
jrandom
2004-11-07 02:25:13 +00:00
committed by zzz
parent 592e9dc3ff
commit 5f113f1610
8 changed files with 57 additions and 11 deletions

View File

@ -11,6 +11,7 @@ public class ConfigClientsHandler extends FormHandler {
private String _numClients; private String _numClients;
private String _numTunnels; private String _numTunnels;
private String _numHops; private String _numHops;
private String _numHopsOutbound;
private boolean _shouldSave; private boolean _shouldSave;
public void ConfigNetHandler() { public void ConfigNetHandler() {
@ -36,6 +37,9 @@ public class ConfigClientsHandler extends FormHandler {
public void setTunneldepth(String num) { public void setTunneldepth(String num) {
_numHops = (num != null ? num.trim() : null); _numHops = (num != null ? num.trim() : null);
} }
public void setTunneldepthoutbound(String num) {
_numHopsOutbound = (num != null ? num.trim() : null);
}
/** /**
* The user made changes to the network config and wants to save them, so * The user made changes to the network config and wants to save them, so
@ -63,6 +67,12 @@ public class ConfigClientsHandler extends FormHandler {
saveRequired = true; saveRequired = true;
} }
if ( (_numHopsOutbound != null) && (_numHopsOutbound.length() > 0) ) {
_context.router().setConfigSetting(ClientTunnelSettings.PROP_DEPTH_OUTBOUND, _numHopsOutbound);
addFormNotice("Updating default outbound tunnel length to " + _numHopsOutbound);
saveRequired = true;
}
if (saveRequired) { if (saveRequired) {
boolean saved = _context.router().saveConfig(); boolean saved = _context.router().saveConfig();
if (saved) if (saved)

View File

@ -114,4 +114,31 @@ public class ConfigClientsHelper {
buf.append("</select>\n"); buf.append("</select>\n");
return buf.toString(); return buf.toString();
} }
public String getTunnelDepthOutboundSelectBox() {
int count = ClientTunnelSettings.DEFAULT_DEPTH_OUTBOUND;
String val = _context.router().getConfigSetting(ClientTunnelSettings.PROP_DEPTH_OUTBOUND);
if (val != null) {
try {
count = Integer.parseInt(val);
} catch (NumberFormatException nfe) {
// ignore, use default from above
}
}
StringBuffer buf = new StringBuffer(1024);
buf.append("<select name=\"tunneldepthoutbound\">\n");
for (int i = 0; i < 4; i++) {
buf.append("<option value=\"").append(i).append("\" ");
if (count == i)
buf.append("selected=\"true\" ");
buf.append(">").append(i).append("</option>\n");
}
if (count >= 4) {
buf.append("<option value=\"").append(count);
buf.append("\" selected>").append(count);
buf.append("</option>\n");
}
buf.append("</select>\n");
return buf.toString();
}
} }

View File

@ -34,6 +34,8 @@
<jsp:getProperty name="clientshelper" property="tunnelCountSelectBox" /><br /> <jsp:getProperty name="clientshelper" property="tunnelCountSelectBox" /><br />
<b>Default number of hops per tunnel:</b> <b>Default number of hops per tunnel:</b>
<jsp:getProperty name="clientshelper" property="tunnelDepthSelectBox" /><br /> <jsp:getProperty name="clientshelper" property="tunnelDepthSelectBox" /><br />
<b>Hops per outbound tunnel:</b>
<jsp:getProperty name="clientshelper" property="tunnelDepthOutboundSelectBox" /><br />
<hr /> <hr />
<input type="submit" name="shouldsave" value="Save changes" /> <input type="reset" value="Cancel" /> <input type="submit" name="shouldsave" value="Save changes" /> <input type="reset" value="Cancel" />
</form> </form>

View File

@ -230,6 +230,7 @@
<copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" /> <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
<copy file="build/mstreaming.jar" todir="pkg-temp/lib/" /> <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
<copy file="build/streaming.jar" todir="pkg-temp/lib/" /> <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
<copy file="build/sam.jar" todir="pkg-temp/lib/" />
<copy file="build/router.jar" todir="pkg-temp/lib/" /> <copy file="build/router.jar" todir="pkg-temp/lib/" />
<copy file="build/routerconsole.jar" todir="pkg-temp/lib/" /> <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
<copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" /> <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />

View File

@ -16,6 +16,7 @@ import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.util.Log; import net.i2p.util.Log;
@ -61,12 +62,10 @@ public class HostsTxtNamingService extends NamingService {
for (int i = 0; i < filenames.size(); i++) { for (int i = 0; i < filenames.size(); i++) {
String hostsfile = (String)filenames.get(i); String hostsfile = (String)filenames.get(i);
Properties hosts = new Properties(); Properties hosts = new Properties();
FileInputStream fis = null;
try { try {
File f = new File(hostsfile); File f = new File(hostsfile);
if ( (f.exists()) && (f.canRead()) ) { if ( (f.exists()) && (f.canRead()) ) {
fis = new FileInputStream(f); DataHelper.loadProps(hosts, f);
hosts.load(fis);
String key = hosts.getProperty(hostname); String key = hosts.getProperty(hostname);
if ( (key != null) && (key.trim().length() > 0) ) { if ( (key != null) && (key.trim().length() > 0) ) {
@ -78,11 +77,6 @@ public class HostsTxtNamingService extends NamingService {
} }
} catch (Exception ioe) { } catch (Exception ioe) {
_log.error("Error loading hosts file " + hostsfile, ioe); _log.error("Error loading hosts file " + hostsfile, ioe);
} finally {
if (fis != null) try {
fis.close();
} catch (IOException ioe) { // nop
}
} }
// not found, continue to the next file // not found, continue to the next file
} }

View File

@ -1,4 +1,13 @@
$Id: history.txt,v 1.63 2004/11/05 05:53:41 jrandom Exp $ $Id: history.txt,v 1.64 2004/11/06 02:59:54 jrandom Exp $
2004-11-06 jrandom
* Expose a drop down on the /configclients.jsp to enter the outbound
tunnel depth.
* Improved *hosts.txt loading
* Explicitly override the JVM's timezone settings to use GMT so that
any client applications which use timezones won't leak sensitive
data (thanks gott!)
* Bundle sam.jar in the update (thanks duck!)
2004-11-06 jrandom 2004-11-06 jrandom
* Fix for a long standing synchronization bug in the SDK that in rare * Fix for a long standing synchronization bug in the SDK that in rare

View File

@ -80,6 +80,9 @@ public class Router {
System.setProperty("networkaddress.cache.ttl", "0"); System.setProperty("networkaddress.cache.ttl", "0");
// (no need for keepalive) // (no need for keepalive)
System.setProperty("http.keepAlive", "false"); System.setProperty("http.keepAlive", "false");
System.setProperty("user.timezone", "GMT");
// just in case, lets make it explicit...
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
} }
public Router() { this(null, null); } public Router() { this(null, null); }

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { public class RouterVersion {
public final static String ID = "$Revision: 1.69 $ $Date: 2004/11/05 05:53:40 $"; public final static String ID = "$Revision: 1.70 $ $Date: 2004/11/06 02:59:54 $";
public final static String VERSION = "0.4.1.3"; public final static String VERSION = "0.4.1.3";
public final static long BUILD = 10; public final static long BUILD = 11;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION); System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID); System.out.println("Router ID: " + RouterVersion.ID);