2004-03-02 05:57:35 +01:00
|
|
|
/* Copyright (C) 2004 Juan Lang
|
|
|
|
*
|
|
|
|
* Implements secur32 functions that forward to (wrap) an SSP's implementation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-03-02 05:57:35 +01:00
|
|
|
*/
|
2021-05-07 11:54:42 +02:00
|
|
|
|
2004-03-02 05:57:35 +01:00
|
|
|
#include <stdarg.h>
|
2021-05-07 11:54:44 +02:00
|
|
|
#include <stdlib.h>
|
2004-03-02 05:57:35 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2021-05-07 11:54:44 +02:00
|
|
|
#include "winternl.h"
|
2004-03-02 05:57:35 +01:00
|
|
|
#include "winnls.h"
|
|
|
|
#include "sspi.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2021-05-07 11:54:42 +02:00
|
|
|
#include "secur32_priv.h"
|
2004-03-02 05:57:35 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(secur32);
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* AcquireCredentialsHandleA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI AcquireCredentialsHandleA(
|
2004-03-02 05:57:35 +01:00
|
|
|
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 ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%s %s %ld %p %p %p %p %p %p\n", debugstr_a(pszPrincipal),
|
2004-03-02 05:57:35 +01:00
|
|
|
debugstr_a(pszPackage), fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn,
|
|
|
|
pvGetKeyArgument, phCredential, ptsExpiry);
|
|
|
|
if (pszPackage)
|
|
|
|
{
|
|
|
|
SecurePackage *package = SECUR32_findPackageA(pszPackage);
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.AcquireCredentialsHandleA)
|
|
|
|
{
|
|
|
|
ret = package->provider->fnTableA.AcquireCredentialsHandleA(
|
|
|
|
pszPrincipal, pszPackage, fCredentialsUse, pvLogonID,
|
2021-09-29 14:13:10 +02:00
|
|
|
pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
|
2004-03-02 05:57:35 +01:00
|
|
|
ptsExpiry);
|
|
|
|
if (ret == SEC_E_OK)
|
2021-09-29 14:13:10 +02:00
|
|
|
phCredential->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* AcquireCredentialsHandleW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI AcquireCredentialsHandleW(
|
2004-03-02 05:57:35 +01:00
|
|
|
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 ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%s %s %ld %p %p %p %p %p %p\n", debugstr_w(pszPrincipal),
|
2004-03-02 05:57:35 +01:00
|
|
|
debugstr_w(pszPackage), fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn,
|
|
|
|
pvGetKeyArgument, phCredential, ptsExpiry);
|
|
|
|
if (pszPackage)
|
|
|
|
{
|
|
|
|
SecurePackage *package = SECUR32_findPackageW(pszPackage);
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.AcquireCredentialsHandleW)
|
|
|
|
{
|
|
|
|
ret = package->provider->fnTableW.AcquireCredentialsHandleW(
|
|
|
|
pszPrincipal, pszPackage, fCredentialsUse, pvLogonID,
|
2021-09-29 14:13:10 +02:00
|
|
|
pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
|
2004-03-02 05:57:35 +01:00
|
|
|
ptsExpiry);
|
|
|
|
if (ret == SEC_E_OK)
|
2021-09-29 14:13:10 +02:00
|
|
|
phCredential->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* FreeCredentialsHandle (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI FreeCredentialsHandle(
|
2004-03-02 05:57:35 +01:00
|
|
|
PCredHandle phCredential)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p\n", phCredential);
|
|
|
|
if (phCredential)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
|
2021-09-29 14:13:10 +02:00
|
|
|
if (package && package->provider && package->provider->fnTableW.FreeCredentialsHandle)
|
|
|
|
ret = package->provider->fnTableW.FreeCredentialsHandle(phCredential);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryCredentialsAttributesA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QueryCredentialsAttributesA(
|
2006-10-15 14:51:52 +02:00
|
|
|
PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p\n", phCredential, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phCredential)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.QueryCredentialsAttributesA)
|
|
|
|
ret = package->provider->fnTableA.QueryCredentialsAttributesA(
|
2021-09-29 14:13:10 +02:00
|
|
|
phCredential, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryCredentialsAttributesW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QueryCredentialsAttributesW(
|
2006-10-15 14:51:52 +02:00
|
|
|
PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p\n", phCredential, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phCredential)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.QueryCredentialsAttributesW)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.QueryCredentialsAttributesW(phCredential, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InitializeSecurityContextA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI InitializeSecurityContextA(
|
2004-03-02 05:57:35 +01:00
|
|
|
PCredHandle phCredential, PCtxtHandle phContext,
|
2006-10-15 14:51:52 +02:00
|
|
|
SEC_CHAR *pszTargetName, ULONG fContextReq,
|
|
|
|
ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
|
|
|
|
ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
|
|
|
|
ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
2007-05-24 21:01:21 +02:00
|
|
|
SecurePackage *package = NULL;
|
2004-03-02 05:57:35 +01:00
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %p %s 0x%08lx %ld %ld %p %ld %p %p %p %p\n", phCredential, phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
|
|
|
Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
2007-05-24 21:01:21 +02:00
|
|
|
|
2021-09-29 14:13:10 +02:00
|
|
|
if (phContext) package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
else if (phCredential) package = (SecurePackage *)phCredential->dwUpper;
|
2004-03-02 05:57:35 +01:00
|
|
|
|
2007-05-24 21:01:21 +02:00
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.InitializeSecurityContextA)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
2007-05-24 21:01:21 +02:00
|
|
|
ret = package->provider->fnTableA.InitializeSecurityContextA(
|
2021-09-29 14:13:10 +02:00
|
|
|
phCredential, phContext, pszTargetName, fContextReq,
|
|
|
|
Reserved1, TargetDataRep, pInput, Reserved2, phNewContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
pOutput, pfContextAttr, ptsExpiry);
|
2021-09-29 14:13:10 +02:00
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
phNewContext->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
2007-05-24 21:01:21 +02:00
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InitializeSecurityContextW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI InitializeSecurityContextW(
|
2004-03-02 05:57:35 +01:00
|
|
|
PCredHandle phCredential, PCtxtHandle phContext,
|
2006-10-15 14:51:52 +02:00
|
|
|
SEC_WCHAR *pszTargetName, ULONG fContextReq,
|
|
|
|
ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
|
|
|
|
ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
|
|
|
|
ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
2007-05-24 21:01:21 +02:00
|
|
|
SecurePackage *package = NULL;
|
2004-03-02 05:57:35 +01:00
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %p %s 0x%08lx %ld %ld %p %ld %p %p %p %p\n", phCredential, phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
|
|
|
Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
2007-05-24 21:01:21 +02:00
|
|
|
|
2021-09-29 14:13:10 +02:00
|
|
|
if (phContext) package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
else if (phCredential) package = (SecurePackage *)phCredential->dwUpper;
|
2004-03-02 05:57:35 +01:00
|
|
|
|
2007-05-24 21:01:21 +02:00
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.InitializeSecurityContextW)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
2007-05-24 21:01:21 +02:00
|
|
|
ret = package->provider->fnTableW.InitializeSecurityContextW(
|
2021-09-29 14:13:10 +02:00
|
|
|
phCredential, phContext, pszTargetName, fContextReq,
|
|
|
|
Reserved1, TargetDataRep, pInput, Reserved2, phNewContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
pOutput, pfContextAttr, ptsExpiry);
|
2021-09-29 14:13:10 +02:00
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
phNewContext->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
2007-05-24 21:01:21 +02:00
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* AcceptSecurityContext (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI AcceptSecurityContext(
|
2004-03-02 05:57:35 +01:00
|
|
|
PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput,
|
2006-10-15 14:51:52 +02:00
|
|
|
ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %p %p %ld %ld %p %p %p %p\n", phCredential, phContext, pInput,
|
2004-03-02 05:57:35 +01:00
|
|
|
fContextReq, TargetDataRep, phNewContext, pOutput, pfContextAttr,
|
|
|
|
ptsExpiry);
|
|
|
|
if (phCredential)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.AcceptSecurityContext)
|
|
|
|
{
|
|
|
|
ret = package->provider->fnTableW.AcceptSecurityContext(
|
2021-09-29 14:13:10 +02:00
|
|
|
phCredential, phContext, pInput, fContextReq,
|
|
|
|
TargetDataRep, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
phNewContext->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* CompleteAuthToken (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI CompleteAuthToken(PCtxtHandle phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBufferDesc pToken)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p %p\n", phContext, pToken);
|
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.CompleteAuthToken)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.CompleteAuthToken(phContext, pToken);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DeleteSecurityContext (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p\n", phContext);
|
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
2021-09-29 14:13:10 +02:00
|
|
|
if (package && package->provider && package->provider->fnTableW.DeleteSecurityContext)
|
|
|
|
ret = package->provider->fnTableW.DeleteSecurityContext(phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ApplyControlToken (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI ApplyControlToken(PCtxtHandle phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBufferDesc pInput)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p %p\n", phContext, pInput);
|
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.ApplyControlToken)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.ApplyControlToken(phContext, pInput);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryContextAttributesA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QueryContextAttributesA(PCtxtHandle phContext,
|
2006-10-15 14:51:52 +02:00
|
|
|
ULONG ulAttribute, void *pBuffer)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p\n", phContext, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.QueryContextAttributesA)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableA.QueryContextAttributesA(phContext, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryContextAttributesW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QueryContextAttributesW(PCtxtHandle phContext,
|
2006-10-15 14:51:52 +02:00
|
|
|
ULONG ulAttribute, void *pBuffer)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p\n", phContext, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.QueryContextAttributesW)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.QueryContextAttributesW(phContext, ulAttribute, pBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ImpersonateSecurityContext (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI ImpersonateSecurityContext(PCtxtHandle phContext)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p\n", phContext);
|
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.ImpersonateSecurityContext)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.ImpersonateSecurityContext(phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RevertSecurityContext (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI RevertSecurityContext(PCtxtHandle phContext)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p\n", phContext);
|
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.RevertSecurityContext)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.RevertSecurityContext(phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MakeSignature (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI MakeSignature(PCtxtHandle phContext, ULONG fQOP,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p %ld\n", phContext, fQOP, pMessage, MessageSeqNo);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.MakeSignature)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.MakeSignature(phContext, fQOP, pMessage, MessageSeqNo);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* VerifySignature (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI VerifySignature(PCtxtHandle phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %p %ld %p\n", phContext, pMessage, MessageSeqNo, pfQOP);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.VerifySignature)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QuerySecurityPackageInfoA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecPkgInfoA *ppPackageInfo)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
2021-05-07 11:54:44 +02:00
|
|
|
|
2004-03-02 05:57:35 +01:00
|
|
|
TRACE("%s %p\n", debugstr_a(pszPackageName), ppPackageInfo);
|
|
|
|
if (pszPackageName)
|
|
|
|
{
|
|
|
|
SecurePackage *package = SECUR32_findPackageA(pszPackageName);
|
|
|
|
|
|
|
|
if (package)
|
|
|
|
{
|
|
|
|
size_t bytesNeeded = sizeof(SecPkgInfoA);
|
|
|
|
int nameLen = 0, commentLen = 0;
|
|
|
|
|
|
|
|
if (package->infoW.Name)
|
|
|
|
{
|
|
|
|
nameLen = WideCharToMultiByte(CP_ACP, 0,
|
|
|
|
package->infoW.Name, -1, NULL, 0, NULL, NULL);
|
|
|
|
bytesNeeded += nameLen;
|
|
|
|
}
|
|
|
|
if (package->infoW.Comment)
|
|
|
|
{
|
|
|
|
commentLen = WideCharToMultiByte(CP_ACP, 0,
|
|
|
|
package->infoW.Comment, -1, NULL, 0, NULL, NULL);
|
|
|
|
bytesNeeded += commentLen;
|
|
|
|
}
|
2021-05-07 11:54:44 +02:00
|
|
|
/* freed with FreeContextBuffer */
|
|
|
|
if ((*ppPackageInfo = RtlAllocateHeap(GetProcessHeap(), 0, bytesNeeded)))
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo +
|
|
|
|
sizeof(SecPkgInfoA));
|
|
|
|
|
|
|
|
memcpy(*ppPackageInfo, &package->infoW, sizeof(package->infoW));
|
|
|
|
if (package->infoW.Name)
|
|
|
|
{
|
|
|
|
(*ppPackageInfo)->Name = nextString;
|
|
|
|
nextString += WideCharToMultiByte(CP_ACP, 0,
|
|
|
|
package->infoW.Name, -1, nextString, nameLen, NULL, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(*ppPackageInfo)->Name = NULL;
|
|
|
|
if (package->infoW.Comment)
|
|
|
|
{
|
|
|
|
(*ppPackageInfo)->Comment = nextString;
|
|
|
|
nextString += WideCharToMultiByte(CP_ACP, 0,
|
|
|
|
package->infoW.Comment, -1, nextString, commentLen, NULL,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(*ppPackageInfo)->Comment = NULL;
|
|
|
|
ret = SEC_E_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INSUFFICIENT_MEMORY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QuerySecurityPackageInfoW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecPkgInfoW *ppPackageInfo)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
SecurePackage *package = SECUR32_findPackageW(pszPackageName);
|
|
|
|
|
|
|
|
TRACE("%s %p\n", debugstr_w(pszPackageName), ppPackageInfo);
|
|
|
|
if (package)
|
|
|
|
{
|
|
|
|
size_t bytesNeeded = sizeof(SecPkgInfoW);
|
|
|
|
int nameLen = 0, commentLen = 0;
|
|
|
|
|
|
|
|
if (package->infoW.Name)
|
|
|
|
{
|
|
|
|
nameLen = lstrlenW(package->infoW.Name) + 1;
|
|
|
|
bytesNeeded += nameLen * sizeof(WCHAR);
|
|
|
|
}
|
|
|
|
if (package->infoW.Comment)
|
|
|
|
{
|
|
|
|
commentLen = lstrlenW(package->infoW.Comment) + 1;
|
|
|
|
bytesNeeded += commentLen * sizeof(WCHAR);
|
|
|
|
}
|
2021-05-07 11:54:44 +02:00
|
|
|
/* freed with FreeContextBuffer */
|
|
|
|
if ((*ppPackageInfo = RtlAllocateHeap(GetProcessHeap(), 0, bytesNeeded)))
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo +
|
|
|
|
sizeof(SecPkgInfoW));
|
|
|
|
|
2008-03-16 00:25:42 +01:00
|
|
|
**ppPackageInfo = package->infoW;
|
2004-03-02 05:57:35 +01:00
|
|
|
if (package->infoW.Name)
|
|
|
|
{
|
|
|
|
(*ppPackageInfo)->Name = nextString;
|
|
|
|
lstrcpynW(nextString, package->infoW.Name, nameLen);
|
|
|
|
nextString += nameLen;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(*ppPackageInfo)->Name = NULL;
|
|
|
|
if (package->infoW.Comment)
|
|
|
|
{
|
|
|
|
(*ppPackageInfo)->Comment = nextString;
|
|
|
|
lstrcpynW(nextString, package->infoW.Comment, commentLen);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(*ppPackageInfo)->Comment = NULL;
|
|
|
|
ret = SEC_E_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INSUFFICIENT_MEMORY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ExportSecurityContext (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI ExportSecurityContext(PCtxtHandle phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
ULONG fFlags, PSecBuffer pPackedContext, void **pToken)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p %p\n", phContext, fFlags, pPackedContext, pToken);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.ExportSecurityContext)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.ExportSecurityContext(phContext, fFlags, pPackedContext, pToken);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ImportSecurityContextA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
SecurePackage *package = SECUR32_findPackageA(pszPackage);
|
2021-05-07 11:54:44 +02:00
|
|
|
|
2021-09-29 14:13:10 +02:00
|
|
|
TRACE("%s %p %p %p\n", debugstr_a(pszPackage), pPackedContext, Token, phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.ImportSecurityContextA)
|
|
|
|
{
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableA.ImportSecurityContextA(pszPackage, pPackedContext, Token, phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (ret == SEC_E_OK)
|
2021-09-29 14:13:10 +02:00
|
|
|
phContext->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ImportSecurityContextW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI ImportSecurityContextW(SEC_WCHAR *pszPackage,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
SecurePackage *package = SECUR32_findPackageW(pszPackage);
|
|
|
|
|
2021-09-29 14:13:10 +02:00
|
|
|
TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token, phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.ImportSecurityContextW)
|
|
|
|
{
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.ImportSecurityContextW(pszPackage, pPackedContext, Token, phContext);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (ret == SEC_E_OK)
|
2021-09-29 14:13:10 +02:00
|
|
|
phContext->dwUpper = (ULONG_PTR)package;
|
2004-03-02 05:57:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* AddCredentialsA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI AddCredentialsA(PCredHandle hCredentials,
|
2006-10-15 14:51:52 +02:00
|
|
|
SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
|
2004-03-02 05:57:35 +01:00
|
|
|
void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
|
|
|
|
PTimeStamp ptsExpiry)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %s %s %ld %p %p %p %p\n", hCredentials, debugstr_a(pszPrincipal),
|
2004-03-02 05:57:35 +01:00
|
|
|
debugstr_a(pszPackage), fCredentialUse, pAuthData, pGetKeyFn,
|
|
|
|
pvGetKeyArgument, ptsExpiry);
|
|
|
|
if (hCredentials)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)hCredentials->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.AddCredentialsA)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableA.AddCredentialsA(hCredentials, pszPrincipal, pszPackage,
|
|
|
|
fCredentialUse, pAuthData, pGetKeyFn,
|
|
|
|
pvGetKeyArgument, ptsExpiry);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* AddCredentialsW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI AddCredentialsW(PCredHandle hCredentials,
|
2006-10-15 14:51:52 +02:00
|
|
|
SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
|
2004-03-02 05:57:35 +01:00
|
|
|
void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
|
|
|
|
PTimeStamp ptsExpiry)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %s %s %ld %p %p %p %p\n", hCredentials, debugstr_w(pszPrincipal),
|
2004-03-02 05:57:35 +01:00
|
|
|
debugstr_w(pszPackage), fCredentialUse, pAuthData, pGetKeyFn,
|
|
|
|
pvGetKeyArgument, ptsExpiry);
|
|
|
|
if (hCredentials)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)hCredentials->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.AddCredentialsW)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.AddCredentialsW(hCredentials, pszPrincipal, pszPackage,
|
|
|
|
fCredentialUse, pAuthData, pGetKeyFn,
|
|
|
|
pvGetKeyArgument, ptsExpiry);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QuerySecurityContextToken (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI QuerySecurityContextToken(PCtxtHandle phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
HANDLE *phToken)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%p %p\n", phContext, phToken);
|
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.QuerySecurityContextToken)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.QuerySecurityContextToken(phContext, phToken);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* EncryptMessage (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p %ld\n", phContext, fQOP, pMessage, MessageSeqNo);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.EncryptMessage)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DecryptMessage (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI DecryptMessage(PCtxtHandle phContext,
|
2004-03-02 05:57:35 +01:00
|
|
|
PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
|
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %p %ld %p\n", phContext, pMessage, MessageSeqNo, pfQOP);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.DecryptMessage)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetContextAttributesA (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI SetContextAttributesA(PCtxtHandle phContext,
|
2006-10-15 14:51:52 +02:00
|
|
|
ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p %ld\n", phContext, ulAttribute, pBuffer, cbBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableA.SetContextAttributesA)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableA.SetContextAttributesA(phContext, ulAttribute, pBuffer, cbBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-17 23:08:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetContextAttributesW (SECUR32.@)
|
|
|
|
*/
|
|
|
|
SECURITY_STATUS WINAPI SetContextAttributesW(PCtxtHandle phContext,
|
2006-10-15 14:51:52 +02:00
|
|
|
ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
|
2004-03-02 05:57:35 +01:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
|
|
|
|
2022-02-17 07:12:45 +01:00
|
|
|
TRACE("%p %ld %p %ld\n", phContext, ulAttribute, pBuffer, cbBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
SecurePackage *package = (SecurePackage *)phContext->dwUpper;
|
|
|
|
if (package && package->provider)
|
|
|
|
{
|
|
|
|
if (package->provider->fnTableW.SetContextAttributesW)
|
2021-09-29 14:13:10 +02:00
|
|
|
ret = package->provider->fnTableW.SetContextAttributesW(phContext, ulAttribute, pBuffer, cbBuffer);
|
2004-03-02 05:57:35 +01:00
|
|
|
else
|
|
|
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = SEC_E_INVALID_HANDLE;
|
|
|
|
return ret;
|
|
|
|
}
|