forked from I2P_Developers/i2p.i2p
i2ptunnel: Fix SSL wizard for split config (ticket #2610)
This commit is contained in:
@ -285,7 +285,16 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
|||||||
boolean addssl = ok && !isSSLEnabled && !action.equals("Disable");
|
boolean addssl = ok && !isSSLEnabled && !action.equals("Disable");
|
||||||
boolean delssl = ok && isSSLEnabled && action.equals("Disable");
|
boolean delssl = ok && isSSLEnabled && action.equals("Disable");
|
||||||
if (addssl || delssl) {
|
if (addssl || delssl) {
|
||||||
File f = new File(ctx.getConfigDir(), "clients.config");
|
String configfile = request.getParameter("clientConfigFile");
|
||||||
|
File f;
|
||||||
|
if (configfile == null || configfile.equals("clients.config")) {
|
||||||
|
f = new File(ctx.getConfigDir(), "clients.config");
|
||||||
|
} else if (configfile.contains("/") || configfile.contains("\\")) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
} else {
|
||||||
|
f = new File(ctx.getConfigDir(), "clients.config.d");
|
||||||
|
f = new File(f, configfile);
|
||||||
|
}
|
||||||
java.util.Properties p = new net.i2p.util.OrderedProperties();
|
java.util.Properties p = new net.i2p.util.OrderedProperties();
|
||||||
try {
|
try {
|
||||||
DataHelper.loadProps(p, f);
|
DataHelper.loadProps(p, f);
|
||||||
@ -578,15 +587,44 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
|||||||
// Now try to find the Jetty server in clients.config
|
// Now try to find the Jetty server in clients.config
|
||||||
File configDir = ctx.getConfigDir();
|
File configDir = ctx.getConfigDir();
|
||||||
File clientsConfig = new File(configDir, "clients.config");
|
File clientsConfig = new File(configDir, "clients.config");
|
||||||
|
boolean isSingleFile = clientsConfig.exists();
|
||||||
|
File[] configFiles;
|
||||||
|
if (!isSingleFile) {
|
||||||
|
File clientsConfigD = new File(configDir, "clients.config.d");
|
||||||
|
configFiles = clientsConfigD.listFiles();
|
||||||
|
} else {
|
||||||
|
configFiles = null;
|
||||||
|
}
|
||||||
java.util.Properties clientProps = new java.util.Properties();
|
java.util.Properties clientProps = new java.util.Properties();
|
||||||
try {
|
try {
|
||||||
boolean foundClientConfig = false;
|
boolean foundClientConfig = false;
|
||||||
|
int i = -1;
|
||||||
|
int fileNum = 0;
|
||||||
|
while (true) {
|
||||||
|
if (isSingleFile) {
|
||||||
|
// next config in the file
|
||||||
|
i++;
|
||||||
|
if (i == 0)
|
||||||
DataHelper.loadProps(clientProps, clientsConfig);
|
DataHelper.loadProps(clientProps, clientsConfig);
|
||||||
for (int i = 0; i < 100; i++) {
|
} else {
|
||||||
|
if (configFiles == null)
|
||||||
|
break;
|
||||||
|
if (fileNum >= configFiles.length)
|
||||||
|
break;
|
||||||
|
// load the next file
|
||||||
|
clientProps.clear();
|
||||||
|
clientsConfig = configFiles[fileNum++];
|
||||||
|
DataHelper.loadProps(clientProps, clientsConfig);
|
||||||
|
// only look at client 0 in file
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
String prop = "clientApp." + i + ".main";
|
String prop = "clientApp." + i + ".main";
|
||||||
String cls = clientProps.getProperty(prop);
|
String cls = clientProps.getProperty(prop);
|
||||||
if (cls == null)
|
if (cls == null) {
|
||||||
|
if (isSingleFile)
|
||||||
break;
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!cls.equals("net.i2p.jetty.JettyStart"))
|
if (!cls.equals("net.i2p.jetty.JettyStart"))
|
||||||
continue;
|
continue;
|
||||||
prop = "clientApp." + i + ".args";
|
prop = "clientApp." + i + ".args";
|
||||||
@ -734,6 +772,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
|||||||
%>
|
%>
|
||||||
<tr><td colspan="4">
|
<tr><td colspan="4">
|
||||||
<input type="hidden" name="clientAppNumber" value="<%=i%>" />
|
<input type="hidden" name="clientAppNumber" value="<%=i%>" />
|
||||||
|
<input type="hidden" name="clientConfigFile" value="<%=clientsConfig.getName()%>" />
|
||||||
<input type="hidden" name="isSSLEnabled" value="<%=isEnabled%>" />
|
<input type="hidden" name="isSSLEnabled" value="<%=isEnabled%>" />
|
||||||
<input type="hidden" name="nofilter_ksPath" value="<%=ksPath%>" />
|
<input type="hidden" name="nofilter_ksPath" value="<%=ksPath%>" />
|
||||||
<input type="hidden" name="nofilter_jettySSLFile" value="<%=jettySSLFile%>" />
|
<input type="hidden" name="nofilter_jettySSLFile" value="<%=jettySSLFile%>" />
|
||||||
@ -781,7 +820,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
|||||||
<%
|
<%
|
||||||
break;
|
break;
|
||||||
} // canConfigure
|
} // canConfigure
|
||||||
} // for client
|
} // while (for each client or client file)
|
||||||
if (!foundClientConfig) {
|
if (!foundClientConfig) {
|
||||||
%>
|
%>
|
||||||
<tr><td colspan="4">Cannot configure, no Jetty server found in <a href="/configclients">client configurations</a> that matches this tunnel</td></tr>
|
<tr><td colspan="4">Cannot configure, no Jetty server found in <a href="/configclients">client configurations</a> that matches this tunnel</td></tr>
|
||||||
|
Reference in New Issue
Block a user