I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9d28b17a authored by zzz's avatar zzz
Browse files

I2CP: Don't return dest for a b33 lookup if we don't have the

required auth or secret
parent 43f055ec
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,16 @@ class LookupDestJob extends JobImpl { ...@@ -94,7 +94,16 @@ class LookupDestJob extends JobImpl {
BlindData bd2 = getContext().netDb().getBlindData(spk); BlindData bd2 = getContext().netDb().getBlindData(spk);
if (bd2 != null) { if (bd2 != null) {
// BlindData from database may have privkey or secret // BlindData from database may have privkey or secret
bd = bd2; // check if we need it but don't have it
if ((bd.getAuthRequired() && bd2.getAuthPrivKey() == null) ||
(bd.getSecretRequired() && (bd2.getSecret() == null || bd2.getSecret().length() == 0))) {
// don't copy over existing info, this will force an immediate
// failure in runJob()
if (_log.shouldDebug())
_log.debug("No auth or secret, immediate fail " + bd);
} else {
bd = bd2;
}
} else { } else {
getContext().netDb().setBlindData(bd); getContext().netDb().setBlindData(bd);
} }
...@@ -126,15 +135,9 @@ class LookupDestJob extends JobImpl { ...@@ -126,15 +135,9 @@ class LookupDestJob extends JobImpl {
public void runJob() { public void runJob() {
if (_blindData != null) { if (_blindData != null) {
Destination d = _blindData.getDestination();
if (d != null) {
if (_log.shouldDebug())
_log.debug("Found cached b33 lookup " + _blindData.getUnblindedPubKey() + " to " + d);
returnDest(d);
return;
}
boolean fail1 = _blindData.getAuthRequired() && _blindData.getAuthPrivKey() == null; boolean fail1 = _blindData.getAuthRequired() && _blindData.getAuthPrivKey() == null;
boolean fail2 = _blindData.getSecretRequired() && _blindData.getSecret() == null; boolean fail2 = _blindData.getSecretRequired() &&
(_blindData.getSecret() == null || _blindData.getSecret().length() == 0);
if (fail1 || fail2) { if (fail1 || fail2) {
int code; int code;
if (fail1 && fail2) if (fail1 && fail2)
...@@ -147,6 +150,15 @@ class LookupDestJob extends JobImpl { ...@@ -147,6 +150,15 @@ class LookupDestJob extends JobImpl {
_log.debug("Failed b33 lookup " + _blindData.getUnblindedPubKey() + " with code " + code); _log.debug("Failed b33 lookup " + _blindData.getUnblindedPubKey() + " with code " + code);
returnFail(code); returnFail(code);
} }
// do this after the fail checks above, because even if we
// have the dest, it won't help get a LS.
Destination d = _blindData.getDestination();
if (d != null) {
if (_log.shouldDebug())
_log.debug("Found cached b33 lookup " + _blindData.getUnblindedPubKey() + " to " + d);
returnDest(d);
return;
}
} }
if (_name != null) { if (_name != null) {
// inline, ignore timeout // inline, ignore timeout
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment