Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ffa6dbe0
Commit
ffa6dbe0
authored
Dec 07, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add support for filtering credentials on MacOS in CredEnumerateW.
parent
c66b78a8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
cred.c
dlls/advapi32/cred.c
+35
-4
No files found.
dlls/advapi32/cred.c
View file @
ffa6dbe0
...
...
@@ -716,7 +716,7 @@ static LPWSTR get_key_name_for_target(LPCWSTR target_name, DWORD type)
return
key_name
;
}
static
BOOL
credential_matches_filter
(
HKEY
hkeyCred
,
LPCWSTR
filter
)
static
BOOL
registry_
credential_matches_filter
(
HKEY
hkeyCred
,
LPCWSTR
filter
)
{
LPWSTR
target_name
;
DWORD
ret
;
...
...
@@ -777,7 +777,7 @@ static DWORD registry_enumerate_credentials(HKEY hkeyMgr, LPCWSTR filter,
ret
=
RegOpenKeyExW
(
hkeyMgr
,
target_name
,
0
,
KEY_QUERY_VALUE
,
&
hkeyCred
);
if
(
ret
!=
ERROR_SUCCESS
)
continue
;
if
(
!
credential_matches_filter
(
hkeyCred
,
filter
))
if
(
!
registry_
credential_matches_filter
(
hkeyCred
,
filter
))
{
RegCloseKey
(
hkeyCred
);
continue
;
...
...
@@ -801,6 +801,30 @@ static DWORD registry_enumerate_credentials(HKEY hkeyMgr, LPCWSTR filter,
}
#ifdef __APPLE__
static
BOOL
mac_credential_matches_filter
(
void
*
data
,
UInt32
data_len
,
const
WCHAR
*
filter
)
{
int
len
;
WCHAR
*
target_name
;
const
WCHAR
*
p
;
BOOL
ret
;
if
(
!
filter
)
return
TRUE
;
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
data
,
data_len
,
NULL
,
0
);
if
(
!
(
target_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
))))
return
FALSE
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
data
,
data_len
,
target_name
,
len
);
target_name
[
len
]
=
0
;
TRACE
(
"comparing filter %s to target name %s
\n
"
,
debugstr_w
(
filter
),
debugstr_w
(
target_name
));
p
=
strchrW
(
filter
,
'*'
);
ret
=
CompareStringW
(
GetThreadLocale
(),
0
,
filter
,
(
p
&&
!
p
[
1
]
?
p
-
filter
:
-
1
),
target_name
,
(
p
&&
!
p
[
1
]
?
p
-
filter
:
-
1
))
==
CSTR_EQUAL
;
HeapFree
(
GetProcessHeap
(),
0
,
target_name
);
return
ret
;
}
static
DWORD
mac_enumerate_credentials
(
LPCWSTR
filter
,
PCREDENTIALW
*
credentials
,
char
*
buffer
,
DWORD
*
len
,
DWORD
*
count
)
{
...
...
@@ -821,6 +845,8 @@ static DWORD mac_enumerate_credentials(LPCWSTR filter, PCREDENTIALW *credentials
SecKeychainAttributeInfo
info
;
SecKeychainAttributeList
*
attr_list
;
UInt32
info_tags
[]
=
{
kSecServerItemAttr
};
BOOL
match
;
info
.
count
=
sizeof
(
info_tags
)
/
sizeof
(
info_tags
[
0
]);
info
.
tag
=
info_tags
;
info
.
format
=
NULL
;
...
...
@@ -837,10 +863,15 @@ static DWORD mac_enumerate_credentials(LPCWSTR filter, PCREDENTIALW *credentials
}
else
*
len
+=
sizeof
(
CREDENTIALW
);
if
(
attr_list
->
count
!=
1
||
attr_list
->
attr
[
0
].
tag
!=
kSecServerItemAttr
)
continue
;
if
(
attr_list
->
count
!=
1
||
attr_list
->
attr
[
0
].
tag
!=
kSecServerItemAttr
)
{
SecKeychainItemFreeAttributesAndData
(
attr_list
,
NULL
);
continue
;
}
TRACE
(
"server item: %.*s
\n
"
,
(
int
)
attr_list
->
attr
[
0
].
length
,
(
char
*
)
attr_list
->
attr
[
0
].
data
);
/* FIXME: filter based on attr_list->attr[0].data */
match
=
mac_credential_matches_filter
(
attr_list
->
attr
[
0
].
data
,
attr_list
->
attr
[
0
].
length
,
filter
);
SecKeychainItemFreeAttributesAndData
(
attr_list
,
NULL
);
if
(
!
match
)
continue
;
ret
=
mac_read_credential_from_item
(
item
,
FALSE
,
buffer
?
credentials
[
*
count
]
:
NULL
,
buffer
?
buffer
+
sizeof
(
CREDENTIALW
)
:
NULL
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment