libwinpr-sspi: make native sspi option dynamic

This commit is contained in:
Marc-André Moreau 2014-06-06 15:34:12 -04:00
parent 907a29d0ba
commit 940e6fbc15
5 changed files with 493 additions and 66 deletions

View File

@ -85,11 +85,7 @@
#define WITH_DEBUG_CREDSSP
#endif
#ifdef WITH_NATIVE_SSPI
#define NLA_PKG_NAME NTLMSP_NAME
#else
#define NLA_PKG_NAME NTLMSP_NAME
#endif
#define TERMSRV_SPN_PREFIX "TERMSRV/"
@ -267,24 +263,7 @@ int credssp_client_authenticate(rdpCredssp* credssp)
if (credssp_ntlm_client_init(credssp) == 0)
return 0;
#ifdef WITH_NATIVE_SSPI
{
HMODULE hSSPI;
INIT_SECURITY_INTERFACE InitSecurityInterface;
PSecurityFunctionTable pSecurityInterface = NULL;
hSSPI = LoadLibrary(_T("secur32.dll"));
#ifdef UNICODE
InitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress(hSSPI, "InitSecurityInterfaceW");
#else
InitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress(hSSPI, "InitSecurityInterfaceA");
#endif
credssp->table = (*InitSecurityInterface)();
}
#else
credssp->table = InitSecurityInterface();
#endif
status = credssp->table->QuerySecurityPackageInfo(NLA_PKG_NAME, &pPackageInfo);
@ -469,11 +448,6 @@ int credssp_server_authenticate(rdpCredssp* credssp)
if (credssp_ntlm_server_init(credssp) == 0)
return 0;
#ifdef WITH_NATIVE_SSPI
if (!credssp->SspiModule)
credssp->SspiModule = _tcsdup(_T("secur32.dll"));
#endif
if (credssp->SspiModule)
{
HMODULE hSSPI;
@ -495,12 +469,10 @@ int credssp_server_authenticate(rdpCredssp* credssp)
credssp->table = (*pInitSecurityInterface)();
}
#ifndef WITH_NATIVE_SSPI
else
{
credssp->table = InitSecurityInterface();
}
#endif
status = credssp->table->QuerySecurityPackageInfo(NLA_PKG_NAME, &pPackageInfo);

View File

@ -21,40 +21,149 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/library.h>
#include "sspi.h"
#ifndef _WIN32
static BOOL g_Initialized = FALSE;
static HMODULE g_SspiModule = NULL;
static SecurityFunctionTableW* g_SspiW = NULL;
static SecurityFunctionTableA* g_SspiA = NULL;
SecurityFunctionTableA sspi_SecurityFunctionTableA;
SecurityFunctionTableW sspi_SecurityFunctionTableW;
BOOL InitializeSspiModule_Native(void)
{
#ifdef _WIN32
INIT_SECURITY_INTERFACE_W pInitSecurityInterfaceW;
INIT_SECURITY_INTERFACE_A pInitSecurityInterfaceA;
g_SspiModule = LoadLibraryA("secur32.dll");
if (!g_SspiModule)
g_SspiModule = LoadLibraryA("security.dll");
if (!g_SspiModule)
return FALSE;
pInitSecurityInterfaceW = (INIT_SECURITY_INTERFACE_W) GetProcAddress(g_SspiModule, "InitSecurityInterfaceW");
pInitSecurityInterfaceA = (INIT_SECURITY_INTERFACE_A) GetProcAddress(g_SspiModule, "InitSecurityInterfaceA");
if (pInitSecurityInterfaceW)
g_SspiW = pInitSecurityInterfaceW();
if (pInitSecurityInterfaceA)
g_SspiA = pInitSecurityInterfaceA();
return TRUE;
#else
return FALSE;
#endif
}
void InitializeSspiModule(void)
{
if (g_Initialized)
return;
g_Initialized = TRUE;
if (!InitializeSspiModule_Native())
{
printf("WINPR SSPI!\n");
g_SspiW = winpr_InitSecurityInterfaceW();
g_SspiA = winpr_InitSecurityInterfaceA();
}
else
{
printf("NATIVE SSPI!\n");
}
}
/**
* Standard SSPI API
*/
/* Package Management */
SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(ULONG* pcPackages, PSecPkgInfoW* ppPackageInfo)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->EnumerateSecurityPackagesW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->EnumerateSecurityPackagesW(pcPackages, ppPackageInfo);
return status;
}
SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(ULONG* pcPackages, PSecPkgInfoA* ppPackageInfo)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->EnumerateSecurityPackagesA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->EnumerateSecurityPackagesA(pcPackages, ppPackageInfo);
return status;
}
SecurityFunctionTableW* SEC_ENTRY InitSecurityInterfaceW(void)
{
return &winpr_SecurityFunctionTableW;
if (!g_Initialized)
InitializeSspiModule();
return &sspi_SecurityFunctionTableW;
}
SecurityFunctionTableA* SEC_ENTRY InitSecurityInterfaceA(void)
{
return &winpr_SecurityFunctionTableA;
if (!g_Initialized)
InitializeSspiModule();
return &sspi_SecurityFunctionTableA;
}
SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageName, PSecPkgInfoW* ppPackageInfo)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->QuerySecurityPackageInfoW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo);
return status;
}
SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(SEC_CHAR* pszPackageName, PSecPkgInfoA* ppPackageInfo)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->QuerySecurityPackageInfoA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->QuerySecurityPackageInfoA(pszPackageName, ppPackageInfo);
return status;
}
/* Credential Management */
@ -63,44 +172,126 @@ SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(SEC_WCHAR* pszPrincipal, SEC
ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->AcquireCredentialsHandleW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->AcquireCredentialsHandleW(pszPrincipal, pszPackage, fCredentialUse,
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry);
return status;
}
SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage,
ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->AcquireCredentialsHandleA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->AcquireCredentialsHandleA(pszPrincipal, pszPackage, fCredentialUse,
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry);
return status;
}
SECURITY_STATUS SEC_ENTRY ExportSecurityContext(PCtxtHandle phContext, ULONG fFlags, PSecBuffer pPackedContext, HANDLE* pToken)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->ExportSecurityContext))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->ExportSecurityContext(phContext, fFlags, pPackedContext, pToken);
return status;
}
SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(PCredHandle phCredential)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->FreeCredentialsHandle))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->FreeCredentialsHandle(phCredential);
return status;
}
SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR* pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->ImportSecurityContextW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->ImportSecurityContextW(pszPackage, pPackedContext, pToken, phContext);
return status;
}
SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR* pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->ImportSecurityContextA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->ImportSecurityContextA(pszPackage, pPackedContext, pToken, phContext);
return status;
}
SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->QueryCredentialsAttributesW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->QueryCredentialsAttributesW(phCredential, ulAttribute, pBuffer);
return status;
}
SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->QueryCredentialsAttributesA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->QueryCredentialsAttributesA(phCredential, ulAttribute, pBuffer);
return status;
}
/* Context Management */
@ -109,32 +300,93 @@ SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(PCredHandle phCredential, PCtxtH
PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->AcceptSecurityContext))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->AcceptSecurityContext(phCredential, phContext, pInput, fContextReq,
TargetDataRep, phNewContext, pOutput, pfContextAttr, ptsTimeStamp);
return status;
}
SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext, PSecBufferDesc pInput)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->ApplyControlToken))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->ApplyControlToken(phContext, pInput);
return status;
}
SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext, PSecBufferDesc pToken)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->CompleteAuthToken))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->CompleteAuthToken(phContext, pToken);
return status;
}
SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->DeleteSecurityContext))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->DeleteSecurityContext(phContext);
return status;
}
SECURITY_STATUS SEC_ENTRY FreeContextBuffer(void* pvContextBuffer)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->FreeContextBuffer))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->FreeContextBuffer(pvContextBuffer);
return status;
}
SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(PCtxtHandle phContext)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->ImpersonateSecurityContext))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->ImpersonateSecurityContext(phContext);
return status;
}
SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext,
@ -142,7 +394,19 @@ SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(PCredHandle phCredential, P
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->InitializeSecurityContextW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->InitializeSecurityContextW(phCredential, phContext,
pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
return status;
}
SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext,
@ -150,54 +414,233 @@ SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(PCredHandle phCredential, P
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->InitializeSecurityContextA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->InitializeSecurityContextA(phCredential, phContext,
pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
return status;
}
SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->QueryContextAttributesW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->QueryContextAttributesW(phContext, ulAttribute, pBuffer);
return status;
}
SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->QueryContextAttributesA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->QueryContextAttributesA(phContext, ulAttribute, pBuffer);
return status;
}
SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(PCtxtHandle phContext, HANDLE* phToken)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->QuerySecurityContextToken))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->QuerySecurityContextToken(phContext, phToken);
return status;
}
SECURITY_STATUS SEC_ENTRY SetContextAttributes(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
SECURITY_STATUS SEC_ENTRY SetContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->SetContextAttributesW))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->SetContextAttributesW(phContext, ulAttribute, pBuffer, cbBuffer);
return status;
}
SECURITY_STATUS SEC_ENTRY SetContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
{
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiA && g_SspiA->SetContextAttributesA))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiA->SetContextAttributesA(phContext, ulAttribute, pBuffer, cbBuffer);
return status;
}
SECURITY_STATUS SEC_ENTRY RevertSecurityContext(PCtxtHandle phContext)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->RevertSecurityContext))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->RevertSecurityContext(phContext);
return status;
}
/* Message Support */
SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->DecryptMessage))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP);
return status;
}
SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->EncryptMessage))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);
return status;
}
SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->MakeSignature))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->MakeSignature(phContext, fQOP, pMessage, MessageSeqNo);
return status;
}
SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
{
return SEC_E_OK;
SECURITY_STATUS status;
if (!g_Initialized)
InitializeSspiModule();
if (!(g_SspiW && g_SspiW->VerifySignature))
return SEC_E_UNSUPPORTED_FUNCTION;
status = g_SspiW->VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP);
return status;
}
#endif
SecurityFunctionTableA sspi_SecurityFunctionTableA =
{
1, /* dwVersion */
EnumerateSecurityPackagesA, /* EnumerateSecurityPackages */
QueryCredentialsAttributesA, /* QueryCredentialsAttributes */
AcquireCredentialsHandleA, /* AcquireCredentialsHandle */
FreeCredentialsHandle, /* FreeCredentialsHandle */
NULL, /* Reserved2 */
InitializeSecurityContextA, /* InitializeSecurityContext */
AcceptSecurityContext, /* AcceptSecurityContext */
CompleteAuthToken, /* CompleteAuthToken */
DeleteSecurityContext, /* DeleteSecurityContext */
ApplyControlToken, /* ApplyControlToken */
QueryContextAttributesA, /* QueryContextAttributes */
ImpersonateSecurityContext, /* ImpersonateSecurityContext */
RevertSecurityContext, /* RevertSecurityContext */
MakeSignature, /* MakeSignature */
VerifySignature, /* VerifySignature */
FreeContextBuffer, /* FreeContextBuffer */
QuerySecurityPackageInfoA, /* QuerySecurityPackageInfo */
NULL, /* Reserved3 */
NULL, /* Reserved4 */
ExportSecurityContext, /* ExportSecurityContext */
ImportSecurityContextA, /* ImportSecurityContext */
NULL, /* AddCredentials */
NULL, /* Reserved8 */
QuerySecurityContextToken, /* QuerySecurityContextToken */
EncryptMessage, /* EncryptMessage */
DecryptMessage, /* DecryptMessage */
SetContextAttributesA, /* SetContextAttributes */
};
SecurityFunctionTableW sspi_SecurityFunctionTableW =
{
1, /* dwVersion */
EnumerateSecurityPackagesW, /* EnumerateSecurityPackages */
QueryCredentialsAttributesW, /* QueryCredentialsAttributes */
AcquireCredentialsHandleW, /* AcquireCredentialsHandle */
FreeCredentialsHandle, /* FreeCredentialsHandle */
NULL, /* Reserved2 */
InitializeSecurityContextW, /* InitializeSecurityContext */
AcceptSecurityContext, /* AcceptSecurityContext */
CompleteAuthToken, /* CompleteAuthToken */
DeleteSecurityContext, /* DeleteSecurityContext */
ApplyControlToken, /* ApplyControlToken */
QueryContextAttributesW, /* QueryContextAttributes */
ImpersonateSecurityContext, /* ImpersonateSecurityContext */
RevertSecurityContext, /* RevertSecurityContext */
MakeSignature, /* MakeSignature */
VerifySignature, /* VerifySignature */
FreeContextBuffer, /* FreeContextBuffer */
QuerySecurityPackageInfoW, /* QuerySecurityPackageInfo */
NULL, /* Reserved3 */
NULL, /* Reserved4 */
ExportSecurityContext, /* ExportSecurityContext */
ImportSecurityContextW, /* ImportSecurityContext */
NULL, /* AddCredentials */
NULL, /* Reserved8 */
QuerySecurityContextToken, /* QuerySecurityContextToken */
EncryptMessage, /* EncryptMessage */
DecryptMessage, /* DecryptMessage */
SetContextAttributesW, /* SetContextAttributes */
};

View File

@ -81,4 +81,6 @@ enum SecurityFunctionTableIndex
SetContextAttributesIndex = 28
};
#include "sspi_winpr.h"
#endif /* WINPR_SSPI_PRIVATE_H */

View File

@ -507,6 +507,10 @@ void sspi_ContextBufferFree(void* contextBuffer)
}
}
/**
* Standard SSPI API
*/
/* Package Management */
SECURITY_STATUS SEC_ENTRY winpr_EnumerateSecurityPackagesW(ULONG* pcPackages, PSecPkgInfoW* ppPackageInfo)
@ -992,7 +996,12 @@ SECURITY_STATUS SEC_ENTRY winpr_QuerySecurityContextToken(PCtxtHandle phContext,
return SEC_E_OK;
}
SECURITY_STATUS SEC_ENTRY winpr_SetContextAttributes(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
SECURITY_STATUS SEC_ENTRY winpr_SetContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
{
return SEC_E_OK;
}
SECURITY_STATUS SEC_ENTRY winpr_SetContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
{
return SEC_E_OK;
}
@ -1129,7 +1138,7 @@ SecurityFunctionTableA winpr_SecurityFunctionTableA =
winpr_QuerySecurityContextToken, /* QuerySecurityContextToken */
winpr_EncryptMessage, /* EncryptMessage */
winpr_DecryptMessage, /* DecryptMessage */
winpr_SetContextAttributes, /* SetContextAttributes */
winpr_SetContextAttributesA, /* SetContextAttributes */
};
SecurityFunctionTableW winpr_SecurityFunctionTableW =
@ -1161,5 +1170,5 @@ SecurityFunctionTableW winpr_SecurityFunctionTableW =
winpr_QuerySecurityContextToken, /* QuerySecurityContextToken */
winpr_EncryptMessage, /* EncryptMessage */
winpr_DecryptMessage, /* DecryptMessage */
winpr_SetContextAttributes, /* SetContextAttributes */
winpr_SetContextAttributesW, /* SetContextAttributes */
};

View File

@ -22,6 +22,7 @@
#include <winpr/sspi.h>
SecurityFunctionTableW* SEC_ENTRY winpr_InitSecurityInterfaceW(void);
SecurityFunctionTableA* SEC_ENTRY winpr_InitSecurityInterfaceA(void);
#endif /* WINPR_SSPI_WINPR_H */