diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-07-26 03:47:29 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-07-26 03:47:29 +0200 |
commit | ab2b90342e805a0a625e059dcfe2db11157a5680 (patch) | |
tree | 6dee9b1614d94c9e112e1fdff1d1877bb5d1c803 /OpenKeychain/src/main | |
parent | f560bc9317357a755b5862c1eec142b7c4665c0a (diff) | |
download | open-keychain-ab2b90342e805a0a625e059dcfe2db11157a5680.tar.gz open-keychain-ab2b90342e805a0a625e059dcfe2db11157a5680.tar.bz2 open-keychain-ab2b90342e805a0a625e059dcfe2db11157a5680.zip |
test and fix: adding an empty user id should fail
Diffstat (limited to 'OpenKeychain/src/main')
3 files changed, 7 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index 00f73a5b0..69244ca14 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -313,6 +313,11 @@ public class PgpKeyOperation { for (String userId : saveParcel.mAddUserIds) { log.add(LogLevel.INFO, LogType.MSG_MF_UID_ADD, indent); + if (userId.equals("")) { + log.add(LogLevel.ERROR, LogType.MSG_MF_UID_ERROR_EMPTY, indent+1); + return null; + } + // this operation supersedes all previous binding and revocation certificates, // so remove those to retain assertions from canonicalization for later operations @SuppressWarnings("unchecked") diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java index 89d534df6..e55ec5568 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java @@ -279,6 +279,7 @@ public class OperationResultParcel implements Parcelable { MSG_MF_UID_ADD (R.string.msg_mf_uid_add), MSG_MF_UID_PRIMARY (R.string.msg_mf_uid_primary), MSG_MF_UID_REVOKE (R.string.msg_mf_uid_revoke), + MSG_MF_UID_ERROR_EMPTY (R.string.msg_mf_uid_error_empty), MSG_MF_UNLOCK_ERROR (R.string.msg_mf_unlock_error), MSG_MF_UNLOCK (R.string.msg_mf_unlock), ; diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 55ecf3ae0..d1a20813b 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -674,6 +674,7 @@ <string name="msg_mf_uid_add">Adding user id %s</string> <string name="msg_mf_uid_primary">Changing primary uid to %s</string> <string name="msg_mf_uid_revoke">Revoking user id %s</string> + <string name="msg_mf_uid_error_empty">User ID must not be empty!</string> <string name="msg_mf_unlock_error">Error unlocking keyring!</string> <string name="msg_mf_unlock">Unlocking keyring</string> |