Commit eb44067d authored by David Fuhrmann's avatar David Fuhrmann

keychain: Fix storing of new keychain item on older macOS versions

Older versions are more picky regarding SecItemCopyMatching.
According to docu, one output type must be given, and also an actual
output variable must be passed (as tests show). Only then,
a 10.7 system accepts that search call.
parent c4d34f9d
......@@ -291,9 +291,13 @@ static int Store(vlc_keystore *p_keystore,
/* set attributes */
SetAttributesForQuery(ppsz_values, searchQuery, psz_label);
/* search */
status = SecItemCopyMatching((__bridge CFDictionaryRef)searchQuery, nil);
// One return type must be added for SecItemCopyMatching, even if not used.
// Older macOS versions (10.7) are very picky here...
[searchQuery setObject:@(YES) forKey:(__bridge id)kSecReturnRef];
CFTypeRef result = NULL;
/* search */
status = SecItemCopyMatching((__bridge CFDictionaryRef)searchQuery, &result);
/* create storage unit */
NSData *secretData = [[NSString stringWithFormat:@"%s", p_secret] dataUsingEncoding:NSUTF8StringEncoding];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment