Module: wine Branch: master Commit: d245e7978dc5761ebdf6ec5e8df77182d0aa5f8e URL: http://source.winehq.org/git/wine.git/?a=commit;h=d245e7978dc5761ebdf6ec5e8d...
Author: Rob Shearman rob@codeweavers.com Date: Wed Apr 30 22:05:17 2008 +0100
advapi32: Make sure not to return a credential with a NULL UserName field when a Mac Keychain doesn't have an account name attribute.
---
dlls/advapi32/cred.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/dlls/advapi32/cred.c b/dlls/advapi32/cred.c index 44de697..50a27c0 100644 --- a/dlls/advapi32/cred.c +++ b/dlls/advapi32/cred.c @@ -250,6 +250,7 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require void *cred_blob; LPWSTR domain = NULL; LPWSTR user = NULL; + BOOL user_name_present = FALSE; SecKeychainAttributeInfo info; SecKeychainAttributeList *attr_list; UInt32 info_tags[] = { kSecServerItemAttr, kSecSecurityDomainItemAttr, kSecAccountItemAttr, @@ -269,6 +270,19 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require WARN("SecKeychainItemCopyAttributesAndData returned status %ld\n", status); return ERROR_NOT_FOUND; } + + for (i = 0; i < attr_list->count; i++) + if (attr_list->attr[i].tag == kSecAccountItemAttr && attr_list->attr[i].data) + { + user_name_present = TRUE; + break; + } + if (!user_name_present) + { + WARN("no kSecAccountItemAttr for item\n"); + return ERROR_NOT_FOUND; + } + if (buffer) { credential->Flags = 0;