merge of '174649506cd8a9665ad798c090e39481af967011'

and '67eb724b7638284d33f1b4997183cc9f197d2883'
This commit is contained in:
zzz
2015-05-15 14:17:41 +00:00
9 changed files with 80 additions and 27 deletions

View File

@@ -1047,19 +1047,20 @@ public class I2PSnarkServlet extends BasicServlet {
File f = new File(name);
f.delete();
_manager.addMessage(_("Torrent file deleted: {0}", f.getAbsolutePath()));
List<List<String>> files = meta.getFiles();
String dataFile = snark.getBaseName();
f = new File(_manager.getDataDir(), dataFile);
if (files == null) { // single file torrent
if (f.delete())
_manager.addMessage(_("Data file deleted: {0}", f.getAbsolutePath()));
else
_manager.addMessage(_("Data file could not be deleted: {0}", f.getAbsolutePath()));
break;
}
Storage storage = snark.getStorage();
if (storage == null)
break;
List<List<String>> files = meta.getFiles();
if (files == null) { // single file torrent
for (File df : storage.getFiles()) {
// should be only one
if (df.delete())
_manager.addMessage(_("Data file deleted: {0}", df.getAbsolutePath()));
else
_manager.addMessage(_("Data file could not be deleted: {0}", df.getAbsolutePath()));
}
break;
}
// step 1 delete files
for (File df : storage.getFiles()) {
if (df.delete()) {

View File

@@ -14,7 +14,6 @@ import net.i2p.data.Destination;
public class UDPSink implements Sink {
/**
* @param src ignored
* @throws IllegalArgumentException on DatagramSocket IOException
*/
public UDPSink(InetAddress host, int port) {

View File

@@ -76,7 +76,7 @@ class DevSU3UpdateChecker extends UpdateRunner {
_mgr.notifyVersionAvailable(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", UpdateMethod.HTTP,
_urls, newVersion, RouterVersion.FULL_VERSION);
} else {
updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
//updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
if (_log.shouldWarn())
_log.warn("Found old version \"" + newVersion + "\" at " + url);
}

View File

@@ -58,18 +58,21 @@ public class ConfigHomeHandler extends FormHandler {
else
apps = HomeHelper.buildApps(_context, config);
if (adding) {
String name = getJettyString("name");
String name = getJettyString("nofilter_name");
if (name == null || name.length() <= 0) {
addFormError(_("No name entered"));
return;
}
String url = getJettyString("url");
String url = getJettyString("nofilter_url");
if (url == null || url.length() <= 0) {
addFormError(_("No URL entered"));
return;
}
name = DataHelper.escapeHTML(name).replace(",", "&#44;"); // HomeHelper.S
url = DataHelper.escapeHTML(url).replace(",", "&#44;");
// these would get double-escaped so we can't do it this way...
//name = DataHelper.escapeHTML(name).replace(",", "&#44;");
//url = DataHelper.escapeHTML(url).replace(",", "&#44;");
name = name.replace(",", ".");
url = url.replace(",", "."); // fail
HomeHelper.App app = null;
if ("1".equals(group))
app = new HomeHelper.App(name, "", url, "/themes/console/images/eepsite.png");

View File

@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
import net.i2p.util.PortMapper;
@@ -209,17 +210,22 @@ public class HomeHelper extends HelperBase {
buf.append("<img height=\"16\" alt=\"\" src=\"").append(app.icon).append("\">");
}
buf.append("</td><td align=\"left\">")
.append(app.name)
.append("</td><td align=\"left\"><a href=\"")
.append(app.url.replace("&", "&amp;"))
.append("\">")
.append(app.url.replace("&", "&amp;"))
.append("</a></td></tr>\n");
.append(DataHelper.escapeHTML(app.name))
.append("</td><td align=\"left\"><a href=\"");
String url = DataHelper.escapeHTML(app.url);
buf.append(url)
.append("\">");
// truncate before escaping
if (app.url.length() > 50)
buf.append(DataHelper.escapeHTML(app.url.substring(0, 48))).append("&hellip;");
else
buf.append(url);
buf.append("</a></td></tr>\n");
}
buf.append("<tr><td colspan=\"2\" align=\"center\"><b>")
.append(_("Add")).append(":</b>" +
"</td><td align=\"left\"><input type=\"text\" name=\"name\"></td>" +
"<td align=\"left\"><input type=\"text\" size=\"40\" name=\"url\"></td></tr>");
"</td><td align=\"left\"><input type=\"text\" name=\"nofilter_name\"></td>" +
"<td align=\"left\"><input type=\"text\" size=\"40\" name=\"nofilter_url\"></td></tr>");
buf.append("</table>\n");
return buf.toString();
}

View File

@@ -41,7 +41,7 @@ import net.i2p.util.SecureFileOutputStream;
* - Certificate if length != 0
* - Private key (256 bytes)
* - Signing Private key (20 bytes, or length specified by key certificate)
* Total 663 bytes
* Total: 663 or more bytes
*</pre>
*
* @author welterde, zzz

View File

@@ -1,3 +1,8 @@
2015-05-13 zzz
* Console: Fix URLs caught in XSS filter on /confighome (ticket #1569)
* i2psnark: Fix deletion of single-file torrent outside snark dir (ticket #1544)
* NTCP: Catch race in Reader (ticket #1534)
2015-02-12 dg
* Job Queue/stats: add stat/graph for amount of scheduled jobs (router.tunnelBacklog)
* FloodfillMonitorJob:

View File

@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFfTCCA2WgAwIBAgIEUTjHEzANBgkqhkiG9w0BAQ0FADBvMQswCQYDVQQGEwJY
WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt
b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEYMBYGA1UEAwwPY2FjYXBvQG1haWwu
aTJwMB4XDTE1MDIwOTEyNTQxOFoXDTI1MDIwODEyNTQxOFowbzELMAkGA1UEBhMC
WFgxCzAJBgNVBAgTAlhYMQswCQYDVQQHEwJYWDEeMBwGA1UEChMVSTJQIEFub255
bW91cyBOZXR3b3JrMQwwCgYDVQQLEwNJMlAxGDAWBgNVBAMMD2NhY2Fwb0BtYWls
LmkycDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJjVqyjEJqCCufjO
E80hXMPZiQZCiBjSKiA27dTX5rKABI26eLzcKl7e80Ooe9wEGBXEHZCxGIXAFt8x
EHBP4W2u1dmBLpnz6cGxZRMvlTuCKHAbzdJwsWblruXgRg6EQCrtewJ9yuY5SypM
WyJEkL68XMiTeg6fsU367ifWeuPnaO9wqL45pjt9raJMYzXZb3dc6WNUIhg0u7w0
GA4z7X3CZc3f58/4F5ivKOmDd3FqM/suIH6qZJHvQQJZqLtfReLquD5TlqQjcZ1I
vtfYJW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ggswFJHjEX5PcBfsiQklz+
ahs+UsJAb+lbMOlWj+LYDdyC4T7ZHT+Ii/JZdBN3WNXiBzNuXGC7bd0KWBgCaFuU
ZAPV0YlmPjsGRaSl7vfh+cI=
-----END CERTIFICATE-----

View File

@@ -98,8 +98,10 @@ class Reader {
if (keepReading) {
// keep on reading the same one
} else {
_liveReads.remove(con);
con = null;
if (con != null) {
_liveReads.remove(con);
con = null;
}
if (_pendingConnections.isEmpty()) {
_pendingConnections.wait();
} else {
@@ -116,6 +118,10 @@ class Reader {
_log.debug("begin read for " + con);
try {
processRead(con);
} catch (IllegalStateException ise) {
// FailedEstablishState.receive() (race - see below)
if (_log.shouldWarn())
_log.warn("Error in the ntcp reader", ise);
} catch (RuntimeException re) {
_log.log(Log.CRIT, "Error in the ntcp reader", re);
}
@@ -153,6 +159,7 @@ class Reader {
EventPumper.releaseBuf(buf);
break;
}
// FIXME call est.isCorrupt() before also? throws ISE here... see above
est.receive(buf);
EventPumper.releaseBuf(buf);
if (est.isCorrupt()) {