From 29e9b2fa1eb5cfcd1539027e54025120d5af6a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 25 Sep 2015 01:38:43 +0200 Subject: Dont import more than 100 User IDs (OKC-01-002) --- .../keychain/operations/results/OperationResult.java | 1 + .../java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java | 8 ++++++-- OpenKeychain/src/main/res/values/strings.xml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenKeychain/src/main') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index a03658808..65816e5f2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -474,6 +474,7 @@ public abstract class OperationResult implements Parcelable { MSG_KC_UID_BAD (LogLevel.WARN, R.string.msg_kc_uid_bad), MSG_KC_UID_CERT_DUP (LogLevel.DEBUG, R.string.msg_kc_uid_cert_dup), MSG_KC_UID_DUP (LogLevel.DEBUG, R.string.msg_kc_uid_dup), + MSG_KC_UID_TOO_MANY (LogLevel.DEBUG, R.string.msg_kc_uid_too_many), MSG_KC_UID_FOREIGN (LogLevel.DEBUG, R.string.msg_kc_uid_foreign), MSG_KC_UID_NO_CERT (LogLevel.DEBUG, R.string.msg_kc_uid_no_cert), MSG_KC_UID_REVOKE_DUP (LogLevel.DEBUG, R.string.msg_kc_uid_revoke_dup), diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java index ca98882d8..87e7ec461 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -457,11 +457,15 @@ public class UncachedKeyRing implements Serializable { // check for duplicate user ids if (processedUserIds.contains(userId)) { - log.add(LogType.MSG_KC_UID_DUP, - indent, userId); + log.add(LogType.MSG_KC_UID_DUP, indent, userId); // strip out the first found user id with this name modified = PGPPublicKey.removeCertification(modified, rawUserId); } + if (processedUserIds.size() > 100) { + log.add(LogType.MSG_KC_UID_TOO_MANY, indent, userId); + // strip out the user id + modified = PGPPublicKey.removeCertification(modified, rawUserId); + } processedUserIds.add(userId); PGPSignature selfCert = null; diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 53483c390..b0e0f5734 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -995,6 +995,7 @@ "No valid self-certificate found for user ID '%s', removing from ring" "Removing invalid user ID '%s'" "Removing duplicate user ID '%s'. The keyring contained two of them. This may result in missing certificates!" + "Removing user ID '%s'. More than 100 User IDs are not imported!" "User ID does not verify as UTF-8!" "Processing user attribute of type JPEG" "Processing user attribute of unknown type" -- cgit v1.2.3