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
98820d4e
Commit
98820d4e
authored
Jul 04, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Jul 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32: Add tests for multiple use of a credential handle.
parent
618c1fe7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
ntlm.c
dlls/secur32/tests/ntlm.c
+65
-0
No files found.
dlls/secur32/tests/ntlm.c
View file @
98820d4e
...
@@ -1196,6 +1196,69 @@ static void testAcquireCredentialsHandle(void)
...
@@ -1196,6 +1196,69 @@ static void testAcquireCredentialsHandle(void)
pFreeCredentialsHandle
(
&
cred
);
pFreeCredentialsHandle
(
&
cred
);
}
}
static
void
test_cred_multiple_use
(
void
)
{
static
char
test_user
[]
=
"testuser"
,
workgroup
[]
=
"WORKGROUP"
,
test_pass
[]
=
"testpass"
,
sec_pkg_name
[]
=
"NTLM"
;
SECURITY_STATUS
ret
;
SEC_WINNT_AUTH_IDENTITY
id
;
PSecPkgInfo
pkg_info
=
NULL
;
CredHandle
cred
;
CtxtHandle
ctxt1
;
CtxtHandle
ctxt2
;
SecBufferDesc
buffer_desc
;
SecBuffer
buffers
[
1
];
ULONG
ctxt_attr
;
TimeStamp
ttl
;
if
(
pQuerySecurityPackageInfoA
(
sec_pkg_name
,
&
pkg_info
)
!=
SEC_E_OK
)
{
skip
(
"NTLM package not installed, skipping test
\n
"
);
return
;
}
buffers
[
0
].
cbBuffer
=
pkg_info
->
cbMaxToken
;
buffers
[
0
].
BufferType
=
SECBUFFER_TOKEN
;
buffers
[
0
].
pvBuffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buffers
[
0
].
cbBuffer
);
pFreeContextBuffer
(
pkg_info
);
id
.
User
=
(
unsigned
char
*
)
test_user
;
id
.
UserLength
=
strlen
((
char
*
)
id
.
User
);
id
.
Domain
=
(
unsigned
char
*
)
workgroup
;
id
.
DomainLength
=
strlen
((
char
*
)
id
.
Domain
);
id
.
Password
=
(
unsigned
char
*
)
test_pass
;
id
.
PasswordLength
=
strlen
((
char
*
)
id
.
Password
);
id
.
Flags
=
SEC_WINNT_AUTH_IDENTITY_ANSI
;
ret
=
pAcquireCredentialsHandleA
(
NULL
,
sec_pkg_name
,
SECPKG_CRED_OUTBOUND
,
NULL
,
&
id
,
NULL
,
NULL
,
&
cred
,
&
ttl
);
ok
(
ret
==
SEC_E_OK
,
"AcquireCredentialsHande() returned %s
\n
"
,
getSecError
(
ret
));
buffer_desc
.
ulVersion
=
SECBUFFER_VERSION
;
buffer_desc
.
cBuffers
=
sizeof
(
buffers
)
/
sizeof
(
buffers
[
0
]);
buffer_desc
.
pBuffers
=
buffers
;
ret
=
pInitializeSecurityContextA
(
&
cred
,
NULL
,
NULL
,
ISC_REQ_CONNECTION
,
0
,
SECURITY_NETWORK_DREP
,
NULL
,
0
,
&
ctxt1
,
&
buffer_desc
,
&
ctxt_attr
,
&
ttl
);
ok
(
ret
==
SEC_I_CONTINUE_NEEDED
,
"InitializeSecurityContextA failed with error 0x%x
\n
"
,
ret
);
ret
=
pInitializeSecurityContextA
(
&
cred
,
NULL
,
NULL
,
ISC_REQ_CONNECTION
,
0
,
SECURITY_NETWORK_DREP
,
NULL
,
0
,
&
ctxt2
,
&
buffer_desc
,
&
ctxt_attr
,
&
ttl
);
ok
(
ret
==
SEC_I_CONTINUE_NEEDED
,
"Second InitializeSecurityContextA on cred handle failed with error 0x%x
\n
"
,
ret
);
ret
=
pDeleteSecurityContext
(
&
ctxt1
);
ok
(
ret
==
SEC_E_OK
,
"DeleteSecurityContext failed with error 0x%x
\n
"
,
ret
);
ret
=
pDeleteSecurityContext
(
&
ctxt2
);
ok
(
ret
==
SEC_E_OK
,
"DeleteSecurityContext failed with error 0x%x
\n
"
,
ret
);
ret
=
pFreeCredentialsHandle
(
&
cred
);
ok
(
ret
==
SEC_E_OK
,
"FreeCredentialsHandle failed with error 0x%x
\n
"
,
ret
);
}
START_TEST
(
ntlm
)
START_TEST
(
ntlm
)
{
{
InitFunctionPtrs
();
InitFunctionPtrs
();
...
@@ -1217,6 +1280,8 @@ START_TEST(ntlm)
...
@@ -1217,6 +1280,8 @@ START_TEST(ntlm)
if
(
pMakeSignature
&&
pVerifySignature
&&
pEncryptMessage
&&
if
(
pMakeSignature
&&
pVerifySignature
&&
pEncryptMessage
&&
pDecryptMessage
)
pDecryptMessage
)
testSignSeal
();
testSignSeal
();
test_cred_multiple_use
();
}
}
if
(
secdll
)
if
(
secdll
)
...
...
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