2018-12-13 14:30:22 +00:00
|
|
|
--- a/apps/jetty/java/src/net/i2p/jetty/JettyXmlConfigurationParser.java
|
|
|
|
+++ b/apps/jetty/java/src/net/i2p/jetty/JettyXmlConfigurationParser.java
|
|
|
|
@@ -43,9 +43,9 @@
|
|
|
|
private static XmlParser initParser()
|
|
|
|
{
|
|
|
|
XmlParser parser = new XmlParser();
|
|
|
|
- URL config60 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_6_0.dtd");
|
|
|
|
- URL config76 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_7_6.dtd");
|
|
|
|
- URL config90 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_9_0.dtd");
|
|
|
|
+ URL config60 = Loader.getResource("org/eclipse/jetty/xml/configure_6_0.dtd");
|
|
|
|
+ URL config76 = Loader.getResource("org/eclipse/jetty/xml/configure_7_6.dtd");
|
|
|
|
+ URL config90 = Loader.getResource("org/eclipse/jetty/xml/configure_9_0.dtd");
|
|
|
|
parser.redirectEntity("configure.dtd",config90);
|
|
|
|
parser.redirectEntity("configure_1_0.dtd",config60);
|
|
|
|
parser.redirectEntity("configure_1_1.dtd",config60);
|
|
|
|
--- a/apps/jetty/java/src/net/i2p/servlet/I2PDefaultServlet.java
|
|
|
|
+++ b/apps/jetty/java/src/net/i2p/servlet/I2PDefaultServlet.java
|
|
|
|
@@ -132,7 +132,6 @@
|
|
|
|
*
|
|
|
|
* Get the resource list as a HTML directory listing.
|
|
|
|
*/
|
|
|
|
- @Override
|
|
|
|
protected void sendDirectory(HttpServletRequest request,
|
|
|
|
HttpServletResponse response,
|
|
|
|
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
|
|
|
|
+++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
|
|
|
|
@@ -22,6 +22,7 @@
|
|
|
|
import java.util.SortedSet;
|
|
|
|
import java.util.StringTokenizer;
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
+import javax.servlet.ServletRequest;
|
|
|
|
|
|
|
|
import net.i2p.I2PAppContext;
|
2019-01-18 14:32:28 +00:00
|
|
|
import net.i2p.app.ClientApp;
|
|
|
|
@@ -48,6 +49,7 @@
|
2018-12-13 14:30:22 +00:00
|
|
|
import org.eclipse.jetty.security.HashLoginService;
|
|
|
|
import org.eclipse.jetty.security.ConstraintMapping;
|
|
|
|
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
|
|
|
+import org.eclipse.jetty.security.UserStore;
|
|
|
|
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
|
|
|
import org.eclipse.jetty.server.AbstractConnector;
|
|
|
|
import org.eclipse.jetty.server.ConnectionFactory;
|
2019-01-18 14:32:28 +00:00
|
|
|
@@ -959,6 +961,8 @@
|
2018-12-13 14:30:22 +00:00
|
|
|
} else {
|
|
|
|
HashLoginService realm = new CustomHashLoginService(JETTY_REALM, context.getContextPath(),
|
|
|
|
ctx.logManager().getLog(RouterConsoleRunner.class));
|
|
|
|
+ UserStore userStore = new UserStore();
|
|
|
|
+ realm.setUserStore(userStore);
|
|
|
|
sec.setLoginService(realm);
|
|
|
|
sec.setAuthenticator(authenticator);
|
|
|
|
String[] role = new String[] {JETTY_ROLE};
|
2019-01-18 14:32:28 +00:00
|
|
|
@@ -966,7 +970,7 @@
|
2018-12-13 14:30:22 +00:00
|
|
|
String user = e.getKey();
|
|
|
|
String pw = e.getValue();
|
|
|
|
Credential cred = Credential.getCredential(MD5_CREDENTIAL_TYPE + pw);
|
|
|
|
- realm.putUser(user, cred, role);
|
|
|
|
+ userStore.addUser(user, cred, role);
|
|
|
|
Constraint constraint = new Constraint(user, JETTY_ROLE);
|
|
|
|
constraint.setAuthenticate(true);
|
|
|
|
ConstraintMapping cm = new ConstraintMapping();
|
2019-01-18 14:32:28 +00:00
|
|
|
@@ -986,7 +990,7 @@
|
2018-12-13 14:30:22 +00:00
|
|
|
try {
|
|
|
|
// each char truncated to 8 bytes
|
|
|
|
String user2 = new String(b2, "ISO-8859-1");
|
|
|
|
- realm.putUser(user2, cred, role);
|
|
|
|
+ userStore.addUser(user2, cred, role);
|
|
|
|
constraint = new Constraint(user2, JETTY_ROLE);
|
|
|
|
constraint.setAuthenticate(true);
|
|
|
|
cm = new ConstraintMapping();
|
2019-01-18 14:32:28 +00:00
|
|
|
@@ -997,7 +1001,7 @@
|
2018-12-13 14:30:22 +00:00
|
|
|
// each UTF-8 byte as a char
|
|
|
|
// this is what chrome does
|
|
|
|
String user3 = new String(b1, "ISO-8859-1");
|
|
|
|
- realm.putUser(user3, cred, role);
|
|
|
|
+ userStore.addUser(user3, cred, role);
|
|
|
|
constraint = new Constraint(user3, JETTY_ROLE);
|
|
|
|
constraint.setAuthenticate(true);
|
|
|
|
cm = new ConstraintMapping();
|
2019-01-18 14:32:28 +00:00
|
|
|
@@ -1072,8 +1076,8 @@
|
2018-12-13 14:30:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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
|
|
|
|
+++ b/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
|
|
|
|
@@ -85,9 +85,9 @@
|
|
|
|
String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
|
|
|
|
// Do we have a servlet for the new path that isn't the catchall *.jsp?
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
- Map.Entry servlet = _wac.getServletHandler().getHolderEntry(testPath);
|
|
|
|
+ org.eclipse.jetty.http.pathmap.MappedResource servlet = _wac.getServletHandler().getMappedServlet(testPath);
|
|
|
|
if (servlet != null) {
|
|
|
|
- String servletPath = (String) servlet.getKey();
|
|
|
|
+ String servletPath = servlet.getPathSpec().getDeclaration();
|
|
|
|
if (servletPath != null && !servletPath.startsWith("*")) {
|
|
|
|
// success!!
|
|
|
|
//System.err.println("Servlet is: " + servletPath);
|