Addressbook: Check inner sig even if old name not found

More logging cleanup
This commit is contained in:
zzz
2016-04-26 13:50:34 +00:00
parent fc8b72768a
commit 6a71c23fd4
3 changed files with 72 additions and 39 deletions

View File

@ -212,7 +212,12 @@ public class Daemon {
List<Destination> pod2 = router.lookupAll(key);
if (pod2 == null) {
// we didn't know it before, so we'll add it
// TODO check inner sig anyway?
// check inner sig anyway
if (!he.hasValidInnerSig()) {
logInner(log, action, key, addressbook);
invalid++;
continue;
}
} else if (pod2.contains(dest)) {
// we knew it before, with the same dest
old++;
@ -220,11 +225,7 @@ public class Daemon {
} else if (pod2.contains(pod)) {
// checks out, so verify the inner sig
if (!he.hasValidInnerSig()) {
if (log != null)
log.append("Action: " + action + " failed because" +
" inner signature for key " + key +
" failed" +
". From: " + addressbook.getLocation());
logInner(log, action, key, addressbook);
invalid++;
continue;
}
@ -258,8 +259,7 @@ public class Daemon {
continue;
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters");
logMissing(log, action, key, addressbook);
invalid++;
continue;
}
@ -284,9 +284,7 @@ public class Daemon {
continue;
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters" +
". From: " + addressbook.getLocation());
logMissing(log, action, key, addressbook);
invalid++;
continue;
}
@ -314,15 +312,16 @@ public class Daemon {
List<Destination> pod2 = router.lookupAll(poldname);
if (pod2 == null) {
// we didn't have the old name
// TODO check inner sig anyway?
// check inner sig anyway
if (!he.hasValidInnerSig()) {
logInner(log, action, key, addressbook);
invalid++;
continue;
}
} else if (pod2.contains(pod)) {
// checks out, so verify the inner sig
if (!he.hasValidInnerSig()) {
if (log != null)
log.append("Action: " + action + " failed because" +
" inner signature for old name " + poldname +
" failed" +
". From: " + addressbook.getLocation());
logInner(log, action, key, addressbook);
invalid++;
continue;
}
@ -333,9 +332,7 @@ public class Daemon {
continue;
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters" +
". From: " + addressbook.getLocation());
logMissing(log, action, key, addressbook);
invalid++;
continue;
}
@ -349,7 +346,12 @@ public class Daemon {
List<Destination> pod2 = router.lookupAll(key);
if (pod2 == null) {
// we didn't have the old name
// TODO check inner sig anyway?
// check inner sig anyway
if (!he.hasValidInnerSig()) {
logInner(log, action, key, addressbook);
invalid++;
continue;
}
} else if (pod2.contains(dest)) {
// we already have the new dest
old++;
@ -357,11 +359,7 @@ public class Daemon {
} else if (pod2.contains(pod)) {
// checks out, so verify the inner sig
if (!he.hasValidInnerSig()) {
if (log != null)
log.append("Action: " + action + " failed because" +
" inner signature for key " + key +
" failed" +
". From: " + addressbook.getLocation());
logInner(log, action, key, addressbook);
invalid++;
continue;
}
@ -382,9 +380,7 @@ public class Daemon {
continue;
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters" +
". From: " + addressbook.getLocation());
logMissing(log, action, key, addressbook);
invalid++;
continue;
}
@ -432,9 +428,7 @@ public class Daemon {
continue;
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters" +
". From: " + addressbook.getLocation());
logMissing(log, action, key, addressbook);
invalid++;
continue;
}
@ -527,9 +521,7 @@ public class Daemon {
old++;
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters" +
". From: " + addressbook.getLocation());
logMissing(log, action, "delete", addressbook);
invalid++;
}
} else if (action.equals(HostTxtEntry.ACTION_REMOVEALL)) {
@ -603,9 +595,7 @@ public class Daemon {
}
}
} else {
if (log != null)
log.append("Action: " + action + " failed, missing required parameters" +
". From: " + addressbook.getLocation());
logMissing(log, action, "delete", addressbook);
invalid++;
}
} else {
@ -666,6 +656,26 @@ public class Daemon {
subscriptions.write();
}
/** @since 0.9.26 */
private static void logInner(Log log, String action, String name, AddressBook addressbook) {
if (log != null) {
log.append("Action: " + action + " failed because" +
" inner signature for key " + name +
" failed" +
". From: " + addressbook.getLocation());
}
}
/** @since 0.9.26 */
private static void logMissing(Log log, String action, String name, AddressBook addressbook) {
if (log != null) {
log.append("Action: " + action + " for " + name +
" failed, missing required parameters" +
". From: " + addressbook.getLocation());
}
}
/** @since 0.9.26 */
private static void logMismatch(Log log, String action, String name, List<Destination> dests,
String olddest, AddressBook addressbook) {
if (log != null) {

View File

@ -1,3 +1,26 @@
2016-04-26 zzz
* Addressbook:
- Finish implementation of signed actions
- Move HostTxtEntry to net.i2p.client.naming for use by i2ptunnel
- Add tests for Daemon to read local subscription file
- Store last-modified date
- Logging cleanups and consolidation
* Blockfile: Remove unused code and classes
* BlockfileNamingService:
- Implementation and fixes for new API methods
- Add support for long property values, backward compatbile, no version bump
* DataHelper: Properties methods cleanup
* i2ptunnel:
- New page for registration authentication
- Remove old, unused hostname signature generation
* NamingService: Add new API methods for reverseLookupAll()
* PrivateKeyFile:
- Add InputStream constructor for i2ptunnel
- Ensure initialization before returning private keys
* SusiDNS:
- Display signature validation on details page
- Add support for multiple dests per hostname
2016-04-20 zzz
* Addressbook:
- Add sign/verify methods for inner signature

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