From 7187f6f7142d9ceb227248910dd7503cb4b48276 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Wed, 6 Aug 2014 13:40:25 +0000
Subject: [PATCH]  * Console: Display full path to config file  * i2ptunnel:
 More escaping

---
 .../src/net/i2p/i2ptunnel/web/EditBean.java   | 49 ++++++++++---------
 .../i2p/router/web/ConfigAdvancedHelper.java  |  5 ++
 apps/routerconsole/jsp/configadvanced.jsp     |  2 +-
 .../src/net/i2p/router/RouterVersion.java     |  2 +-
 4 files changed, 33 insertions(+), 25 deletions(-)

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 c26d097395..0597db5f19 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
@@ -58,7 +58,7 @@ public class EditBean extends IndexBean {
     public String getTargetHost(int tunnel) {
         TunnelController tun = getController(tunnel);
         if (tun != null && tun.getTargetHost() != null)
-            return tun.getTargetHost();
+            return DataHelper.escapeHTML(tun.getTargetHost());
         else
             return "127.0.0.1";
     }
@@ -66,7 +66,7 @@ public class EditBean extends IndexBean {
     public String getTargetPort(int tunnel) {
         TunnelController tun = getController(tunnel);
         if (tun != null && tun.getTargetPort() != null)
-            return tun.getTargetPort();
+            return DataHelper.escapeHTML(tun.getTargetPort());
         else
             return "";
     }
@@ -74,7 +74,7 @@ public class EditBean extends IndexBean {
     public String getSpoofedHost(int tunnel) {
         TunnelController tun = getController(tunnel);
         if (tun != null && tun.getSpoofedHost() != null)
-            return tun.getSpoofedHost();
+            return DataHelper.escapeHTML(tun.getSpoofedHost());
         else
             return "";
     }
@@ -295,44 +295,44 @@ public class EditBean extends IndexBean {
     }
 
     /** all of these are @since 0.8.3 */
-    public String getLimitMinute(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_CONNS_MIN, "0");
+    public int getLimitMinute(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_CONNS_MIN, 0);
     }
 
-    public String getLimitHour(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_CONNS_HOUR, "0");
+    public int getLimitHour(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_CONNS_HOUR, 0);
     }
 
-    public String getLimitDay(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_CONNS_DAY, "0");
+    public int getLimitDay(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_CONNS_DAY, 0);
     }
 
-    public String getTotalMinute(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_TOTAL_CONNS_MIN, "0");
+    public int getTotalMinute(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_TOTAL_CONNS_MIN, 0);
     }
 
-    public String getTotalHour(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_TOTAL_CONNS_HOUR, "0");
+    public int getTotalHour(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_TOTAL_CONNS_HOUR, 0);
     }
 
-    public String getTotalDay(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_TOTAL_CONNS_DAY, "0");
+    public int getTotalDay(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_TOTAL_CONNS_DAY, 0);
     }
 
-    public String getMaxStreams(int tunnel) {
-        return getProperty(tunnel, PROP_MAX_STREAMS, "0");
+    public int getMaxStreams(int tunnel) {
+        return getProperty(tunnel, PROP_MAX_STREAMS, 0);
     }
 
     /**
      * POST limits
      * @since 0.9.9
      */
-    public String getPostMax(int tunnel) {
-        return getProperty(tunnel, I2PTunnelHTTPServer.OPT_POST_MAX, "0");
+    public int getPostMax(int tunnel) {
+        return getProperty(tunnel, I2PTunnelHTTPServer.OPT_POST_MAX, 0);
     }
 
-    public String getPostTotalMax(int tunnel) {
-        return getProperty(tunnel, I2PTunnelHTTPServer.OPT_POST_TOTAL_MAX, "0");
+    public int getPostTotalMax(int tunnel) {
+        return getProperty(tunnel, I2PTunnelHTTPServer.OPT_POST_TOTAL_MAX, 0);
     }
 
     public int getPostCheckTime(int tunnel) {
@@ -371,8 +371,11 @@ public class EditBean extends IndexBean {
         TunnelController tun = getController(tunnel);
         if (tun != null) {
             Properties opts = getOptions(tun);
-            if (opts != null)
-                return opts.getProperty(prop, def);
+            if (opts != null) {
+                String rv = opts.getProperty(prop);
+                if (rv != null)
+                    return DataHelper.escapeHTML(rv);
+            }
         }
         return def;
     }
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHelper.java
index 02f9b05cb2..cbdad00372 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHelper.java
@@ -19,4 +19,9 @@ public class ConfigAdvancedHelper extends HelperBase {
         }
         return buf.toString();
     }
+
+    /** @since 0.9.14.1 */
+    public String getConfigFileName() {
+        return _context.router().getConfigFilename();
+    }
 }
diff --git a/apps/routerconsole/jsp/configadvanced.jsp b/apps/routerconsole/jsp/configadvanced.jsp
index 12389fa2d4..c6f0e78fbb 100644
--- a/apps/routerconsole/jsp/configadvanced.jsp
+++ b/apps/routerconsole/jsp/configadvanced.jsp
@@ -38,6 +38,6 @@
  <br><b><%=intl._("NOTE")%>:</b> <%=intl._("Some changes may require a restart to take effect.")%>
  </div></form>
 <% } else { %>
-To make changes, edit the router.config file.
+<%=intl._("To make changes, edit the file {0}.", "<tt>" + advancedhelper.getConfigFileName() + "</tt>")%>
 <% }  // isAdvanced %>
 </div></div></div></body></html>
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index f6ba057e65..ba403a9f3e 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -18,7 +18,7 @@ public class RouterVersion {
     /** deprecated */
     public final static String ID = "Monotone";
     public final static String VERSION = CoreVersion.VERSION;
-    public final static long BUILD = 4;
+    public final static long BUILD = 5;
 
     /** for example "-test" */
     public final static String EXTRA = "-rc";
-- 
GitLab