ReactOS 0.4.15-dev-7931-gfd331f1
wrapper.c File Reference
#include "precomp.h"
#include "wine/debug.h"
Include dependency graph for wrapper.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (secur32)
 
static SECURITY_STATUS SECUR32_makeSecHandle (PSecHandle phSec, SecurePackage *package, PSecHandle realHandle)
 
SECURITY_STATUS WINAPI AcquireCredentialsHandleA (SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI AcquireCredentialsHandleW (SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI FreeCredentialsHandle (PCredHandle phCredential)
 
SECURITY_STATUS WINAPI QueryCredentialsAttributesA (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS WINAPI QueryCredentialsAttributesW (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS WINAPI InitializeSecurityContextA (PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI InitializeSecurityContextW (PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI AcceptSecurityContext (PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI CompleteAuthToken (PCtxtHandle phContext, PSecBufferDesc pToken)
 
SECURITY_STATUS WINAPI DeleteSecurityContext (PCtxtHandle phContext)
 
SECURITY_STATUS WINAPI ApplyControlToken (PCtxtHandle phContext, PSecBufferDesc pInput)
 
SECURITY_STATUS WINAPI QueryContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS WINAPI QueryContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS WINAPI ImpersonateSecurityContext (PCtxtHandle phContext)
 
SECURITY_STATUS WINAPI RevertSecurityContext (PCtxtHandle phContext)
 
SECURITY_STATUS WINAPI MakeSignature (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
 
SECURITY_STATUS WINAPI VerifySignature (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
 
SECURITY_STATUS WINAPI QuerySecurityPackageInfoA (SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo)
 
SECURITY_STATUS WINAPI QuerySecurityPackageInfoW (SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo)
 
SECURITY_STATUS WINAPI ExportSecurityContext (PCtxtHandle phContext, ULONG fFlags, PSecBuffer pPackedContext, void **pToken)
 
SECURITY_STATUS WINAPI ImportSecurityContextA (SEC_CHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
 
SECURITY_STATUS WINAPI ImportSecurityContextW (SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
 
SECURITY_STATUS WINAPI AddCredentialsA (PCredHandle hCredentials, SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI AddCredentialsW (PCredHandle hCredentials, SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PTimeStamp ptsExpiry)
 
SECURITY_STATUS WINAPI QuerySecurityContextToken (PCtxtHandle phContext, HANDLE *phToken)
 
SECURITY_STATUS WINAPI EncryptMessage (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
 
SECURITY_STATUS WINAPI DecryptMessage (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
 
SECURITY_STATUS WINAPI SetContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
 
SECURITY_STATUS WINAPI SetContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
 

Function Documentation

◆ AcceptSecurityContext()

SECURITY_STATUS WINAPI AcceptSecurityContext ( PCredHandle  phCredential,
PCtxtHandle  phContext,
PSecBufferDesc  pInput,
ULONG  fContextReq,
ULONG  TargetDataRep,
PCtxtHandle  phNewContext,
PSecBufferDesc  pOutput,
ULONG pfContextAttr,
PTimeStamp  ptsExpiry 
)

Definition at line 365 of file wrapper.c.

369{
371
372 TRACE("%p %p %p %d %d %p %p %p %p\n", phCredential, phContext, pInput,
373 fContextReq, TargetDataRep, phNewContext, pOutput, pfContextAttr,
374 ptsExpiry);
375 if (phCredential)
376 {
377 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
378 PCredHandle cred = (PCredHandle)phCredential->dwLower;
379
380 if (package && package->provider)
381 {
382 if (package->provider->fnTableW.AcceptSecurityContext)
383 {
384 CtxtHandle myCtxt;
385
386 if(phContext)
387 {
388 PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
389 TRACE("realCtx: %p\n", realCtxt);
390 myCtxt.dwUpper = realCtxt->dwUpper;
391 myCtxt.dwLower = realCtxt->dwLower;
392 }
393
394 ret = package->provider->fnTableW.AcceptSecurityContext(
395 cred, phContext ? &myCtxt : NULL, pInput, fContextReq,
396 TargetDataRep, &myCtxt, pOutput, pfContextAttr, ptsExpiry);
398 {
399 SECURITY_STATUS ret2;
400 ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
401 if (ret2 != SEC_E_OK)
402 package->provider->fnTableW.DeleteSecurityContext(
403 &myCtxt);
404 }
405 }
406 else
408 }
409 else
411 }
412 else
414 return ret;
415}
#define NULL
Definition: types.h:112
if(dx< 0)
Definition: linetemp.h:194
LONG SECURITY_STATUS
Definition: sspi.h:34
PSecHandle PCtxtHandle
Definition: sspi.h:71
PSecHandle PCredHandle
Definition: sspi.h:68
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR dwLower
Definition: sspi.h:53
ULONG_PTR dwUpper
Definition: sspi.h:54
int ret
#define SEC_E_OK
Definition: winerror.h:2356
#define SEC_E_INVALID_HANDLE
Definition: winerror.h:2910
#define SEC_E_UNSUPPORTED_FUNCTION
Definition: winerror.h:2911
#define SEC_I_CONTINUE_NEEDED
Definition: winerror.h:2927
static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec, SecurePackage *package, PSecHandle realHandle)
Definition: wrapper.c:30

Referenced by RPCRT4_default_authorize(), and run_server().

◆ AcquireCredentialsHandleA()

SECURITY_STATUS WINAPI AcquireCredentialsHandleA ( SEC_CHAR pszPrincipal,
SEC_CHAR pszPackage,
ULONG  fCredentialsUse,
PLUID  pvLogonID,
PVOID  pAuthData,
SEC_GET_KEY_FN  pGetKeyFn,
PVOID  pvGetKeyArgument,
PCredHandle  phCredential,
PTimeStamp  ptsExpiry 
)

Definition at line 59 of file wrapper.c.

63{
65
66 TRACE("%s %s %d %p %p %p %p %p %p\n", debugstr_a(pszPrincipal),
67 debugstr_a(pszPackage), fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn,
68 pvGetKeyArgument, phCredential, ptsExpiry);
69 if (pszPackage)
70 {
71 SecurePackage *package = SECUR32_findPackageA(pszPackage);
72
73 if (package && package->provider)
74 {
75 if (package->provider->fnTableA.AcquireCredentialsHandleA)
76 {
77 CredHandle myCred;
78
79 ret = package->provider->fnTableA.AcquireCredentialsHandleA(
80 pszPrincipal, pszPackage, fCredentialsUse, pvLogonID,
81 pAuthData, pGetKeyFn, pvGetKeyArgument, &myCred,
82 ptsExpiry);
83 if (ret == SEC_E_OK)
84 {
85 ret = SECUR32_makeSecHandle(phCredential, package, &myCred);
86 if (ret != SEC_E_OK)
87 package->provider->fnTableW.FreeCredentialsHandle(
88 &myCred);
89 }
90 }
91 else
93 }
94 else
96 }
97 else
99 return ret;
100}
#define debugstr_a
Definition: kernel32.h:31
#define SEC_E_SECPKG_NOT_FOUND
Definition: winerror.h:2914

Referenced by authsspi_create_default(), RpcBindingSetAuthInfoExA(), setup_client(), setup_server(), test_communication(), test_cread_attrs(), test_InitializeSecurityContext(), test_kerberos(), testAcquireSecurityContext(), and thunk_AcquireCredentialsHandleW().

◆ AcquireCredentialsHandleW()

SECURITY_STATUS WINAPI AcquireCredentialsHandleW ( SEC_WCHAR pszPrincipal,
SEC_WCHAR pszPackage,
ULONG  fCredentialsUse,
PLUID  pvLogonID,
PVOID  pAuthData,
SEC_GET_KEY_FN  pGetKeyFn,
PVOID  pvGetKeyArgument,
PCredHandle  phCredential,
PTimeStamp  ptsExpiry 
)

Definition at line 105 of file wrapper.c.

109{
111
112 TRACE("%s %s %d %p %p %p %p %p %p\n", debugstr_w(pszPrincipal),
113 debugstr_w(pszPackage), fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn,
114 pvGetKeyArgument, phCredential, ptsExpiry);
115 if (pszPackage)
116 {
117 SecurePackage *package = SECUR32_findPackageW(pszPackage);
118
119 if (package && package->provider)
120 {
121 if (package->provider->fnTableW.AcquireCredentialsHandleW)
122 {
123 CredHandle myCred;
124
125 ret = package->provider->fnTableW.AcquireCredentialsHandleW(
126 pszPrincipal, pszPackage, fCredentialsUse, pvLogonID,
127 pAuthData, pGetKeyFn, pvGetKeyArgument, &myCred,
128 ptsExpiry);
129 if (ret == SEC_E_OK)
130 {
131 ret = SECUR32_makeSecHandle(phCredential, package, &myCred);
132 if (ret != SEC_E_OK)
133 package->provider->fnTableW.FreeCredentialsHandle(
134 &myCred);
135 }
136 }
137 else
139 }
140 else
142 }
143 else
145 return ret;
146}
#define debugstr_w
Definition: kernel32.h:32

Referenced by do_authorization(), ensure_cred_handle(), HTTP_DoAuthorization(), RpcBindingSetAuthInfoExW(), RPCRT4_ServerGetRegisteredAuthInfo(), and thunk_AcquireCredentialsHandleA().

◆ AddCredentialsA()

SECURITY_STATUS WINAPI AddCredentialsA ( PCredHandle  hCredentials,
SEC_CHAR pszPrincipal,
SEC_CHAR pszPackage,
ULONG  fCredentialUse,
void pAuthData,
SEC_GET_KEY_FN  pGetKeyFn,
void pvGetKeyArgument,
PTimeStamp  ptsExpiry 
)

Definition at line 906 of file wrapper.c.

910{
912
913 TRACE("%p %s %s %d %p %p %p %p\n", hCredentials, debugstr_a(pszPrincipal),
914 debugstr_a(pszPackage), fCredentialUse, pAuthData, pGetKeyFn,
915 pvGetKeyArgument, ptsExpiry);
916 if (hCredentials)
917 {
918 SecurePackage *package = (SecurePackage *)hCredentials->dwUpper;
919 PCredHandle cred = (PCtxtHandle)hCredentials->dwLower;
920
921 if (package && package->provider)
922 {
923 if (package->provider->fnTableA.AddCredentialsA)
924 ret = package->provider->fnTableA.AddCredentialsA(
925 cred, pszPrincipal, pszPackage, fCredentialUse, pAuthData,
926 pGetKeyFn, pvGetKeyArgument, ptsExpiry);
927 else
929 }
930 else
932 }
933 else
935 return ret;
936}

◆ AddCredentialsW()

SECURITY_STATUS WINAPI AddCredentialsW ( PCredHandle  hCredentials,
SEC_WCHAR pszPrincipal,
SEC_WCHAR pszPackage,
ULONG  fCredentialUse,
void pAuthData,
SEC_GET_KEY_FN  pGetKeyFn,
void pvGetKeyArgument,
PTimeStamp  ptsExpiry 
)

Definition at line 941 of file wrapper.c.

945{
947
948 TRACE("%p %s %s %d %p %p %p %p\n", hCredentials, debugstr_w(pszPrincipal),
949 debugstr_w(pszPackage), fCredentialUse, pAuthData, pGetKeyFn,
950 pvGetKeyArgument, ptsExpiry);
951 if (hCredentials)
952 {
953 SecurePackage *package = (SecurePackage *)hCredentials->dwUpper;
954 PCredHandle cred = (PCtxtHandle)hCredentials->dwLower;
955
956 if (package && package->provider)
957 {
958 if (package->provider->fnTableW.AddCredentialsW)
959 ret = package->provider->fnTableW.AddCredentialsW(
960 cred, pszPrincipal, pszPackage, fCredentialUse, pAuthData,
961 pGetKeyFn, pvGetKeyArgument, ptsExpiry);
962 else
964 }
965 else
967 }
968 else
970 return ret;
971}

◆ ApplyControlToken()

SECURITY_STATUS WINAPI ApplyControlToken ( PCtxtHandle  phContext,
PSecBufferDesc  pInput 
)

Definition at line 475 of file wrapper.c.

477{
479
480 TRACE("%p %p\n", phContext, pInput);
481 if (phContext)
482 {
483 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
484 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
485
486 if (package && package->provider)
487 {
488 if (package->provider->fnTableW.ApplyControlToken)
489 ret = package->provider->fnTableW.ApplyControlToken(
490 ctxt, pInput);
491 else
493 }
494 else
496 }
497 else
499 return ret;
500}

◆ CompleteAuthToken()

SECURITY_STATUS WINAPI CompleteAuthToken ( PCtxtHandle  phContext,
PSecBufferDesc  pToken 
)

Definition at line 420 of file wrapper.c.

422{
424
425 TRACE("%p %p\n", phContext, pToken);
426 if (phContext)
427 {
428 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
429 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
430
431 if (package && package->provider)
432 {
433 if (package->provider->fnTableW.CompleteAuthToken)
434 ret = package->provider->fnTableW.CompleteAuthToken(ctxt,
435 pToken);
436 else
438 }
439 else
441 }
442 else
444 return ret;
445}

Referenced by RPCRT4_default_authorize(), run_client(), and run_server().

◆ DecryptMessage()

SECURITY_STATUS WINAPI DecryptMessage ( PCtxtHandle  phContext,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo,
PULONG  pfQOP 
)

Definition at line 1036 of file wrapper.c.

1038{
1040
1041 TRACE("%p %p %d %p\n", phContext, pMessage, MessageSeqNo, pfQOP);
1042 if (phContext)
1043 {
1044 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
1045 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
1046
1047 if (package && package->provider)
1048 {
1049 if (package->provider->fnTableW.DecryptMessage)
1050 ret = package->provider->fnTableW.DecryptMessage(
1051 ctxt, pMessage, MessageSeqNo, pfQOP);
1052 else
1054 }
1055 else
1057 }
1058 else
1060 return ret;
1061}

Referenced by read_ssl_chunk(), RPCRT4_default_secure_packet(), sspi_unwrap(), and test_communication().

◆ DeleteSecurityContext()

SECURITY_STATUS WINAPI DeleteSecurityContext ( PCtxtHandle  phContext)

Definition at line 450 of file wrapper.c.

451{
453
454 TRACE("%p\n", phContext);
455 if (phContext)
456 {
457 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
458 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
459
460 if (package && package->provider &&
461 package->provider->fnTableW.DeleteSecurityContext)
462 ret = package->provider->fnTableW.DeleteSecurityContext(ctxt);
463 else
465 HeapFree(GetProcessHeap(), 0, ctxt);
466 }
467 else
469 return ret;
470}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by authsspi_destroy_context(), authsspi_refresh(), destroy_authinfo(), free_netconn(), netcon_secure_connect_setup(), netconn_close(), netconn_secure_connect(), RPCRT4_CloseConnection(), RPCRT4_ServerConnectionAuth(), tcp_disconnect(), test_authentication(), test_communication(), and test_InitializeSecurityContext().

◆ EncryptMessage()

SECURITY_STATUS WINAPI EncryptMessage ( PCtxtHandle  phContext,
ULONG  fQOP,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo 
)

Definition at line 1006 of file wrapper.c.

1008{
1010
1011 TRACE("%p %d %p %d\n", phContext, fQOP, pMessage, MessageSeqNo);
1012 if (phContext)
1013 {
1014 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
1015 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
1016
1017 if (package && package->provider)
1018 {
1019 if (package->provider->fnTableW.EncryptMessage)
1020 ret = package->provider->fnTableW.EncryptMessage(
1021 ctxt, fQOP, pMessage, MessageSeqNo);
1022 else
1024 }
1025 else
1027 }
1028 else
1030 return ret;
1031}

Referenced by RPCRT4_default_secure_packet(), send_ssl_chunk(), sspi_wrap(), and test_communication().

◆ ExportSecurityContext()

SECURITY_STATUS WINAPI ExportSecurityContext ( PCtxtHandle  phContext,
ULONG  fFlags,
PSecBuffer  pPackedContext,
void **  pToken 
)

Definition at line 807 of file wrapper.c.

809{
811
812 TRACE("%p %d %p %p\n", phContext, fFlags, pPackedContext, pToken);
813 if (phContext)
814 {
815 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
816 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
817
818 if (package && package->provider)
819 {
820 if (package->provider->fnTableW.ExportSecurityContext)
821 ret = package->provider->fnTableW.ExportSecurityContext(
822 ctxt, fFlags, pPackedContext, pToken);
823 else
825 }
826 else
828 }
829 else
831 return ret;
832}

◆ FreeCredentialsHandle()

SECURITY_STATUS WINAPI FreeCredentialsHandle ( PCredHandle  phCredential)

Definition at line 151 of file wrapper.c.

153{
155
156 TRACE("%p\n", phCredential);
157 if (phCredential)
158 {
159 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
160 PCredHandle cred = (PCredHandle)phCredential->dwLower;
161
162 if (package && package->provider &&
163 package->provider->fnTableW.FreeCredentialsHandle)
164 ret = package->provider->fnTableW.FreeCredentialsHandle(cred);
165 else
167 HeapFree(GetProcessHeap(), 0, cred);
168 }
169 else
171 return ret;
172}

Referenced by authsspi_create_default(), authsspi_destroy(), destroy_authinfo(), NETCON_unload(), request_destroy(), request_set_option(), RpcAuthInfo_Release(), RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), RPCRT4_ServerConnectionAuth(), tcp_disconnect(), test_authentication(), test_communication(), test_cread_attrs(), test_InitializeSecurityContext(), and testAcquireSecurityContext().

◆ ImpersonateSecurityContext()

SECURITY_STATUS WINAPI ImpersonateSecurityContext ( PCtxtHandle  phContext)

Definition at line 565 of file wrapper.c.

566{
568
569 TRACE("%p\n", phContext);
570 if (phContext)
571 {
572 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
573 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
574
575 if (package && package->provider)
576 {
577 if (package->provider->fnTableW.ImpersonateSecurityContext)
578 ret = package->provider->fnTableW.ImpersonateSecurityContext(
579 ctxt);
580 else
582 }
583 else
585 }
586 else
588 return ret;
589}

Referenced by RPCRT4_default_impersonate_client().

◆ ImportSecurityContextA()

SECURITY_STATUS WINAPI ImportSecurityContextA ( SEC_CHAR pszPackage,
PSecBuffer  pPackedContext,
void Token,
PCtxtHandle  phContext 
)

Definition at line 837 of file wrapper.c.

839{
841 SecurePackage *package = SECUR32_findPackageA(pszPackage);
842
843 TRACE("%s %p %p %p\n", debugstr_a(pszPackage), pPackedContext, Token,
844 phContext);
845 if (package && package->provider)
846 {
847 if (package->provider->fnTableA.ImportSecurityContextA)
848 {
849 CtxtHandle myCtxt;
850
851 ret = package->provider->fnTableA.ImportSecurityContextA(
852 pszPackage, pPackedContext, Token, &myCtxt);
853 if (ret == SEC_E_OK)
854 {
855 ret = SECUR32_makeSecHandle(phContext, package, &myCtxt);
856 if (ret != SEC_E_OK)
857 package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
858 }
859 }
860 else
862 }
863 else
865 return ret;
866
867}

Referenced by thunk_ImportSecurityContextW().

◆ ImportSecurityContextW()

SECURITY_STATUS WINAPI ImportSecurityContextW ( SEC_WCHAR pszPackage,
PSecBuffer  pPackedContext,
void Token,
PCtxtHandle  phContext 
)

Definition at line 872 of file wrapper.c.

874{
876 SecurePackage *package = SECUR32_findPackageW(pszPackage);
877
878 TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token,
879 phContext);
880 if (package && package->provider)
881 {
882 if (package->provider->fnTableW.ImportSecurityContextW)
883 {
884 CtxtHandle myCtxt;
885
886 ret = package->provider->fnTableW.ImportSecurityContextW(
887 pszPackage, pPackedContext, Token, &myCtxt);
888 if (ret == SEC_E_OK)
889 {
890 ret = SECUR32_makeSecHandle(phContext, package, &myCtxt);
891 if (ret != SEC_E_OK)
892 package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
893 }
894 }
895 else
897 }
898 else
900 return ret;
901}

Referenced by thunk_ImportSecurityContextA().

◆ InitializeSecurityContextA()

SECURITY_STATUS WINAPI InitializeSecurityContextA ( PCredHandle  phCredential,
PCtxtHandle  phContext,
SEC_CHAR pszTargetName,
ULONG  fContextReq,
ULONG  Reserved1,
ULONG  TargetDataRep,
PSecBufferDesc  pInput,
ULONG  Reserved2,
PCtxtHandle  phNewContext,
PSecBufferDesc  pOutput,
ULONG pfContextAttr,
PTimeStamp  ptsExpiry 
)

Definition at line 237 of file wrapper.c.

243{
245 SecurePackage *package = NULL;
246 PCredHandle cred = NULL;
247 PCredHandle ctxt = NULL;
248
249 TRACE("%p %p %s 0x%08x %d %d %p %d %p %p %p %p\n", phCredential, phContext,
250 debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
251 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
252
253 if (phContext)
254 {
255 package = (SecurePackage *)phContext->dwUpper;
256 ctxt = (PCtxtHandle)phContext->dwLower;
257 }
258 if (phCredential)
259 {
260 package = (SecurePackage *)phCredential->dwUpper;
261 cred = (PCredHandle)phCredential->dwLower;
262 }
263
264 if (package && package->provider)
265 {
266 if (package->provider->fnTableA.InitializeSecurityContextA)
267 {
268 CtxtHandle myCtxt;
269
270 if (phContext)
271 {
272 PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
273 myCtxt.dwUpper = realCtxt->dwUpper;
274 myCtxt.dwLower = realCtxt->dwLower;
275 }
276
277 ret = package->provider->fnTableA.InitializeSecurityContextA(
278 cred, ctxt, pszTargetName, fContextReq,
279 Reserved1, TargetDataRep, pInput, Reserved2, phNewContext ? &myCtxt : NULL,
280 pOutput, pfContextAttr, ptsExpiry);
281 if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) &&
282 phNewContext && phNewContext != phContext)
283 {
284 SECURITY_STATUS ret2;
285 ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
286 if (ret2 != SEC_E_OK)
287 package->provider->fnTableA.DeleteSecurityContext(&myCtxt);
288 }
289 }
290 else
292 }
293 else
295 return ret;
296}
@ Reserved2
Definition: bcd.h:202
@ Reserved1
Definition: bcd.h:201

Referenced by authsspi_refresh(), run_client(), test_communication(), and test_InitializeSecurityContext().

◆ InitializeSecurityContextW()

SECURITY_STATUS WINAPI InitializeSecurityContextW ( PCredHandle  phCredential,
PCtxtHandle  phContext,
SEC_WCHAR pszTargetName,
ULONG  fContextReq,
ULONG  Reserved1,
ULONG  TargetDataRep,
PSecBufferDesc  pInput,
ULONG  Reserved2,
PCtxtHandle  phNewContext,
PSecBufferDesc  pOutput,
ULONG pfContextAttr,
PTimeStamp  ptsExpiry 
)

Definition at line 301 of file wrapper.c.

307{
309 SecurePackage *package = NULL;
310 PCredHandle cred = NULL;
311 PCredHandle ctxt = NULL;
312
313 TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
314 debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
315 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
316
317 if (phContext)
318 {
319 package = (SecurePackage *)phContext->dwUpper;
320 ctxt = (PCtxtHandle)phContext->dwLower;
321 }
322 if (phCredential)
323 {
324 package = (SecurePackage *)phCredential->dwUpper;
325 cred = (PCredHandle)phCredential->dwLower;
326 }
327
328 if (package && package->provider)
329 {
330 if (package->provider->fnTableW.InitializeSecurityContextW)
331 {
332 CtxtHandle myCtxt;
333
334 if (phContext)
335 {
336 PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
337 myCtxt.dwUpper = realCtxt->dwUpper;
338 myCtxt.dwLower = realCtxt->dwLower;
339 }
340
341 ret = package->provider->fnTableW.InitializeSecurityContextW(
342 cred, ctxt, pszTargetName, fContextReq,
343 Reserved1, TargetDataRep, pInput, Reserved2, phNewContext ? &myCtxt : NULL,
344 pOutput, pfContextAttr, ptsExpiry);
345 if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) &&
346 phNewContext && phNewContext != phContext)
347 {
348 SECURITY_STATUS ret2;
349 ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
350 if (ret2 != SEC_E_OK)
351 package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
352 }
353 }
354 else
356 }
357 else
359 return ret;
360}

Referenced by do_authorization(), HTTP_DoAuthorization(), netcon_secure_connect_setup(), netconn_secure_connect(), and RPCRT4_default_authorize().

◆ MakeSignature()

SECURITY_STATUS WINAPI MakeSignature ( PCtxtHandle  phContext,
ULONG  fQOP,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo 
)

Definition at line 623 of file wrapper.c.

625{
627
628 TRACE("%p %d %p %d\n", phContext, fQOP, pMessage, MessageSeqNo);
629 if (phContext)
630 {
631 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
632 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
633
634 if (package && package->provider)
635 {
636 if (package->provider->fnTableW.MakeSignature)
637 ret = package->provider->fnTableW.MakeSignature(
638 ctxt, fQOP, pMessage, MessageSeqNo);
639 else
641 }
642 else
644 }
645 else
647 return ret;
648}

Referenced by RPCRT4_default_secure_packet(), and sspi_get_mic().

◆ QueryContextAttributesA()

SECURITY_STATUS WINAPI QueryContextAttributesA ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 505 of file wrapper.c.

507{
509
510 TRACE("%p %d %p\n", phContext, ulAttribute, pBuffer);
511 if (phContext)
512 {
513 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
514 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
515
516 if (package && package->provider)
517 {
518 if (package->provider->fnTableA.QueryContextAttributesA)
519 ret = package->provider->fnTableA.QueryContextAttributesA(
520 ctxt, ulAttribute, pBuffer);
521 else
523 }
524 else
526 }
527 else
529 return ret;
530}
PVOID pBuffer

Referenced by print_negotiated_attrs(), RPCRT4_default_authorize(), sspi_get_mic(), test_authentication(), test_communication(), and testAuth().

◆ QueryContextAttributesW()

SECURITY_STATUS WINAPI QueryContextAttributesW ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 535 of file wrapper.c.

537{
539
540 TRACE("%p %d %p\n", phContext, ulAttribute, pBuffer);
541 if (phContext)
542 {
543 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
544 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
545
546 if (package && package->provider)
547 {
548 if (package->provider->fnTableW.QueryContextAttributesW)
549 ret = package->provider->fnTableW.QueryContextAttributesW(
550 ctxt, ulAttribute, pBuffer);
551 else
553 }
554 else
556 }
557 else
559 return ret;
560}

Referenced by NETCON_GetCert(), NETCON_GetCipherStrength(), netcon_secure_connect_setup(), netconn_get_certificate(), netconn_get_cipher_strength(), and netconn_secure_connect().

◆ QueryCredentialsAttributesA()

SECURITY_STATUS WINAPI QueryCredentialsAttributesA ( PCredHandle  phCredential,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 177 of file wrapper.c.

179{
181
182 TRACE("%p %d %p\n", phCredential, ulAttribute, pBuffer);
183 if (phCredential)
184 {
185 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
186 PCredHandle cred = (PCredHandle)phCredential->dwLower;
187
188 if (package && package->provider)
189 {
190 if (package->provider->fnTableA.QueryCredentialsAttributesA)
191 ret = package->provider->fnTableA.QueryCredentialsAttributesA(
192 cred, ulAttribute, pBuffer);
193 else
195 }
196 else
198 }
199 else
201 return ret;
202}

Referenced by ensure_cred_handle(), test_communication(), test_cread_attrs(), test_strength(), test_supported_algs(), test_supported_protocols(), and testAcquireSecurityContext().

◆ QueryCredentialsAttributesW()

SECURITY_STATUS WINAPI QueryCredentialsAttributesW ( PCredHandle  phCredential,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 207 of file wrapper.c.

209{
211
212 TRACE("%p %d %p\n", phCredential, ulAttribute, pBuffer);
213 if (phCredential)
214 {
215 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
216 PCredHandle cred = (PCredHandle)phCredential->dwLower;
217
218 if (package && package->provider)
219 {
220 if (package->provider->fnTableW.QueryCredentialsAttributesW)
221 ret = package->provider->fnTableW.QueryCredentialsAttributesW(
222 cred, ulAttribute, pBuffer);
223 else
225 }
226 else
228 }
229 else
231 return ret;
232}

◆ QuerySecurityContextToken()

SECURITY_STATUS WINAPI QuerySecurityContextToken ( PCtxtHandle  phContext,
HANDLE phToken 
)

Definition at line 976 of file wrapper.c.

978{
980
981 TRACE("%p %p\n", phContext, phToken);
982 if (phContext)
983 {
984 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
985 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
986
987 if (package && package->provider)
988 {
989 if (package->provider->fnTableW.QuerySecurityContextToken)
990 ret = package->provider->fnTableW.QuerySecurityContextToken(
991 ctxt, phToken);
992 else
994 }
995 else
997 }
998 else
1000 return ret;
1001}
_In_opt_ LPSTR _In_opt_ LPSTR _In_ DWORD _In_ DWORD _Out_opt_ PHANDLE phToken
Definition: winbase.h:2715

◆ QuerySecurityPackageInfoA()

SECURITY_STATUS WINAPI QuerySecurityPackageInfoA ( SEC_CHAR pszPackageName,
PSecPkgInfoA ppPackageInfo 
)

Definition at line 683 of file wrapper.c.

685{
687
688 TRACE("%s %p\n", debugstr_a(pszPackageName), ppPackageInfo);
689 if (pszPackageName)
690 {
691 SecurePackage *package = SECUR32_findPackageA(pszPackageName);
692
693 if (package)
694 {
695 size_t bytesNeeded = sizeof(SecPkgInfoA);
696 int nameLen = 0, commentLen = 0;
697
698 if (package->infoW.Name)
699 {
700 nameLen = WideCharToMultiByte(CP_ACP, 0,
701 package->infoW.Name, -1, NULL, 0, NULL, NULL);
702 bytesNeeded += nameLen;
703 }
704 if (package->infoW.Comment)
705 {
706 commentLen = WideCharToMultiByte(CP_ACP, 0,
707 package->infoW.Comment, -1, NULL, 0, NULL, NULL);
708 bytesNeeded += commentLen;
709 }
710 *ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
711 if (*ppPackageInfo)
712 {
713 PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo +
714 sizeof(SecPkgInfoA));
715
716 memcpy(*ppPackageInfo, &package->infoW, sizeof(package->infoW));
717 if (package->infoW.Name)
718 {
719 (*ppPackageInfo)->Name = nextString;
720 nextString += WideCharToMultiByte(CP_ACP, 0,
721 package->infoW.Name, -1, nextString, nameLen, NULL, NULL);
722 }
723 else
724 (*ppPackageInfo)->Name = NULL;
725 if (package->infoW.Comment)
726 {
727 (*ppPackageInfo)->Comment = nextString;
728 nextString += WideCharToMultiByte(CP_ACP, 0,
729 package->infoW.Comment, -1, nextString, commentLen, NULL,
730 NULL);
731 }
732 else
733 (*ppPackageInfo)->Comment = NULL;
734 ret = SEC_E_OK;
735 }
736 else
738 }
739 else
741 }
742 else
744 return ret;
745}
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define WideCharToMultiByte
Definition: compat.h:111
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BYTE * PBYTE
Definition: pedump.c:66
struct _SecPkgInfoA SecPkgInfoA
char * PSTR
Definition: typedefs.h:51
#define SEC_E_INSUFFICIENT_MEMORY
Definition: winerror.h:2909

Referenced by _makeFnTableA(), setup_client(), setup_server(), START_TEST(), and test_kerberos().

◆ QuerySecurityPackageInfoW()

SECURITY_STATUS WINAPI QuerySecurityPackageInfoW ( SEC_WCHAR pszPackageName,
PSecPkgInfoW ppPackageInfo 
)

Definition at line 750 of file wrapper.c.

752{
754 SecurePackage *package = SECUR32_findPackageW(pszPackageName);
755
756 TRACE("%s %p\n", debugstr_w(pszPackageName), ppPackageInfo);
757 if (package)
758 {
759 size_t bytesNeeded = sizeof(SecPkgInfoW);
760 int nameLen = 0, commentLen = 0;
761
762 if (package->infoW.Name)
763 {
764 nameLen = lstrlenW(package->infoW.Name) + 1;
765 bytesNeeded += nameLen * sizeof(WCHAR);
766 }
767 if (package->infoW.Comment)
768 {
769 commentLen = lstrlenW(package->infoW.Comment) + 1;
770 bytesNeeded += commentLen * sizeof(WCHAR);
771 }
772 *ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
773 if (*ppPackageInfo)
774 {
775 PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo +
776 sizeof(SecPkgInfoW));
777
778 **ppPackageInfo = package->infoW;
779 if (package->infoW.Name)
780 {
781 (*ppPackageInfo)->Name = nextString;
782 lstrcpynW(nextString, package->infoW.Name, nameLen);
783 nextString += nameLen;
784 }
785 else
786 (*ppPackageInfo)->Name = NULL;
787 if (package->infoW.Comment)
788 {
789 (*ppPackageInfo)->Comment = nextString;
790 lstrcpynW(nextString, package->infoW.Comment, commentLen);
791 }
792 else
793 (*ppPackageInfo)->Comment = NULL;
794 ret = SEC_E_OK;
795 }
796 else
798 }
799 else
801 return ret;
802}
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
struct _SecPkgInfoW SecPkgInfoW
SEC_WCHAR * Name
Definition: sspi.h:118
uint16_t * PWSTR
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by _makeFnTableW(), do_authorization(), and HTTP_DoAuthorization().

◆ RevertSecurityContext()

SECURITY_STATUS WINAPI RevertSecurityContext ( PCtxtHandle  phContext)

Definition at line 594 of file wrapper.c.

595{
597
598 TRACE("%p\n", phContext);
599 if (phContext)
600 {
601 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
602 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
603
604 if (package && package->provider)
605 {
606 if (package->provider->fnTableW.RevertSecurityContext)
607 ret = package->provider->fnTableW.RevertSecurityContext(
608 ctxt);
609 else
611 }
612 else
614 }
615 else
617 return ret;
618}

Referenced by RPCRT4_default_revert_to_self().

◆ SECUR32_makeSecHandle()

static SECURITY_STATUS SECUR32_makeSecHandle ( PSecHandle  phSec,
SecurePackage package,
PSecHandle  realHandle 
)
static

Definition at line 30 of file wrapper.c.

32{
34
35 TRACE("%p %p %p\n", phSec, package, realHandle);
36
37 if (phSec && package && realHandle)
38 {
39 PSecHandle newSec = HeapAlloc(GetProcessHeap(), 0, sizeof(SecHandle));
40
41 if (newSec)
42 {
43 *newSec = *realHandle;
44 phSec->dwUpper = (ULONG_PTR)package;
45 phSec->dwLower = (ULONG_PTR)newSec;
46 ret = SEC_E_OK;
47 }
48 else
50 }
51 else
53 return ret;
54}
#define ULONG_PTR
Definition: config.h:101

Referenced by AcceptSecurityContext(), AcquireCredentialsHandleA(), AcquireCredentialsHandleW(), ImportSecurityContextA(), ImportSecurityContextW(), InitializeSecurityContextA(), and InitializeSecurityContextW().

◆ SetContextAttributesA()

SECURITY_STATUS WINAPI SetContextAttributesA ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer,
ULONG  cbBuffer 
)

Definition at line 1066 of file wrapper.c.

1068{
1070
1071 TRACE("%p %d %p %d\n", phContext, ulAttribute, pBuffer, cbBuffer);
1072 if (phContext)
1073 {
1074 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
1075 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
1076
1077 if (package && package->provider)
1078 {
1079 if (package->provider->fnTableA.SetContextAttributesA)
1080 ret = package->provider->fnTableA.SetContextAttributesA(
1081 ctxt, ulAttribute, pBuffer, cbBuffer);
1082 else
1084 }
1085 else
1087 }
1088 else
1090 return ret;
1091}

◆ SetContextAttributesW()

SECURITY_STATUS WINAPI SetContextAttributesW ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer,
ULONG  cbBuffer 
)

Definition at line 1096 of file wrapper.c.

1098{
1100
1101 TRACE("%p %d %p %d\n", phContext, ulAttribute, pBuffer, cbBuffer);
1102 if (phContext)
1103 {
1104 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
1105 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
1106
1107 if (package && package->provider)
1108 {
1109 if (package->provider->fnTableW.SetContextAttributesW)
1110 ret = package->provider->fnTableW.SetContextAttributesW(
1111 ctxt, ulAttribute, pBuffer, cbBuffer);
1112 else
1114 }
1115 else
1117 }
1118 else
1120 return ret;
1121}

◆ VerifySignature()

SECURITY_STATUS WINAPI VerifySignature ( PCtxtHandle  phContext,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo,
PULONG  pfQOP 
)

Definition at line 653 of file wrapper.c.

655{
657
658 TRACE("%p %p %d %p\n", phContext, pMessage, MessageSeqNo, pfQOP);
659 if (phContext)
660 {
661 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
662 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
663
664 if (package && package->provider)
665 {
666 if (package->provider->fnTableW.VerifySignature)
667 ret = package->provider->fnTableW.VerifySignature(
668 ctxt, pMessage, MessageSeqNo, pfQOP);
669 else
671 }
672 else
674 }
675 else
677 return ret;
678}

Referenced by RPCRT4_default_secure_packet(), and sspi_verify_mic().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( secur32  )