24#include <winpr/config.h>
25#include <winpr/platform.h>
28#include <winpr/synch.h>
29#include <winpr/library.h>
30#include <winpr/sspi.h>
37#define TAG WINPR_TAG("sspi.TSSSP")
39#if defined(_WIN32) && !defined(_UWP) && defined(WITH_NATIVE_SSPI)
40#define TSSSP_FORWARD_NATIVE 1
43#if defined(TSSSP_FORWARD_NATIVE)
56static INIT_ONCE g_NativeOnce = INIT_ONCE_STATIC_INIT;
57static HMODULE g_NativeModule =
nullptr;
58static PSecurityFunctionTableW g_NativeW =
nullptr;
59static PSecurityFunctionTableA g_NativeA =
nullptr;
61static BOOL CALLBACK tsssp_native_init(WINPR_ATTR_UNUSED PINIT_ONCE once,
62 WINPR_ATTR_UNUSED PVOID param, WINPR_ATTR_UNUSED PVOID* ctx)
64 g_NativeModule = LoadLibraryW(L
"secur32.dll");
66 g_NativeModule = LoadLibraryW(L
"sspicli.dll");
69 WLog_ERR(TAG,
"failed to load the native SSPI module");
73 INIT_SECURITY_INTERFACE_W pInitW =
74 GetProcAddressAs(g_NativeModule,
"InitSecurityInterfaceW", INIT_SECURITY_INTERFACE_W);
75 INIT_SECURITY_INTERFACE_A pInitA =
76 GetProcAddressAs(g_NativeModule,
"InitSecurityInterfaceA", INIT_SECURITY_INTERFACE_A);
86static PSecurityFunctionTableW tsssp_native_W(
void)
88 (void)InitOnceExecuteOnce(&g_NativeOnce, tsssp_native_init,
nullptr,
nullptr);
92static PSecurityFunctionTableA tsssp_native_A(
void)
94 (void)InitOnceExecuteOnce(&g_NativeOnce, tsssp_native_init,
nullptr,
nullptr);
101static SECURITY_STATUS tsssp_reown_output(PSecurityFunctionTableW nat, PSecBufferDesc pOutput)
103 if (!pOutput || !pOutput->pBuffers)
106 for (ULONG i = 0; i < pOutput->cBuffers; i++)
109 if ((b->BufferType != SECBUFFER_TOKEN) || !b->pvBuffer || (b->cbBuffer == 0))
112 void* copy = sspi_ContextBufferAlloc(InitializeSecurityContextIndex, b->cbBuffer);
114 return SEC_E_INSUFFICIENT_MEMORY;
116 CopyMemory(copy, b->pvBuffer, b->cbBuffer);
117 if (nat && nat->FreeContextBuffer)
118 (void)nat->FreeContextBuffer(b->pvBuffer);
125static SECURITY_STATUS SEC_ENTRY tsssp_AcquireCredentialsHandleW(
126 SEC_WCHAR* pszPrincipal, SEC_WCHAR* pszPackage, ULONG fCredentialUse,
void* pvLogonID,
127 void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument, PCredHandle phCredential,
128 PTimeStamp ptsExpiry)
130 PSecurityFunctionTableW nat = tsssp_native_W();
131 if (!nat || !nat->AcquireCredentialsHandleW)
132 return SEC_E_SECPKG_NOT_FOUND;
134 TSSSP_CREDENTIALS* creds = (TSSSP_CREDENTIALS*)calloc(1,
sizeof(TSSSP_CREDENTIALS));
136 return SEC_E_INSUFFICIENT_MEMORY;
138 const SECURITY_STATUS status = nat->AcquireCredentialsHandleW(
139 pszPrincipal, pszPackage, fCredentialUse, pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument,
140 &creds->native, ptsExpiry);
141 if (status != SEC_E_OK)
147 sspi_SecureHandleSetLowerPointer(phCredential, creds);
148 sspi_SecureHandleSetPackageId(phCredential, SSPI_PACKAGE_TSSSP);
152static SECURITY_STATUS SEC_ENTRY tsssp_AcquireCredentialsHandleA(
153 SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage, ULONG fCredentialUse,
void* pvLogonID,
154 void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument, PCredHandle phCredential,
155 PTimeStamp ptsExpiry)
157 PSecurityFunctionTableA nat = tsssp_native_A();
158 if (!nat || !nat->AcquireCredentialsHandleA)
159 return SEC_E_SECPKG_NOT_FOUND;
161 TSSSP_CREDENTIALS* creds = (TSSSP_CREDENTIALS*)calloc(1,
sizeof(TSSSP_CREDENTIALS));
163 return SEC_E_INSUFFICIENT_MEMORY;
165 const SECURITY_STATUS status = nat->AcquireCredentialsHandleA(
166 pszPrincipal, pszPackage, fCredentialUse, pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument,
167 &creds->native, ptsExpiry);
168 if (status != SEC_E_OK)
174 sspi_SecureHandleSetLowerPointer(phCredential, creds);
175 sspi_SecureHandleSetPackageId(phCredential, SSPI_PACKAGE_TSSSP);
179static SECURITY_STATUS SEC_ENTRY tsssp_FreeCredentialsHandle(PCredHandle phCredential)
182 return SEC_E_INVALID_HANDLE;
184 TSSSP_CREDENTIALS* creds = (TSSSP_CREDENTIALS*)sspi_SecureHandleGetLowerPointer(phCredential);
185 sspi_SecureHandleInvalidate(phCredential);
187 return SEC_E_INVALID_HANDLE;
189 PSecurityFunctionTableW nat = tsssp_native_W();
190 SECURITY_STATUS status = SEC_E_OK;
191 if (nat && nat->FreeCredentialsHandle)
192 status = nat->FreeCredentialsHandle(&creds->native);
198static SECURITY_STATUS tsssp_initialize_context(
199 BOOL unicode, PCredHandle phCredential, PCtxtHandle phContext,
void* pszTargetName,
200 ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2,
201 PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
203 PSecurityFunctionTableW natW = tsssp_native_W();
204 PSecurityFunctionTableA natA = tsssp_native_A();
205 if (unicode && (!natW || !natW->InitializeSecurityContextW))
206 return SEC_E_SECPKG_NOT_FOUND;
207 if (!unicode && (!natA || !natA->InitializeSecurityContextA))
208 return SEC_E_SECPKG_NOT_FOUND;
210 TSSSP_CREDENTIALS* creds = (TSSSP_CREDENTIALS*)sspi_SecureHandleGetLowerPointer(phCredential);
212 return SEC_E_INVALID_HANDLE;
214 TSSSP_CONTEXT* context =
215 phContext ? (TSSSP_CONTEXT*)sspi_SecureHandleGetLowerPointer(phContext) : nullptr;
216 const BOOL fresh = (context ==
nullptr);
219 context = (TSSSP_CONTEXT*)calloc(1,
sizeof(TSSSP_CONTEXT));
221 return SEC_E_INSUFFICIENT_MEMORY;
224 PCtxtHandle inNative = fresh ? nullptr : &context->native;
226 SECURITY_STATUS status = 0;
228 status = natW->InitializeSecurityContextW(
229 &creds->native, inNative, (SEC_WCHAR*)pszTargetName, fContextReq, Reserved1,
230 TargetDataRep, pInput, Reserved2, &context->native, pOutput, pfContextAttr, ptsExpiry);
232 status = natA->InitializeSecurityContextA(
233 &creds->native, inNative, (SEC_CHAR*)pszTargetName, fContextReq, Reserved1,
234 TargetDataRep, pInput, Reserved2, &context->native, pOutput, pfContextAttr, ptsExpiry);
236 if ((status != SEC_E_OK) && (status != SEC_I_CONTINUE_NEEDED) &&
237 (status != SEC_I_COMPLETE_NEEDED) && (status != SEC_I_COMPLETE_AND_CONTINUE))
244 const SECURITY_STATUS reown = tsssp_reown_output(natW, pOutput);
245 if (reown != SEC_E_OK)
249 if (natW && natW->DeleteSecurityContext)
250 (void)natW->DeleteSecurityContext(&context->native);
256 sspi_SecureHandleSetLowerPointer(phNewContext, context);
257 sspi_SecureHandleSetPackageId(phNewContext, SSPI_PACKAGE_TSSSP);
261static SECURITY_STATUS SEC_ENTRY tsssp_InitializeSecurityContextW(
262 PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR* pszTargetName, ULONG fContextReq,
263 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2,
264 PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
266 return tsssp_initialize_context(TRUE, phCredential, phContext, pszTargetName, fContextReq,
267 Reserved1, TargetDataRep, pInput, Reserved2, phNewContext,
268 pOutput, pfContextAttr, ptsExpiry);
271static SECURITY_STATUS SEC_ENTRY tsssp_InitializeSecurityContextA(
272 PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR* pszTargetName, ULONG fContextReq,
273 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2,
274 PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
276 return tsssp_initialize_context(FALSE, phCredential, phContext, pszTargetName, fContextReq,
277 Reserved1, TargetDataRep, pInput, Reserved2, phNewContext,
278 pOutput, pfContextAttr, ptsExpiry);
281static SECURITY_STATUS tsssp_query_context(BOOL unicode, PCtxtHandle phContext, ULONG ulAttribute,
285 return SEC_E_INVALID_HANDLE;
287 TSSSP_CONTEXT* context = (TSSSP_CONTEXT*)sspi_SecureHandleGetLowerPointer(phContext);
289 return SEC_E_INVALID_HANDLE;
291 if (ulAttribute == SECPKG_ATTR_WINPR_TSPKG_CONTEXT)
294 return SEC_E_INSUFFICIENT_MEMORY;
297 *((UINT64*)pBuffer) = (UINT64)context->native.dwUpper;
301 PSecurityFunctionTableW natW = tsssp_native_W();
302 PSecurityFunctionTableA natA = tsssp_native_A();
303 if (unicode && natW && natW->QueryContextAttributesW)
304 return natW->QueryContextAttributesW(&context->native, ulAttribute, pBuffer);
305 if (!unicode && natA && natA->QueryContextAttributesA)
306 return natA->QueryContextAttributesA(&context->native, ulAttribute, pBuffer);
307 return SEC_E_UNSUPPORTED_FUNCTION;
310static SECURITY_STATUS SEC_ENTRY tsssp_QueryContextAttributesW(PCtxtHandle phContext,
311 ULONG ulAttribute,
void* pBuffer)
313 return tsssp_query_context(TRUE, phContext, ulAttribute, pBuffer);
316static SECURITY_STATUS SEC_ENTRY tsssp_QueryContextAttributesA(PCtxtHandle phContext,
317 ULONG ulAttribute,
void* pBuffer)
319 return tsssp_query_context(FALSE, phContext, ulAttribute, pBuffer);
322static SECURITY_STATUS SEC_ENTRY tsssp_DeleteSecurityContext(PCtxtHandle phContext)
325 return SEC_E_INVALID_HANDLE;
327 TSSSP_CONTEXT* context = (TSSSP_CONTEXT*)sspi_SecureHandleGetLowerPointer(phContext);
328 sspi_SecureHandleInvalidate(phContext);
330 return SEC_E_INVALID_HANDLE;
332 PSecurityFunctionTableW nat = tsssp_native_W();
333 SECURITY_STATUS status = SEC_E_OK;
334 if (nat && nat->DeleteSecurityContext)
335 status = nat->DeleteSecurityContext(&context->native);
341static SECURITY_STATUS SEC_ENTRY tsssp_SetContextAttributesW(PCtxtHandle phContext,
342 ULONG ulAttribute,
void* pBuffer,
345 TSSSP_CONTEXT* context = (TSSSP_CONTEXT*)sspi_SecureHandleGetLowerPointer(phContext);
347 return SEC_E_INVALID_HANDLE;
349 PSecurityFunctionTableW natW = tsssp_native_W();
350 if (natW && natW->SetContextAttributesW)
351 return natW->SetContextAttributesW(&context->native, ulAttribute, pBuffer, cbBuffer);
352 return SEC_E_UNSUPPORTED_FUNCTION;
357#include <winpr/credssp.h>
359#include "../../sspicli/lsa_proto.h"
360#include "../../sspicli/lsa_transport.h"
377static SECURITY_STATUS SEC_ENTRY tsssp_AcquireCredentialsHandleW(
378 WINPR_ATTR_UNUSED SEC_WCHAR* pszPrincipal, WINPR_ATTR_UNUSED SEC_WCHAR* pszPackage,
379 ULONG fCredentialUse, WINPR_ATTR_UNUSED
void* pvLogonID,
void* pAuthData,
380 WINPR_ATTR_UNUSED SEC_GET_KEY_FN pGetKeyFn, WINPR_ATTR_UNUSED
void* pvGetKeyArgument,
381 PCredHandle phCredential, WINPR_ATTR_UNUSED PTimeStamp ptsExpiry)
383 if (fCredentialUse != SECPKG_CRED_OUTBOUND)
384 return SEC_E_UNSUPPORTED_FUNCTION;
386 const int fd = lsa4posix_client_connect();
389 WLog_ERR(TAG,
"the lsa4posix daemon is not available");
390 return SEC_E_NO_CREDENTIALS;
398 flags = credEx->Flags;
402 const UINT32 reqId = 1;
403 LSA_MSG_HDR hdr = { SSPI_MSG_ACQUIRE_CRED, 0, reqId };
406 BOOL built = lsa_proto_writer_init(&w, &hdr) && lsa_proto_write_u32(&w, flags) &&
407 lsa_proto_write_u16(&w, identity ? 1 : 0);
408 if (built && identity)
409 built = lsa_proto_write_blob(&w, (
const BYTE*)identity->User,
410 identity->UserLength *
sizeof(WCHAR)) &&
411 lsa_proto_write_blob(&w, (
const BYTE*)identity->Domain,
412 identity->DomainLength *
sizeof(WCHAR)) &&
413 lsa_proto_write_blob(&w, (
const BYTE*)identity->Password,
414 identity->PasswordLength *
sizeof(WCHAR));
415 if (!built || !lsa_proto_writer_finish(&w, &request))
417 lsa_proto_writer_abort(&w);
418 lsa4posix_client_close(fd);
419 return SEC_E_INTERNAL_ERROR;
425 if (lsa4posix_transact(fd, SSPI_MSG_ACQUIRE_CRED, request, reqId, &r, &rh, &response) !=
428 lsa4posix_client_close(fd);
429 return SEC_E_NO_CREDENTIALS;
434 const BOOL ok = lsa_proto_read_u32(&r, &status) && lsa_proto_read_u64(&r, &credId);
435 lsa_proto_reader_done(&r);
436 Stream_Free(response, TRUE);
437 if (!ok || (status != SEC_E_OK))
439 lsa4posix_client_close(fd);
440 return ok ? (SECURITY_STATUS)status : SEC_E_INTERNAL_ERROR;
443 TSSSP_PROXY_CRED* creds = (TSSSP_PROXY_CRED*)calloc(1,
sizeof(TSSSP_PROXY_CRED));
446 lsa4posix_client_close(fd);
447 return SEC_E_INSUFFICIENT_MEMORY;
450 creds->credId = credId;
452 sspi_SecureHandleSetLowerPointer(phCredential, creds);
453 sspi_SecureHandleSetPackageId(phCredential, SSPI_PACKAGE_TSSSP);
457static SECURITY_STATUS SEC_ENTRY tsssp_AcquireCredentialsHandleA(
458 WINPR_ATTR_UNUSED SEC_CHAR* pszPrincipal, WINPR_ATTR_UNUSED SEC_CHAR* pszPackage,
459 WINPR_ATTR_UNUSED ULONG fCredentialUse, WINPR_ATTR_UNUSED
void* pvLogonID,
460 WINPR_ATTR_UNUSED
void* pAuthData, WINPR_ATTR_UNUSED SEC_GET_KEY_FN pGetKeyFn,
461 WINPR_ATTR_UNUSED
void* pvGetKeyArgument, WINPR_ATTR_UNUSED PCredHandle phCredential,
462 WINPR_ATTR_UNUSED PTimeStamp ptsExpiry)
464 return SEC_E_UNSUPPORTED_FUNCTION;
467static SECURITY_STATUS SEC_ENTRY tsssp_FreeCredentialsHandle(PCredHandle phCredential)
470 return SEC_E_INVALID_HANDLE;
471 TSSSP_PROXY_CRED* creds = (TSSSP_PROXY_CRED*)sspi_SecureHandleGetLowerPointer(phCredential);
472 sspi_SecureHandleInvalidate(phCredential);
474 return SEC_E_INVALID_HANDLE;
476 LSA_MSG_HDR hdr = { SSPI_MSG_FREE_CRED, 0, creds->reqId++ };
479 if (lsa_proto_writer_init(&w, &hdr) && lsa_proto_write_u64(&w, creds->credId) &&
480 lsa_proto_writer_finish(&w, &request))
485 if (lsa4posix_transact(creds->fd, SSPI_MSG_FREE_CRED, request, hdr.requestId, &r, &rh,
486 &response) == STATUS_SUCCESS)
488 lsa_proto_reader_done(&r);
489 Stream_Free(response, TRUE);
493 lsa_proto_writer_abort(&w);
495 lsa4posix_client_close(creds->fd);
500static SECURITY_STATUS SEC_ENTRY tsssp_InitializeSecurityContextW(
501 PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR* pszTargetName, ULONG fContextReq,
502 WINPR_ATTR_UNUSED ULONG Reserved1, WINPR_ATTR_UNUSED ULONG TargetDataRep, PSecBufferDesc pInput,
503 WINPR_ATTR_UNUSED ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
504 WINPR_ATTR_UNUSED PULONG pfContextAttr, WINPR_ATTR_UNUSED PTimeStamp ptsExpiry)
506 TSSSP_PROXY_CRED* creds = (TSSSP_PROXY_CRED*)sspi_SecureHandleGetLowerPointer(phCredential);
508 return SEC_E_INVALID_HANDLE;
510 TSSSP_PROXY_CTX* context =
511 phContext ? (TSSSP_PROXY_CTX*)sspi_SecureHandleGetLowerPointer(phContext) : nullptr;
512 const UINT64 ctxId = context ? context->ctxId : 0;
518 for (ULONG i = 0; i < pInput->cBuffers; i++)
520 const SecBuffer* b = &pInput->pBuffers[i];
521 if ((b->BufferType & ~SECBUFFER_ATTRMASK) != SECBUFFER_TOKEN)
523 if (b->BufferType & SECBUFFER_READONLY)
525 else if (b->cbBuffer > 0)
531 const UINT32 targetLen = pszTargetName ? (UINT32)(_wcslen(pszTargetName) *
sizeof(WCHAR)) : 0;
533 const UINT32 reqId = creds->reqId++;
537 if (!lsa_proto_writer_init(&w, &hdr) || !lsa_proto_write_u64(&w, creds->credId) ||
538 !lsa_proto_write_u64(&w, ctxId) || !lsa_proto_write_u32(&w, fContextReq) ||
539 !lsa_proto_write_blob(&w, (
const BYTE*)pszTargetName, targetLen) ||
540 !lsa_proto_write_blob(&w, inToken ? (
const BYTE*)inToken->pvBuffer :
nullptr,
541 inToken ? inToken->cbBuffer : 0) ||
542 !lsa_proto_write_blob(&w, publicKey ? (
const BYTE*)publicKey->pvBuffer :
nullptr,
543 publicKey ? publicKey->cbBuffer : 0) ||
544 !lsa_proto_writer_finish(&w, &request))
546 lsa_proto_writer_abort(&w);
547 return SEC_E_INTERNAL_ERROR;
553 if (lsa4posix_transact(creds->fd, SSPI_MSG_ISC, request, reqId, &r, &rh, &response) !=
555 return SEC_E_INTERNAL_ERROR;
559 BYTE* outToken =
nullptr;
561 const BOOL ok = lsa_proto_read_u32(&r, &status) && lsa_proto_read_u64(&r, &newCtxId) &&
562 lsa_proto_read_blob(&r, &outToken, &outLen);
563 lsa_proto_reader_done(&r);
564 Stream_Free(response, TRUE);
568 return SEC_E_INTERNAL_ERROR;
571 const SECURITY_STATUS sstatus = (SECURITY_STATUS)status;
572 if ((sstatus == SEC_E_OK) || (sstatus == SEC_I_CONTINUE_NEEDED))
576 context = (TSSSP_PROXY_CTX*)calloc(1,
sizeof(TSSSP_PROXY_CTX));
580 return SEC_E_INSUFFICIENT_MEMORY;
582 context->fd = creds->fd;
585 context->ctxId = newCtxId;
586 sspi_SecureHandleSetLowerPointer(phNewContext, context);
587 sspi_SecureHandleSetPackageId(phNewContext, SSPI_PACKAGE_TSSSP);
589 if (pOutput && (pOutput->cBuffers >= 1))
592 out->BufferType = SECBUFFER_TOKEN;
593 out->pvBuffer =
nullptr;
597 void* buf = sspi_ContextBufferAlloc(InitializeSecurityContextIndex, outLen);
601 return SEC_E_INSUFFICIENT_MEMORY;
603 CopyMemory(buf, outToken, outLen);
605 out->cbBuffer = outLen;
614static SECURITY_STATUS SEC_ENTRY tsssp_InitializeSecurityContextA(
615 WINPR_ATTR_UNUSED PCredHandle phCredential, WINPR_ATTR_UNUSED PCtxtHandle phContext,
616 WINPR_ATTR_UNUSED SEC_CHAR* pszTargetName, WINPR_ATTR_UNUSED ULONG fContextReq,
617 WINPR_ATTR_UNUSED ULONG Reserved1, WINPR_ATTR_UNUSED ULONG TargetDataRep,
618 WINPR_ATTR_UNUSED PSecBufferDesc pInput, WINPR_ATTR_UNUSED ULONG Reserved2,
619 WINPR_ATTR_UNUSED PCtxtHandle phNewContext, WINPR_ATTR_UNUSED PSecBufferDesc pOutput,
620 WINPR_ATTR_UNUSED PULONG pfContextAttr, WINPR_ATTR_UNUSED PTimeStamp ptsExpiry)
622 return SEC_E_UNSUPPORTED_FUNCTION;
625static SECURITY_STATUS SEC_ENTRY tsssp_QueryContextAttributesW(PCtxtHandle phContext,
626 ULONG ulAttribute,
void* pBuffer)
628 TSSSP_PROXY_CTX* context = (TSSSP_PROXY_CTX*)sspi_SecureHandleGetLowerPointer(phContext);
630 return SEC_E_INVALID_HANDLE;
632 if (ulAttribute == SECPKG_ATTR_WINPR_TSPKG_CONTEXT)
635 return SEC_E_INSUFFICIENT_MEMORY;
636 *((UINT64*)pBuffer) = context->ctxId;
639 return SEC_E_UNSUPPORTED_FUNCTION;
642static SECURITY_STATUS SEC_ENTRY
643tsssp_QueryContextAttributesA(WINPR_ATTR_UNUSED PCtxtHandle phContext,
644 WINPR_ATTR_UNUSED ULONG ulAttribute, WINPR_ATTR_UNUSED
void* pBuffer)
646 return SEC_E_UNSUPPORTED_FUNCTION;
649static SECURITY_STATUS SEC_ENTRY tsssp_DeleteSecurityContext(PCtxtHandle phContext)
652 return SEC_E_INVALID_HANDLE;
653 TSSSP_PROXY_CTX* context = (TSSSP_PROXY_CTX*)sspi_SecureHandleGetLowerPointer(phContext);
654 sspi_SecureHandleInvalidate(phContext);
656 return SEC_E_INVALID_HANDLE;
658 LSA_MSG_HDR hdr = { SSPI_MSG_DELETE_CTX, 0, context->reqId++ };
661 if (lsa_proto_writer_init(&w, &hdr) && lsa_proto_write_u64(&w, context->ctxId) &&
662 lsa_proto_writer_finish(&w, &request))
667 if (lsa4posix_transact(context->fd, SSPI_MSG_DELETE_CTX, request, hdr.requestId, &r, &rh,
668 &response) == STATUS_SUCCESS)
670 lsa_proto_reader_done(&r);
671 Stream_Free(response, TRUE);
675 lsa_proto_writer_abort(&w);
681static SECURITY_STATUS SEC_ENTRY tsssp_SetContextAttributesW(PCtxtHandle phContext,
682 ULONG ulAttribute,
void* pBuffer,
685 WINPR_UNUSED(phContext);
686 WINPR_UNUSED(ulAttribute);
687 WINPR_UNUSED(pBuffer);
688 WINPR_UNUSED(cbBuffer);
689 return SEC_E_UNSUPPORTED_FUNCTION;
698 tsssp_AcquireCredentialsHandleA,
699 tsssp_FreeCredentialsHandle,
701 tsssp_InitializeSecurityContextA,
704 tsssp_DeleteSecurityContext,
706 tsssp_QueryContextAttributesA,
722 tsssp_SetContextAttributesW,
730 tsssp_AcquireCredentialsHandleW,
731 tsssp_FreeCredentialsHandle,
733 tsssp_InitializeSecurityContextW,
736 tsssp_DeleteSecurityContext,
738 tsssp_QueryContextAttributesW,
754 tsssp_SetContextAttributesW,
764 "WinPR TSSSP (Remote Credential Guard)"
767static WCHAR TSSSP_SecPkgInfoW_NameBuffer[128] = WINPR_C_ARRAY_INIT;
768static WCHAR TSSSP_SecPkgInfoW_CommentBuffer[128] = WINPR_C_ARRAY_INIT;
775 TSSSP_SecPkgInfoW_NameBuffer,
776 TSSSP_SecPkgInfoW_CommentBuffer
781 InitializeConstWCharFromUtf8(TSSSP_SecPkgInfoA.Name, TSSSP_SecPkgInfoW_NameBuffer,
782 ARRAYSIZE(TSSSP_SecPkgInfoW_NameBuffer));
783 InitializeConstWCharFromUtf8(TSSSP_SecPkgInfoA.Comment, TSSSP_SecPkgInfoW_CommentBuffer,
784 ARRAYSIZE(TSSSP_SecPkgInfoW_CommentBuffer));