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
309b5366
Commit
309b5366
authored
Mar 29, 2014
by
Thomas Faber
Committed by
Alexandre Julliard
Mar 31, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Set output type earlier in CredUnmarshalCredential.
parent
27c8e901
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
14 deletions
+23
-14
cred.c
dlls/advapi32/cred.c
+6
-5
cred.c
dlls/advapi32/tests/cred.c
+17
-9
No files found.
dlls/advapi32/cred.c
View file @
309b5366
...
...
@@ -2068,13 +2068,15 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
TRACE
(
"%s, %p, %p
\n
"
,
debugstr_w
(
cred
),
type
,
out
);
if
(
!
cred
||
cred
[
0
]
!=
'@'
||
cred
[
1
]
!=
'@'
||
!
cred
[
2
]
||
!
cred
[
3
])
if
(
!
cred
||
cred
[
0
]
!=
'@'
||
cred
[
1
]
!=
'@'
||
char_decode
(
cred
[
2
]
)
>
63
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
len
=
strlenW
(
cred
+
3
);
switch
(
cred
[
2
]
-
'A'
)
*
type
=
char_decode
(
cred
[
2
]
);
switch
(
*
type
)
{
case
CertCredential
:
{
...
...
@@ -2089,7 +2091,6 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
if
(
!
(
cert
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
cert
)
)))
return
FALSE
;
memcpy
(
cert
->
rgbHashOfCert
,
hash
,
sizeof
(
cert
->
rgbHashOfCert
)
);
cert
->
cbSize
=
sizeof
(
*
cert
);
*
type
=
CertCredential
;
*
out
=
cert
;
break
;
}
...
...
@@ -2113,7 +2114,6 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
}
target
->
UserName
=
(
WCHAR
*
)(
target
+
1
);
target
->
UserName
[
size
/
sizeof
(
WCHAR
)]
=
0
;
*
type
=
UsernameTargetCredential
;
*
out
=
target
;
break
;
}
...
...
@@ -2121,7 +2121,8 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
FIXME
(
"BinaryBlobCredential not implemented
\n
"
);
return
FALSE
;
default:
WARN
(
"unhandled type %u
\n
"
,
cred
[
2
]
-
'A'
);
WARN
(
"unhandled type %u
\n
"
,
*
type
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
return
TRUE
;
...
...
dlls/advapi32/tests/cred.c
View file @
309b5366
...
...
@@ -580,9 +580,25 @@ static void test_CredUnmarshalCredentialA(void)
CRED_MARSHAL_TYPE
type
;
const
void
*
unmarshaled
;
}
tests
[]
=
{
{
""
,
0
,
NULL
},
{
"@"
,
0
,
NULL
},
{
"@@"
,
0
,
NULL
},
{
"@@@"
,
0
,
NULL
},
{
"@@A"
,
0
,
NULL
},
{
"@@E"
,
4
,
NULL
},
{
"@@Z"
,
25
,
NULL
},
{
"@@a"
,
26
,
NULL
},
{
"@@0"
,
52
,
NULL
},
{
"@@#"
,
62
,
NULL
},
{
"@@-"
,
63
,
NULL
},
{
"@@B"
,
CertCredential
,
NULL
},
{
"@@BA"
,
CertCredential
,
NULL
},
{
"@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA"
,
CertCredential
,
cert_empty
},
{
"@@BXlmblBAAAAAAAAAAAAAAAAAAAAA"
,
CertCredential
,
cert_wine
},
{
"@@C"
,
UsernameTargetCredential
,
NULL
},
{
"@@CA"
,
UsernameTargetCredential
,
NULL
},
{
"@@CAAAAAA"
,
UsernameTargetCredential
,
NULL
},
{
"@@CAAAAAA0B"
,
UsernameTargetCredential
,
NULL
},
{
"@@CAAAAAA0BA"
,
UsernameTargetCredential
,
NULL
},
{
"@@CCAAAAA0BA"
,
UsernameTargetCredential
,
tW
},
{
"@@CIAAAAA0BQZAMHA0BA"
,
UsernameTargetCredential
,
testW
},
...
...
@@ -610,14 +626,6 @@ static void test_CredUnmarshalCredentialA(void)
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
type
=
0
;
cert
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
pCredUnmarshalCredentialA
(
""
,
&
type
,
(
void
**
)
&
cert
);
error
=
GetLastError
();
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
if
(
0
)
{
/* crash */
SetLastError
(
0xdeadbeef
);
ret
=
pCredUnmarshalCredentialA
(
"@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA"
,
&
type
,
NULL
);
...
...
@@ -665,7 +673,7 @@ static void test_CredUnmarshalCredentialA(void)
{
ok
(
!
ret
,
"[%u] unexpected success
\n
"
,
i
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"[%u] got %u
\n
"
,
i
,
error
);
todo_wine
ok
(
type
==
tests
[
i
].
type
,
"[%u] got %u
\n
"
,
i
,
type
);
ok
(
type
==
tests
[
i
].
type
,
"[%u] got %u
\n
"
,
i
,
type
);
ok
(
p
==
NULL
,
"[%u] returned pointer is not NULL
\n
"
,
i
);
}
...
...
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