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
8a29c57f
Commit
8a29c57f
authored
Jun 21, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32/tests: Don't load secur32.dll function dynamically in negotiate.c.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e3bd659b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
67 deletions
+20
-67
Makefile.in
dlls/secur32/tests/Makefile.in
+1
-1
negotiate.c
dlls/secur32/tests/negotiate.c
+19
-66
No files found.
dlls/secur32/tests/Makefile.in
View file @
8a29c57f
TESTDLL
=
secur32.dll
IMPORTS
=
crypt32 advapi32 ws2_32
IMPORTS
=
secur32
crypt32 advapi32 ws2_32
C_SRCS
=
\
main.c
\
...
...
dlls/secur32/tests/negotiate.c
View file @
8a29c57f
...
...
@@ -31,45 +31,6 @@
#include "wine/test.h"
static
HMODULE
hsecur32
;
static
SECURITY_STATUS
(
SEC_ENTRY
*
pAcceptSecurityContext
)(
PCredHandle
,
PCtxtHandle
,
PSecBufferDesc
,
ULONG
,
ULONG
,
PCtxtHandle
,
PSecBufferDesc
,
PULONG
,
PTimeStamp
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pAcquireCredentialsHandleA
)(
SEC_CHAR
*
,
SEC_CHAR
*
,
ULONG
,
PLUID
,
PVOID
,
SEC_GET_KEY_FN
,
PVOID
,
PCredHandle
,
PTimeStamp
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pCompleteAuthToken
)(
PCtxtHandle
,
PSecBufferDesc
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pDecryptMessage
)(
PCtxtHandle
,
PSecBufferDesc
,
ULONG
,
PULONG
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pDeleteSecurityContext
)(
PCtxtHandle
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pEncryptMessage
)(
PCtxtHandle
,
ULONG
,
PSecBufferDesc
,
ULONG
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pFreeContextBuffer
)(
PVOID
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pFreeCredentialsHandle
)(
PCredHandle
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pInitializeSecurityContextA
)(
PCredHandle
,
PCtxtHandle
,
SEC_CHAR
*
,
ULONG
,
ULONG
,
ULONG
,
PSecBufferDesc
,
ULONG
,
PCtxtHandle
,
PSecBufferDesc
,
PULONG
,
PTimeStamp
);
static
PSecurityFunctionTableA
(
SEC_ENTRY
*
pInitSecurityInterfaceA
)(
void
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pMakeSignature
)(
PCtxtHandle
,
ULONG
,
PSecBufferDesc
,
ULONG
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pQueryContextAttributesA
)(
PCtxtHandle
,
ULONG
,
PVOID
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pQuerySecurityPackageInfoA
)(
SEC_CHAR
*
,
PSecPkgInfoA
*
);
static
SECURITY_STATUS
(
SEC_ENTRY
*
pVerifySignature
)(
PCtxtHandle
,
PSecBufferDesc
,
ULONG
,
PULONG
);
static
void
init_function_ptrs
(
void
)
{
if
(
!
(
hsecur32
=
LoadLibraryA
(
"secur32.dll"
)))
return
;
pAcceptSecurityContext
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"AcceptSecurityContext"
);
pAcquireCredentialsHandleA
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"AcquireCredentialsHandleA"
);
pCompleteAuthToken
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"CompleteAuthToken"
);
pDecryptMessage
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"DecryptMessage"
);
pDeleteSecurityContext
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"DeleteSecurityContext"
);
pEncryptMessage
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"EncryptMessage"
);
pFreeContextBuffer
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"FreeContextBuffer"
);
pFreeCredentialsHandle
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"FreeCredentialsHandle"
);
pInitializeSecurityContextA
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"InitializeSecurityContextA"
);
pInitSecurityInterfaceA
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"InitSecurityInterfaceA"
);
pMakeSignature
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"MakeSignature"
);
pQueryContextAttributesA
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"QueryContextAttributesA"
);
pQuerySecurityPackageInfoA
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"QuerySecurityPackageInfoA"
);
pVerifySignature
=
(
void
*
)
GetProcAddress
(
hsecur32
,
"VerifySignature"
);
}
#define NEGOTIATE_BASE_CAPS ( \
SECPKG_FLAG_INTEGRITY | \
SECPKG_FLAG_PRIVACY | \
...
...
@@ -158,13 +119,13 @@ static SECURITY_STATUS setup_client( struct sspi_data *data, SEC_CHAR *provider
trace
(
"setting up client
\n
"
);
ret
=
p
QuerySecurityPackageInfoA
(
provider
,
&
info
);
ret
=
QuerySecurityPackageInfoA
(
provider
,
&
info
);
ok
(
ret
==
SEC_E_OK
,
"QuerySecurityPackageInfo returned %08x
\n
"
,
ret
);
setup_buffers
(
data
,
info
);
p
FreeContextBuffer
(
info
);
FreeContextBuffer
(
info
);
ret
=
p
AcquireCredentialsHandleA
(
NULL
,
provider
,
SECPKG_CRED_OUTBOUND
,
NULL
,
ret
=
AcquireCredentialsHandleA
(
NULL
,
provider
,
SECPKG_CRED_OUTBOUND
,
NULL
,
data
->
id
,
NULL
,
NULL
,
&
data
->
cred
,
&
ttl
);
ok
(
ret
==
SEC_E_OK
,
"AcquireCredentialsHandleA returned %08x
\n
"
,
ret
);
return
ret
;
...
...
@@ -178,13 +139,13 @@ static SECURITY_STATUS setup_server( struct sspi_data *data, SEC_CHAR *provider
trace
(
"setting up server
\n
"
);
ret
=
p
QuerySecurityPackageInfoA
(
provider
,
&
info
);
ret
=
QuerySecurityPackageInfoA
(
provider
,
&
info
);
ok
(
ret
==
SEC_E_OK
,
"QuerySecurityPackageInfo returned %08x
\n
"
,
ret
);
setup_buffers
(
data
,
info
);
p
FreeContextBuffer
(
info
);
FreeContextBuffer
(
info
);
ret
=
p
AcquireCredentialsHandleA
(
NULL
,
provider
,
SECPKG_CRED_INBOUND
,
NULL
,
ret
=
AcquireCredentialsHandleA
(
NULL
,
provider
,
SECPKG_CRED_INBOUND
,
NULL
,
NULL
,
NULL
,
NULL
,
&
data
->
cred
,
&
ttl
);
ok
(
ret
==
SEC_E_OK
,
"AcquireCredentialsHandleA returned %08x
\n
"
,
ret
);
return
ret
;
...
...
@@ -201,12 +162,12 @@ static SECURITY_STATUS run_client( struct sspi_data *data, BOOL first )
data
->
out_buf
->
pBuffers
[
0
].
cbBuffer
=
data
->
max_token
;
data
->
out_buf
->
pBuffers
[
0
].
BufferType
=
SECBUFFER_TOKEN
;
ret
=
p
InitializeSecurityContextA
(
first
?
&
data
->
cred
:
NULL
,
first
?
NULL
:
&
data
->
ctxt
,
ret
=
InitializeSecurityContextA
(
first
?
&
data
->
cred
:
NULL
,
first
?
NULL
:
&
data
->
ctxt
,
NULL
,
0
,
0
,
SECURITY_NETWORK_DREP
,
first
?
NULL
:
data
->
in_buf
,
0
,
&
data
->
ctxt
,
data
->
out_buf
,
&
attr
,
&
ttl
);
if
(
ret
==
SEC_I_COMPLETE_AND_CONTINUE
||
ret
==
SEC_I_COMPLETE_NEEDED
)
{
p
CompleteAuthToken
(
&
data
->
ctxt
,
data
->
out_buf
);
CompleteAuthToken
(
&
data
->
ctxt
,
data
->
out_buf
);
if
(
ret
==
SEC_I_COMPLETE_AND_CONTINUE
)
ret
=
SEC_I_CONTINUE_NEEDED
;
else
if
(
ret
==
SEC_I_COMPLETE_NEEDED
)
...
...
@@ -227,12 +188,12 @@ static SECURITY_STATUS run_server( struct sspi_data *data, BOOL first )
trace
(
"running server for the %s time
\n
"
,
first
?
"first"
:
"second"
);
ret
=
p
AcceptSecurityContext
(
&
data
->
cred
,
first
?
NULL
:
&
data
->
ctxt
,
ret
=
AcceptSecurityContext
(
&
data
->
cred
,
first
?
NULL
:
&
data
->
ctxt
,
data
->
in_buf
,
0
,
SECURITY_NETWORK_DREP
,
&
data
->
ctxt
,
data
->
out_buf
,
&
attr
,
&
ttl
);
if
(
ret
==
SEC_I_COMPLETE_AND_CONTINUE
||
ret
==
SEC_I_COMPLETE_NEEDED
)
{
p
CompleteAuthToken
(
&
data
->
ctxt
,
data
->
out_buf
);
CompleteAuthToken
(
&
data
->
ctxt
,
data
->
out_buf
);
if
(
ret
==
SEC_I_COMPLETE_AND_CONTINUE
)
ret
=
SEC_I_CONTINUE_NEEDED
;
else
if
(
ret
==
SEC_I_COMPLETE_NEEDED
)
...
...
@@ -282,7 +243,7 @@ static void test_authentication(void)
if
((
status
=
setup_server
(
&
server
,
(
SEC_CHAR
*
)
"Negotiate"
)))
{
skip
(
"setup_server returned %08x, skipping test
\n
"
,
status
);
p
FreeCredentialsHandle
(
&
client
.
cred
);
FreeCredentialsHandle
(
&
client
.
cred
);
return
;
}
...
...
@@ -313,7 +274,7 @@ static void test_authentication(void)
sizes
.
cbMaxSignature
=
0xdeadbeef
;
sizes
.
cbSecurityTrailer
=
0xdeadbeef
;
sizes
.
cbBlockSize
=
0xdeadbeef
;
status_c
=
p
QueryContextAttributesA
(
&
client
.
ctxt
,
SECPKG_ATTR_SIZES
,
&
sizes
);
status_c
=
QueryContextAttributesA
(
&
client
.
ctxt
,
SECPKG_ATTR_SIZES
,
&
sizes
);
ok
(
status_c
==
SEC_E_OK
,
"pQueryContextAttributesA returned %08x
\n
"
,
status_c
);
ok
(
sizes
.
cbMaxToken
==
2888
||
sizes
.
cbMaxToken
==
1904
,
"expected 2888 or 1904, got %u
\n
"
,
sizes
.
cbMaxToken
);
...
...
@@ -322,7 +283,7 @@ static void test_authentication(void)
ok
(
!
sizes
.
cbBlockSize
,
"expected 0, got %u
\n
"
,
sizes
.
cbBlockSize
);
memset
(
&
info
,
0
,
sizeof
(
info
)
);
status_c
=
p
QueryContextAttributesA
(
&
client
.
ctxt
,
SECPKG_ATTR_NEGOTIATION_INFO
,
&
info
);
status_c
=
QueryContextAttributesA
(
&
client
.
ctxt
,
SECPKG_ATTR_NEGOTIATION_INFO
,
&
info
);
ok
(
status_c
==
SEC_E_OK
,
"pQueryContextAttributesA returned %08x
\n
"
,
status_c
);
pi
=
info
.
PackageInfo
;
...
...
@@ -347,25 +308,25 @@ done:
if
(
client
.
ctxt
.
dwLower
||
client
.
ctxt
.
dwUpper
)
{
status_c
=
p
DeleteSecurityContext
(
&
client
.
ctxt
);
status_c
=
DeleteSecurityContext
(
&
client
.
ctxt
);
ok
(
status_c
==
SEC_E_OK
,
"DeleteSecurityContext returned %08x
\n
"
,
status_c
);
}
if
(
server
.
ctxt
.
dwLower
||
server
.
ctxt
.
dwUpper
)
{
status_s
=
p
DeleteSecurityContext
(
&
server
.
ctxt
);
status_s
=
DeleteSecurityContext
(
&
server
.
ctxt
);
ok
(
status_s
==
SEC_E_OK
,
"DeleteSecurityContext returned %08x
\n
"
,
status_s
);
}
if
(
client
.
cred
.
dwLower
||
client
.
cred
.
dwUpper
)
{
status_c
=
p
FreeCredentialsHandle
(
&
client
.
cred
);
status_c
=
FreeCredentialsHandle
(
&
client
.
cred
);
ok
(
status_c
==
SEC_E_OK
,
"FreeCredentialsHandle returned %08x
\n
"
,
status_c
);
}
if
(
server
.
cred
.
dwLower
||
server
.
cred
.
dwUpper
)
{
status_s
=
p
FreeCredentialsHandle
(
&
server
.
cred
);
status_s
=
FreeCredentialsHandle
(
&
server
.
cred
);
ok
(
status_s
==
SEC_E_OK
,
"FreeCredentialsHandle returned %08x
\n
"
,
status_s
);
}
}
...
...
@@ -374,15 +335,7 @@ START_TEST(negotiate)
{
SecPkgInfoA
*
info
;
init_function_ptrs
();
if
(
!
pFreeCredentialsHandle
||
!
pAcquireCredentialsHandleA
||
!
pQuerySecurityPackageInfoA
||
!
pFreeContextBuffer
)
{
win_skip
(
"functions are not available
\n
"
);
return
;
}
if
(
pQuerySecurityPackageInfoA
(
(
SEC_CHAR
*
)
"Negotiate"
,
&
info
))
if
(
QuerySecurityPackageInfoA
(
(
SEC_CHAR
*
)
"Negotiate"
,
&
info
))
{
ok
(
0
,
"Negotiate package not installed, skipping test
\n
"
);
return
;
...
...
@@ -396,7 +349,7 @@ START_TEST(negotiate)
ok
(
info
->
wVersion
==
1
,
"got %u
\n
"
,
info
->
wVersion
);
ok
(
info
->
wRPCID
==
RPC_C_AUTHN_GSS_NEGOTIATE
,
"got %u
\n
"
,
info
->
wRPCID
);
ok
(
!
lstrcmpA
(
info
->
Name
,
"Negotiate"
),
"got %s
\n
"
,
info
->
Name
);
p
FreeContextBuffer
(
info
);
FreeContextBuffer
(
info
);
test_authentication
();
}
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