forked from I2P_Developers/i2p.i2p
Debian: Fix patches for Jetty 9.3.28 (ticket #2098)
Add xenial patch to ant test target
This commit is contained in:
10
build.xml
10
build.xml
@ -2592,16 +2592,26 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="debcheckpatch">
|
<target name="debcheckpatch">
|
||||||
|
<echo message="Checking debian/patches/0001-path-substitution.patch" />
|
||||||
<exec executable="patch" failonerror="true" input="debian/patches/0001-path-substitution.patch" >
|
<exec executable="patch" failonerror="true" input="debian/patches/0001-path-substitution.patch" >
|
||||||
<arg value="--dry-run" />
|
<arg value="--dry-run" />
|
||||||
<arg value="-F0" />
|
<arg value="-F0" />
|
||||||
<arg value="-p1" />
|
<arg value="-p1" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<echo />
|
||||||
|
<echo message="Checking debian/patches/0002-jetty-compatibility.patch" />
|
||||||
<exec executable="patch" failonerror="true" input="debian/patches/0002-jetty-compatibility.patch" >
|
<exec executable="patch" failonerror="true" input="debian/patches/0002-jetty-compatibility.patch" >
|
||||||
<arg value="--dry-run" />
|
<arg value="--dry-run" />
|
||||||
<arg value="-F0" />
|
<arg value="-F0" />
|
||||||
<arg value="-p1" />
|
<arg value="-p1" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<echo />
|
||||||
|
<echo message="Checking debian-alt/xenial/patches/0002-jetty-old-api.patch" />
|
||||||
|
<exec executable="patch" failonerror="true" input="debian-alt/xenial/patches/0002-jetty-old-api.patch" >
|
||||||
|
<arg value="--dry-run" />
|
||||||
|
<arg value="-F0" />
|
||||||
|
<arg value="-p1" />
|
||||||
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,29 @@
|
|||||||
|
Index: b/apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java
|
||||||
|
============================================================
|
||||||
|
--- a/apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java
|
||||||
|
+++ b/apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java
|
||||||
|
@@ -317,7 +317,7 @@ public class I2PRequestLog extends Abstr
|
||||||
|
buf.append(request.getMethod());
|
||||||
|
buf.append(' ');
|
||||||
|
|
||||||
|
- u8buf.append(request.getHttpURI().toString());
|
||||||
|
+ request.getUri().writeTo(u8buf);
|
||||||
|
|
||||||
|
buf.append(' ');
|
||||||
|
buf.append(request.getProtocol());
|
||||||
Index: b/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
Index: b/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
--- a/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
||||||
+++ b/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
+++ b/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
||||||
|
@@ -15,7 +15,7 @@ import org.eclipse.jetty.server.Request;
|
||||||
|
import net.i2p.util.PortMapper;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.server.Request;
|
||||||
|
-import org.eclipse.jetty.server.handler.gzip.GzipHandler;
|
||||||
|
+import org.eclipse.jetty.servlets.gzip.GzipHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block certain Host headers to prevent DNS rebinding attacks.
|
||||||
@@ -44,19 +44,12 @@ public class HostCheckHandler extends Gz
|
@@ -44,19 +44,12 @@ public class HostCheckHandler extends Gz
|
||||||
_listenHosts = new HashSet<String>(8);
|
_listenHosts = new HashSet<String>(8);
|
||||||
setMinGzipSize(64*1024);
|
setMinGzipSize(64*1024);
|
||||||
@ -24,3 +46,18 @@ Index: b/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Index: b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
||||||
|
============================================================
|
||||||
|
--- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
||||||
|
+++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
||||||
|
@@ -1085,8 +1085,8 @@ public class RouterConsoleRunner impleme
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
- public UserIdentity login(String username, Object credentials, ServletRequest request) {
|
||||||
|
- UserIdentity rv = super.login(username, credentials, request);
|
||||||
|
+ public UserIdentity login(String username, Object credentials) {
|
||||||
|
+ UserIdentity rv = super.login(username, credentials);
|
||||||
|
if (rv == null)
|
||||||
|
//_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, webapp: " + _webapp + ", user: " + username);
|
||||||
|
_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, user: " + username);
|
||||||
|
96
debian/patches/0002-jetty-compatibility.patch
vendored
96
debian/patches/0002-jetty-compatibility.patch
vendored
@ -23,39 +23,9 @@
|
|||||||
protected void sendDirectory(HttpServletRequest request,
|
protected void sendDirectory(HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
Resource resource,
|
Resource resource,
|
||||||
--- a/apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java
|
|
||||||
+++ b/apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java
|
|
||||||
@@ -317,7 +317,7 @@
|
|
||||||
buf.append(request.getMethod());
|
|
||||||
buf.append(' ');
|
|
||||||
|
|
||||||
- request.getUri().writeTo(u8buf);
|
|
||||||
+ u8buf.append(request.getHttpURI().toString());
|
|
||||||
|
|
||||||
buf.append(' ');
|
|
||||||
buf.append(request.getProtocol());
|
|
||||||
--- a/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
|
||||||
+++ b/apps/routerconsole/java/src/net/i2p/router/web/HostCheckHandler.java
|
|
||||||
@@ -15,7 +15,7 @@
|
|
||||||
import net.i2p.util.PortMapper;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.server.Request;
|
|
||||||
-import org.eclipse.jetty.servlets.gzip.GzipHandler;
|
|
||||||
+import org.eclipse.jetty.server.handler.gzip.GzipHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Block certain Host headers to prevent DNS rebinding attacks.
|
|
||||||
--- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
--- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
||||||
+++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
+++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
||||||
@@ -22,6 +22,7 @@
|
@@ -49,6 +50,7 @@
|
||||||
import java.util.SortedSet;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
+import javax.servlet.ServletRequest;
|
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
|
||||||
import net.i2p.app.ClientApp;
|
|
||||||
@@ -48,6 +49,7 @@
|
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
import org.eclipse.jetty.security.HashLoginService;
|
||||||
import org.eclipse.jetty.security.ConstraintMapping;
|
import org.eclipse.jetty.security.ConstraintMapping;
|
||||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||||
@ -63,7 +33,7 @@
|
|||||||
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
||||||
import org.eclipse.jetty.server.AbstractConnector;
|
import org.eclipse.jetty.server.AbstractConnector;
|
||||||
import org.eclipse.jetty.server.ConnectionFactory;
|
import org.eclipse.jetty.server.ConnectionFactory;
|
||||||
@@ -968,6 +970,8 @@
|
@@ -972,6 +974,8 @@
|
||||||
} else {
|
} else {
|
||||||
HashLoginService realm = new CustomHashLoginService(JETTY_REALM, context.getContextPath(),
|
HashLoginService realm = new CustomHashLoginService(JETTY_REALM, context.getContextPath(),
|
||||||
ctx.logManager().getLog(RouterConsoleRunner.class));
|
ctx.logManager().getLog(RouterConsoleRunner.class));
|
||||||
@ -72,7 +42,7 @@
|
|||||||
sec.setLoginService(realm);
|
sec.setLoginService(realm);
|
||||||
sec.setAuthenticator(authenticator);
|
sec.setAuthenticator(authenticator);
|
||||||
String[] role = new String[] {JETTY_ROLE};
|
String[] role = new String[] {JETTY_ROLE};
|
||||||
@@ -975,7 +979,7 @@
|
@@ -979,7 +983,7 @@
|
||||||
String user = e.getKey();
|
String user = e.getKey();
|
||||||
String pw = e.getValue();
|
String pw = e.getValue();
|
||||||
Credential cred = Credential.getCredential(MD5_CREDENTIAL_TYPE + pw);
|
Credential cred = Credential.getCredential(MD5_CREDENTIAL_TYPE + pw);
|
||||||
@ -81,7 +51,7 @@
|
|||||||
Constraint constraint = new Constraint(user, JETTY_ROLE);
|
Constraint constraint = new Constraint(user, JETTY_ROLE);
|
||||||
constraint.setAuthenticate(true);
|
constraint.setAuthenticate(true);
|
||||||
ConstraintMapping cm = new ConstraintMapping();
|
ConstraintMapping cm = new ConstraintMapping();
|
||||||
@@ -995,7 +999,7 @@
|
@@ -999,7 +1003,7 @@
|
||||||
try {
|
try {
|
||||||
// each char truncated to 8 bytes
|
// each char truncated to 8 bytes
|
||||||
String user2 = new String(b2, "ISO-8859-1");
|
String user2 = new String(b2, "ISO-8859-1");
|
||||||
@ -90,7 +60,7 @@
|
|||||||
constraint = new Constraint(user2, JETTY_ROLE);
|
constraint = new Constraint(user2, JETTY_ROLE);
|
||||||
constraint.setAuthenticate(true);
|
constraint.setAuthenticate(true);
|
||||||
cm = new ConstraintMapping();
|
cm = new ConstraintMapping();
|
||||||
@@ -1006,7 +1010,7 @@
|
@@ -1010,7 +1014,7 @@
|
||||||
// each UTF-8 byte as a char
|
// each UTF-8 byte as a char
|
||||||
// this is what chrome does
|
// this is what chrome does
|
||||||
String user3 = new String(b1, "ISO-8859-1");
|
String user3 = new String(b1, "ISO-8859-1");
|
||||||
@ -99,17 +69,6 @@
|
|||||||
constraint = new Constraint(user3, JETTY_ROLE);
|
constraint = new Constraint(user3, JETTY_ROLE);
|
||||||
constraint.setAuthenticate(true);
|
constraint.setAuthenticate(true);
|
||||||
cm = new ConstraintMapping();
|
cm = new ConstraintMapping();
|
||||||
@@ -1081,8 +1085,8 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
- public UserIdentity login(String username, Object credentials) {
|
|
||||||
- UserIdentity rv = super.login(username, credentials);
|
|
||||||
+ public UserIdentity login(String username, Object credentials, ServletRequest request) {
|
|
||||||
+ UserIdentity rv = super.login(username, credentials, request);
|
|
||||||
if (rv == null)
|
|
||||||
//_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, webapp: " + _webapp + ", user: " + username);
|
|
||||||
_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, user: " + username);
|
|
||||||
--- a/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
|
--- a/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
|
||||||
+++ b/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
|
+++ b/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
|
||||||
@@ -85,9 +85,9 @@
|
@@ -85,9 +85,9 @@
|
||||||
@ -124,48 +83,3 @@
|
|||||||
if (servletPath != null && !servletPath.startsWith("*")) {
|
if (servletPath != null && !servletPath.startsWith("*")) {
|
||||||
// success!!
|
// success!!
|
||||||
//System.err.println("Servlet is: " + servletPath);
|
//System.err.println("Servlet is: " + servletPath);
|
||||||
--- a/installer/resources/eepsite/contexts/base-context.xml
|
|
||||||
+++ b/installer/resources/eepsite/contexts/base-context.xml
|
|
||||||
@@ -42,42 +42,5 @@ to serve static html files and images.
|
|
||||||
<Arg>net.i2p.servlet.I2PDefaultServlet</Arg>
|
|
||||||
<Arg>/</Arg>
|
|
||||||
</Call>
|
|
||||||
- <Call name="addFilter">
|
|
||||||
- <!-- Add a filter to gzip on-the fly, since if we don't do it, I2P will.
|
|
||||||
- - This lowers the resource usage in the Java process on the client side,
|
|
||||||
- - by pushing the decompression out of Java and into the browser.
|
|
||||||
- - For all the reasons noted in the GzipFilter javadocs, this is normally
|
|
||||||
- - a bad idea for static content, but this is I2P.
|
|
||||||
- - See I2PTunnelHTTPServer for the I2P compressor.
|
|
||||||
- -->
|
|
||||||
- <Arg>
|
|
||||||
- <New class="org.eclipse.jetty.servlet.FilterHolder" >
|
|
||||||
- <Arg>
|
|
||||||
- <New class="org.eclipse.jetty.servlets.GzipFilter" />
|
|
||||||
- </Arg>
|
|
||||||
- <Call name="setInitParameter">
|
|
||||||
- <!-- minimum in Java is 1300 -->
|
|
||||||
- <Arg>minGzipSize</Arg>
|
|
||||||
- <Arg>512</Arg>
|
|
||||||
- </Call>
|
|
||||||
- <Call name="setInitParameter">
|
|
||||||
- <!-- In Java we have a blacklist. This covers the most common cases. -->
|
|
||||||
- <Arg>mimeTypes</Arg>
|
|
||||||
- <Arg>application/pdf,application/x-javascript,application/xhtml+xml,application/xml,image/svg+xml,text/css,text/html,text/plain</Arg>
|
|
||||||
- </Call>
|
|
||||||
- </New>
|
|
||||||
- </Arg>
|
|
||||||
- <Arg>/*</Arg>
|
|
||||||
- <Arg>
|
|
||||||
- <!-- just guessing here -->
|
|
||||||
- <Call class="java.util.EnumSet" name="of" >
|
|
||||||
- <Arg>
|
|
||||||
- <Call class="javax.servlet.DispatcherType" name="valueOf" >
|
|
||||||
- <Arg>REQUEST</Arg>
|
|
||||||
- </Call>
|
|
||||||
- </Arg>
|
|
||||||
- </Call>
|
|
||||||
- </Arg>
|
|
||||||
- </Call>
|
|
||||||
</Configure>
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user