Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More keychain fixes #1494

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ bool pfApplePasswordStore::SetPassword(const ST::string& username, const ST::str
CFAutorelease(serviceName);
CFAutorelease(passwordData);

const void* keys[] = { kSecClass, kSecAttrService, kSecReturnData, kSecValueData };
const void* values[] = { kSecClassGenericPassword, serviceName, kCFBooleanTrue, passwordData };
const void* keys[] = { kSecClass, kSecAttrService, kSecAttrAccount, kSecValueData };
const void* values[] = { kSecClassGenericPassword, serviceName, accountName, passwordData };

CFDictionaryRef query = CFDictionaryCreate(nullptr, keys, values, 4, nullptr, nullptr);
CFAutorelease(query);
Expand All @@ -104,14 +104,14 @@ bool pfApplePasswordStore::SetPassword(const ST::string& username, const ST::str
if (err == errSecDuplicateItem) {
// the keychain item already exists, update it

const void* queryKeys[2] = { kSecClass, kSecAttrService };
const void* queryValues[2] = { kSecClassGenericPassword, serviceName };
CFDictionaryRef updateQuery = CFDictionaryCreate(nullptr, queryKeys, queryValues, 2, nullptr, nullptr);
const void* queryKeys[] = { kSecClass, kSecAttrService, kSecAttrAccount };
const void* queryValues[] = { kSecClassGenericPassword, serviceName, accountName };
CFDictionaryRef updateQuery = CFDictionaryCreate(nullptr, queryKeys, queryValues, 3, nullptr, nullptr);
CFAutorelease(updateQuery);

const void* attributeKeys[2] = { kSecAttrAccount, kSecValueData };
const void* attributeValues[2] = { accountName, passwordData };
CFDictionaryRef attributes = CFDictionaryCreate(nullptr, attributeKeys, attributeValues, 2, nullptr, nullptr);
const void* attributeKeys[1] = { kSecValueData };
const void* attributeValues[1] = { passwordData };
CFDictionaryRef attributes = CFDictionaryCreate(nullptr, attributeKeys, attributeValues, 1, nullptr, nullptr);

err = SecItemUpdate(updateQuery, attributes);

Expand Down
Loading