diff --git a/Slackware/i2p/i2p.SlackBuild b/Slackware/i2p/i2p.SlackBuild
index 421033356..3bb2c9503 100755
--- a/Slackware/i2p/i2p.SlackBuild
+++ b/Slackware/i2p/i2p.SlackBuild
@@ -65,7 +65,7 @@ cd $CWD/../../
ant distclean
ant dist
-
+ant tarball
tar xjvf i2p.tar.bz2 -C $TMP
diff --git a/apps/BOB/nbproject/private/private.xml b/apps/BOB/nbproject/private/private.xml
index 2482568bf..237b674f1 100644
--- a/apps/BOB/nbproject/private/private.xml
+++ b/apps/BOB/nbproject/private/private.xml
@@ -2,6 +2,6 @@
\n");
- StringBuffer opts = new StringBuffer(64);
+ StringBuilder opts = new StringBuilder(64);
Map options = new TreeMap(_manager.util().getI2CPOptions());
for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
index 79270303b..65941f3ba 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
@@ -179,7 +179,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
out = s.getOutputStream();
in = s.getInputStream();
String line, method = null, host = null, destination = null, restofline = null;
- StringBuffer newRequest = new StringBuffer();
+ StringBuilder newRequest = new StringBuilder();
int ahelper = 0;
while (true) {
// Use this rather than BufferedReader because we can't have readahead,
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
index 8dabdc0f6..f450682cd 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
@@ -240,7 +240,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
out = s.getOutputStream();
InputReader reader = new InputReader(s.getInputStream());
String line, method = null, protocol = null, host = null, destination = null;
- StringBuffer newRequest = new StringBuffer();
+ StringBuilder newRequest = new StringBuilder();
int ahelper = 0;
while ((line = reader.readLine(method)) != null) {
line = line.trim();
@@ -811,11 +811,14 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
* but inproxy/gateway ops would be wise to block proxy.i2p to prevent
* exposing the docs/ directory or perhaps other issues through
* uncaught vulnerabilities.
+ * Restrict to the /themes/ directory for now.
*
- * @param targetRequest "proxy.i2p/foo.png HTTP/1.1"
+ * @param targetRequest "proxy.i2p/themes/foo.png HTTP/1.1"
*/
private static void serveLocalFile(OutputStream out, String method, String targetRequest) {
- if (method.equals("GET") || method.equals("HEAD")) {
+ if ((method.equals("GET") || method.equals("HEAD")) &&
+ targetRequest.startsWith("proxy.i2p/themes/") &&
+ !targetRequest.contains("..")) {
int space = targetRequest.indexOf(' ');
String filename = null;
try {
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java
index d43639cb7..e1ce9084e 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java
@@ -19,6 +19,7 @@ import net.i2p.data.DataHelper;
import net.i2p.util.EventDispatcher;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
+import net.i2p.data.Base32;
/**
* Simple extension to the I2PTunnelServer that filters the HTTP
@@ -33,6 +34,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
/** what Host: should we seem to be to the webserver? */
private String _spoofHost;
private static final String HASH_HEADER = "X-I2P-DestHash";
+ private static final String DEST64_HEADER = "X-I2P-DestB64";
+ private static final String DEST32_HEADER = "X-I2P-DestB32";
public I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privData, l, notifyThis, tunnel);
@@ -71,9 +74,12 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
InputStream in = socket.getInputStream();
- StringBuffer command = new StringBuffer(128);
+ StringBuilder command = new StringBuilder(128);
Properties headers = readHeaders(in, command);
headers.setProperty(HASH_HEADER, socket.getPeerDestination().calculateHash().toBase64());
+ headers.setProperty(DEST32_HEADER, Base32.encode(socket.getPeerDestination().calculateHash().getData()) + ".b32.i2p" );
+ headers.setProperty(DEST64_HEADER, socket.getPeerDestination().toBase64());
+
if ( (_spoofHost != null) && (_spoofHost.trim().length() > 0) )
headers.setProperty("Host", _spoofHost);
headers.setProperty("Connection", "close");
@@ -303,8 +309,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
}
}
- private String formatHeaders(Properties headers, StringBuffer command) {
- StringBuffer buf = new StringBuffer(command.length() + headers.size() * 64);
+ private String formatHeaders(Properties headers, StringBuilder command) {
+ StringBuilder buf = new StringBuilder(command.length() + headers.size() * 64);
buf.append(command.toString().trim()).append("\r\n");
for (Iterator iter = headers.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
@@ -315,9 +321,9 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
return buf.toString();
}
- private Properties readHeaders(InputStream in, StringBuffer command) throws IOException {
+ private Properties readHeaders(InputStream in, StringBuilder command) throws IOException {
Properties headers = new Properties();
- StringBuffer buf = new StringBuffer(128);
+ StringBuilder buf = new StringBuilder(128);
boolean ok = DataHelper.readLine(in, command);
if (!ok) throw new IOException("EOF reached while reading the HTTP command [" + command.toString() + "]");
@@ -361,6 +367,10 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
name = "X-Accept-encoding";
else if (HASH_HEADER.equalsIgnoreCase(name))
continue; // Prevent spoofing
+ else if (DEST64_HEADER.equalsIgnoreCase(name))
+ continue; // Prevent spoofing
+ else if (DEST32_HEADER.equalsIgnoreCase(name))
+ continue; // Prevent spoofing
headers.setProperty(name, value);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Read the header [" + name + "] = [" + value + "]");
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java
index 3b5bff785..dd8c289d9 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java
@@ -82,7 +82,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
try {
i2ps = createI2PSocket(dest);
i2ps.setReadTimeout(readTimeout);
- StringBuffer expectedPong = new StringBuffer();
+ StringBuilder expectedPong = new StringBuilder();
Thread in = new I2PThread(new IrcInboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " in");
in.start();
Thread out = new I2PThread(new IrcOutboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " out");
@@ -121,9 +121,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
private Socket local;
private I2PSocket remote;
- private StringBuffer expectedPong;
+ private StringBuilder expectedPong;
- IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong) {
+ IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuilder pong) {
local=_local;
remote=_remote;
expectedPong=pong;
@@ -195,9 +195,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
private Socket local;
private I2PSocket remote;
- private StringBuffer expectedPong;
+ private StringBuilder expectedPong;
- IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong) {
+ IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuilder pong) {
local=_local;
remote=_remote;
expectedPong=pong;
@@ -266,7 +266,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
*
*/
- public String inboundFilter(String s, StringBuffer expectedPong) {
+ public String inboundFilter(String s, StringBuilder expectedPong) {
String field[]=s.split(" ",4);
String command;
@@ -353,7 +353,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
return null;
}
- public String outboundFilter(String s, StringBuffer expectedPong) {
+ public String outboundFilter(String s, StringBuilder expectedPong) {
String field[]=s.split(" ",3);
String command;
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java
index 2e209dbd7..6e0427095 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java
@@ -135,7 +135,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
/** keep reading until we see USER or SERVER */
private String filterRegistration(InputStream in, String newHostname) throws IOException {
- StringBuffer buf = new StringBuffer(128);
+ StringBuilder buf = new StringBuilder(128);
int lineCount = 0;
while (true) {
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2Ping.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2Ping.java
index f57ecd23d..1f358abf0 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2Ping.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2Ping.java
@@ -211,7 +211,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
int fail = 0;
long totalTime = 0;
int cnt = countPing ? CPING_COUNT : PING_COUNT;
- StringBuffer pingResults = new StringBuffer(2 * cnt + destination.length() + 3);
+ StringBuilder pingResults = new StringBuilder(2 * cnt + destination.length() + 3);
for (int i = 0; i < cnt; i++) {
boolean sent;
sent = ping(dest);
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java
index 3dbcfea30..6efff96e5 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java
@@ -385,7 +385,7 @@ public class TunnelController implements Logging {
public String getI2CPHost() { return _config.getProperty("i2cpHost"); }
public String getI2CPPort() { return _config.getProperty("i2cpPort"); }
public String getClientOptions() {
- StringBuffer opts = new StringBuffer(64);
+ StringBuilder opts = new StringBuilder(64);
for (Iterator iter = _config.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next();
String val = _config.getProperty(key);
@@ -447,7 +447,7 @@ public class TunnelController implements Logging {
return true;
}
- public void getSummary(StringBuffer buf) {
+ public void getSummary(StringBuilder buf) {
String type = getType();
if ("httpclient".equals(type))
getHttpClientSummary(buf);
@@ -461,7 +461,7 @@ public class TunnelController implements Logging {
buf.append("Unknown type ").append(type);
}
- private void getHttpClientSummary(StringBuffer buf) {
+ private void getHttpClientSummary(StringBuilder buf) {
String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) )
buf.append("").append(description).append("
\n");
@@ -482,7 +482,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf);
}
- private void getClientSummary(StringBuffer buf) {
+ private void getClientSummary(StringBuilder buf) {
String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) )
buf.append("").append(description).append("
\n");
@@ -499,7 +499,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf);
}
- private void getServerSummary(StringBuffer buf) {
+ private void getServerSummary(StringBuilder buf) {
String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) )
buf.append("").append(description).append("
\n");
@@ -510,7 +510,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf);
}
- private void getHttpServerSummary(StringBuffer buf) {
+ private void getHttpServerSummary(StringBuilder buf) {
String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) )
buf.append("").append(description).append("
\n");
@@ -522,7 +522,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf);
}
- private void getOptionSummary(StringBuffer buf) {
+ private void getOptionSummary(StringBuilder buf) {
String opts = getClientOptions();
if ( (opts != null) && (opts.length() > 0) )
buf.append("Network options: ").append(opts).append("
\n");
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java
index 88877ff4c..b077179e0 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java
@@ -245,7 +245,7 @@ public class TunnelControllerGroup {
map.putAll(cur);
}
- StringBuffer buf = new StringBuffer(1024);
+ StringBuilder buf = new StringBuilder(1024);
for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next();
String val = (String)map.get(key);
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java
index 23ec70c3f..ef88102cf 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java
@@ -123,7 +123,7 @@ public class SOCKS4aServer extends SOCKSServer {
}
private String readString(DataInputStream in) throws IOException {
- StringBuffer sb = new StringBuffer(16);
+ StringBuilder sb = new StringBuilder(16);
char c;
while ((c = (char) (in.readByte() & 0xff)) != 0)
sb.append(c);
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
index d606467c5..fe1096eea 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
@@ -223,7 +223,7 @@ public class EditBean extends IndexBean {
if (tun != null) {
Properties opts = getOptions(tun);
if (opts == null) return "";
- StringBuffer buf = new StringBuffer(64);
+ StringBuilder buf = new StringBuilder(64);
int i = 0;
for (Iterator iter = opts.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
index 4c23ced34..48bb984b6 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
@@ -302,7 +302,7 @@ public class IndexBean {
if (_group == null)
return "";
- StringBuffer buf = new StringBuffer(512);
+ StringBuilder buf = new StringBuilder(512);
if (_action != null) {
try {
buf.append(processAction()).append("\n");
@@ -927,11 +927,11 @@ public class IndexBean {
}
private String getMessages(List msgs) {
- StringBuffer buf = new StringBuffer(128);
+ StringBuilder buf = new StringBuilder(128);
getMessages(msgs, buf);
return buf.toString();
}
- private void getMessages(List msgs, StringBuffer buf) {
+ private void getMessages(List msgs, StringBuilder buf) {
if (msgs == null) return;
for (int i = 0; i < msgs.size(); i++) {
buf.append((String)msgs.get(i)).append("\n");
diff --git a/apps/i2ptunnel/jsp/editClient.jsp b/apps/i2ptunnel/jsp/editClient.jsp
index 4f0a5a338..26e40afad 100644
--- a/apps/i2ptunnel/jsp/editClient.jsp
+++ b/apps/i2ptunnel/jsp/editClient.jsp
@@ -18,7 +18,7 @@
<% if (editBean.allowCSS()) {
- %>
+ %>
<% }
@@ -388,7 +388,7 @@
-
+
(if known)
diff --git a/apps/i2ptunnel/jsp/editServer.jsp b/apps/i2ptunnel/jsp/editServer.jsp
index 3a958fd42..2acc75183 100644
--- a/apps/i2ptunnel/jsp/editServer.jsp
+++ b/apps/i2ptunnel/jsp/editServer.jsp
@@ -18,7 +18,7 @@
<% if (editBean.allowCSS()) {
- %>
+ %>
<% }
@@ -148,7 +148,7 @@
-
+
<% if (!"".equals(editBean.getDestinationBase64(curTunnel))) { %>
Add to local addressbook
<% } %>
@@ -270,7 +270,7 @@
-
+
| Client | Run at Startup? | Start Now | Class and arguments |
|---|
| WebApp | Run at Startup? | Start Now | Description |
|---|---|---|---|
| "); if (urlify && enabled) { String link = "/"; diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java index 635d2e544..fa32340a8 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java @@ -29,7 +29,7 @@ public class ConfigLoggingHelper extends HelperBase { return (bytes/(1024)) + "k"; } public String getLogLevelTable() { - StringBuffer buf = new StringBuffer(32*1024); + StringBuilder buf = new StringBuilder(32*1024); Properties limits = _context.logManager().getLimits(); TreeSet sortedLogs = new TreeSet(); for (Iterator iter = limits.keySet().iterator(); iter.hasNext(); ) { @@ -51,7 +51,7 @@ public class ConfigLoggingHelper extends HelperBase { } public String getDefaultLogLevelBox() { String cur = _context.logManager().getDefaultLimit(); - StringBuffer buf = new StringBuffer(128); + StringBuilder buf = new StringBuilder(128); buf.append(" |