I2CP: Don't try to decrypt an LS before it's encrypted (ticket #1608)

log tweaks
This commit is contained in:
zzz
2015-06-23 21:16:34 +00:00
parent 975149d049
commit 355b2a1528
4 changed files with 19 additions and 7 deletions

View File

@ -418,10 +418,10 @@ public class LeaseSet extends DatabaseEntry {
encryp(key);
} catch (DataFormatException dfe) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class);
log.error("Error encrypting lease: " + _destination.calculateHash());
log.error("Error encrypting lease: " + _destination.calculateHash(), dfe);
} catch (IOException ioe) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class);
log.error("Error encrypting lease: " + _destination.calculateHash());
log.error("Error encrypting lease: " + _destination.calculateHash(), ioe);
}
}
@ -520,7 +520,11 @@ public class LeaseSet extends DatabaseEntry {
private synchronized boolean isEncrypted() {
if (_decrypted)
return true;
if (_checked || _destination == null)
// If the encryption key is not set yet, it can't have been encrypted yet.
// Router-side I2CP sets the destination (but not the encryption key)
// on an unsigned LS which is pending signature (and possibly encryption)
// by the client, and we don't want to attempt 'decryption' on it.
if (_checked || _encryptionKey == null || _destination == null)
return false;
SessionKey key = I2PAppContext.getGlobalContext().keyRing().get(_destination.calculateHash());
if (key != null) {
@ -529,10 +533,10 @@ public class LeaseSet extends DatabaseEntry {
_decrypted = true;
} catch (DataFormatException dfe) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class);
log.error("Error decrypting lease: " + _destination.calculateHash() + dfe);
log.error("Error decrypting lease: " + _destination.calculateHash(), dfe);
} catch (IOException ioe) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class);
log.error("Error decrypting lease: " + _destination.calculateHash() + ioe);
log.error("Error decrypting lease: " + _destination.calculateHash(), ioe);
}
}
_checked = true;

View File

@ -1,3 +1,11 @@
2015-06-23 zzz
* Console: Fix NPE on /configtunnels
* GeoIP: Add countries and flags for Asia/Pacific, Bonaire, St. Barts,
St. Maarten, South Sudan
* I2CP: Don't try to decrypt an LS before it's encrypted (ticket #1608)
* Router: Increase default outbound bandwidth to 60 KBps;
raise class L/M boundary to match so defaulted routers are still L
2015-06-22 dg
* NetDB: Partially revert last NetDB change: flood because we don't want to create a hole in the DHT
before publisher resends to somebody else.

View File

@ -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 = 9;
public final static long BUILD = 10;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -64,7 +64,7 @@ class RequestLeaseSetJob extends JobImpl {
// _log.debug("Adding fudge " + fudge);
endTime += fudge;
SessionId id = _runner.getSessionId(_requestState.getRequested().getDestination().calculateHash());
SessionId id = _runner.getSessionId(requested.getDestination().calculateHash());
if (id == null)
return;
I2CPMessage msg;