* Addressbook, NamingService: Allow 516 byte dests

that end with AA but not AAAA, so we can permit
      non-null zero-length certs.
This commit is contained in:
zzz
2009-11-10 14:44:40 +00:00
parent e02845076d
commit ee51f69a5a
3 changed files with 4 additions and 3 deletions

View File

@@ -193,7 +193,8 @@ public class AddressBook {
(! host.endsWith(".router.i2p")) && (! host.endsWith(".router.i2p")) &&
(! host.endsWith(".console.i2p")) && (! host.endsWith(".console.i2p")) &&
((dest.length() == MIN_DEST_LENGTH && dest.endsWith("AAAA")) || // null cert ends with AAAA but other zero-length certs would be AA
((dest.length() == MIN_DEST_LENGTH && dest.endsWith("AA")) ||
(dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) && (dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) &&
dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0 dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0
; ;

View File

@@ -118,7 +118,7 @@ public class EepGetNamingService extends NamingService {
if (key.startsWith(hostname + "=")) // strip hostname= if (key.startsWith(hostname + "=")) // strip hostname=
key = key.substring(hostname.length() + 1); key = key.substring(hostname.length() + 1);
key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below
if (!key.endsWith("AAAA")) { if (!key.endsWith("AA")) {
_log.error("Invalid key: " + url + hostname); _log.error("Invalid key: " + url + hostname);
return null; return null;
} }

View File

@@ -112,7 +112,7 @@ public class ExecNamingService extends NamingService {
if (key.startsWith(hostname + "=")) // strip hostname= if (key.startsWith(hostname + "=")) // strip hostname=
key = key.substring(hostname.length() + 1); key = key.substring(hostname.length() + 1);
key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below
if (!key.endsWith("AAAA")) { if (!key.endsWith("AA")) {
_log.error("Invalid key: " + command); _log.error("Invalid key: " + command);
return null; return null;
} }