From 51ab46a83c98631702ef1b4734af7db7ec0672ab Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 8 Jan 2012 01:43:19 +0100 Subject: [PATCH] Remove the purpose argument from all GetKey() variants. The type is relevant and required as it determines the type of the handed in key. The purpose however isn't actually needed and rather inconvenient to get by depending on the situation. --- headers/os/app/KeyStore.h | 20 ++++++++------------ src/bin/keystore.cpp | 4 ++-- src/kits/app/KeyStore.cpp | 34 +++++++++++++++------------------- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/headers/os/app/KeyStore.h b/headers/os/app/KeyStore.h index 3d23fcdf5d..625049549e 100644 --- a/headers/os/app/KeyStore.h +++ b/headers/os/app/KeyStore.h @@ -16,27 +16,23 @@ public: // TODO: -> GetNextPassword() - there can always be more than one key // with the same identifier/secondaryIdentifier (ie. different username) - status_t GetKey(BKeyType type, BKeyPurpose purpose, - const char* identifier, BKey& key); - status_t GetKey(BKeyType type, BKeyPurpose purpose, - const char* identifier, + status_t GetKey(BKeyType type, const char* identifier, + BKey& key); + status_t GetKey(BKeyType type, const char* identifier, const char* secondaryIdentifier, BKey& key); - status_t GetKey(BKeyType type, BKeyPurpose purpose, - const char* identifier, + status_t GetKey(BKeyType type, const char* identifier, const char* secondaryIdentifier, bool secondaryIdentifierOptional, BKey& key); status_t GetKey(const char* keyring, - BKeyType type, BKeyPurpose purpose, - const char* identifier, BKey& key); + BKeyType type, const char* identifier, + BKey& key); status_t GetKey(const char* keyring, - BKeyType type, BKeyPurpose purpose, - const char* identifier, + BKeyType type, const char* identifier, const char* secondaryIdentifier, BKey& key); status_t GetKey(const char* keyring, - BKeyType type, BKeyPurpose purpose, - const char* identifier, + BKeyType type, const char* identifier, const char* secondaryIdentifier, bool secondaryIdentifierOptional, BKey& key); diff --git a/src/bin/keystore.cpp b/src/bin/keystore.cpp index 8d6cf028c7..c4148f47a4 100644 --- a/src/bin/keystore.cpp +++ b/src/bin/keystore.cpp @@ -37,8 +37,8 @@ remove_password(const char* keyring, const char* identifier, BKeyStore keyStore; BPasswordKey password; - status_t result = keyStore.GetKey(keyring, B_KEY_TYPE_PASSWORD, - B_KEY_PURPOSE_ANY, identifier, secondaryIdentifier, false, password); + status_t result = keyStore.GetKey(keyring, B_KEY_TYPE_PASSWORD, identifier, + secondaryIdentifier, false, password); if (result != B_OK) { printf("failed to get password \"%s\": %s\n", identifier, strerror(result)); diff --git a/src/kits/app/KeyStore.cpp b/src/kits/app/KeyStore.cpp index dea28718a1..3278ba7e82 100644 --- a/src/kits/app/KeyStore.cpp +++ b/src/kits/app/KeyStore.cpp @@ -28,58 +28,54 @@ BKeyStore::~BKeyStore() status_t -BKeyStore::GetKey(BKeyType type, BKeyPurpose purpose, const char* identifier, - BKey& key) +BKeyStore::GetKey(BKeyType type, const char* identifier, BKey& key) { - return GetKey(NULL, type, purpose, identifier, NULL, true, key); + return GetKey(NULL, type, identifier, NULL, true, key); } status_t -BKeyStore::GetKey(BKeyType type, BKeyPurpose purpose, const char* identifier, +BKeyStore::GetKey(BKeyType type, const char* identifier, const char* secondaryIdentifier, BKey& key) { - return GetKey(NULL, type, purpose, identifier, secondaryIdentifier, true, - key); + return GetKey(NULL, type, identifier, secondaryIdentifier, true, key); } status_t -BKeyStore::GetKey(BKeyType type, BKeyPurpose purpose, const char* identifier, +BKeyStore::GetKey(BKeyType type, const char* identifier, const char* secondaryIdentifier, bool secondaryIdentifierOptional, BKey& key) { - return GetKey(NULL, type, purpose, identifier, secondaryIdentifier, + return GetKey(NULL, type, identifier, secondaryIdentifier, secondaryIdentifierOptional, key); } status_t -BKeyStore::GetKey(const char* keyring, BKeyType type, BKeyPurpose purpose, - const char* identifier, BKey& key) +BKeyStore::GetKey(const char* keyring, BKeyType type, const char* identifier, + BKey& key) { - return GetKey(keyring, type, purpose, identifier, NULL, true, key); + return GetKey(keyring, type, identifier, NULL, true, key); } status_t -BKeyStore::GetKey(const char* keyring, BKeyType type, BKeyPurpose purpose, - const char* identifier, const char* secondaryIdentifier, BKey& key) +BKeyStore::GetKey(const char* keyring, BKeyType type, const char* identifier, + const char* secondaryIdentifier, BKey& key) { - return GetKey(keyring, type, purpose, identifier, secondaryIdentifier, true, - key); + return GetKey(keyring, type, identifier, secondaryIdentifier, true, key); } status_t -BKeyStore::GetKey(const char* keyring, BKeyType type, BKeyPurpose purpose, - const char* identifier, const char* secondaryIdentifier, - bool secondaryIdentifierOptional, BKey& key) +BKeyStore::GetKey(const char* keyring, BKeyType type, const char* identifier, + const char* secondaryIdentifier, bool secondaryIdentifierOptional, + BKey& key) { BMessage message(KEY_STORE_GET_KEY); message.AddString("keyring", keyring); message.AddUInt32("type", type); - message.AddUInt32("purpose", purpose); message.AddString("identifier", identifier); message.AddString("secondaryIdentifier", secondaryIdentifier); message.AddBool("secondaryIdentifierOptional", secondaryIdentifierOptional);