2012-02-21 01:17:57 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* Security Support Provider Interface (SSPI)
|
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:20:53 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
#include <stdlib.h>
|
2012-02-21 01:17:57 +04:00
|
|
|
|
2012-08-23 23:15:57 +04:00
|
|
|
#include <winpr/windows.h>
|
2012-08-23 09:18:47 +04:00
|
|
|
|
2012-05-06 06:39:00 +04:00
|
|
|
#include <winpr/crt.h>
|
2012-05-05 03:48:53 +04:00
|
|
|
#include <winpr/sspi.h>
|
2012-06-07 05:16:47 +04:00
|
|
|
#include <winpr/print.h>
|
2012-02-21 01:17:57 +04:00
|
|
|
|
2012-08-23 23:15:57 +04:00
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
|
2012-02-24 00:56:50 +04:00
|
|
|
#include "sspi.h"
|
|
|
|
|
2012-02-21 02:33:21 +04:00
|
|
|
/* Authentication Functions: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374731/ */
|
2012-02-21 02:04:45 +04:00
|
|
|
|
2012-05-22 06:48:33 +04:00
|
|
|
#ifdef WINPR_SSPI
|
2012-03-24 08:14:45 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
extern const SecPkgInfoA NTLM_SecPkgInfoA;
|
|
|
|
extern const SecPkgInfoW NTLM_SecPkgInfoW;
|
|
|
|
extern const SecPkgInfoA CREDSSP_SecPkgInfoA;
|
|
|
|
extern const SecPkgInfoW CREDSSP_SecPkgInfoW;
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
extern const SecurityFunctionTableA NTLM_SecurityFunctionTableA;
|
|
|
|
extern const SecurityFunctionTableW NTLM_SecurityFunctionTableW;
|
|
|
|
extern const SecurityFunctionTableA CREDSSP_SecurityFunctionTableA;
|
|
|
|
extern const SecurityFunctionTableW CREDSSP_SecurityFunctionTableW;
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
const SecPkgInfoA* SecPkgInfoA_LIST[] =
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
&NTLM_SecPkgInfoA,
|
|
|
|
&CREDSSP_SecPkgInfoA
|
2012-02-23 08:41:22 +04:00
|
|
|
};
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
const SecPkgInfoW* SecPkgInfoW_LIST[] =
|
|
|
|
{
|
|
|
|
&NTLM_SecPkgInfoW,
|
|
|
|
&CREDSSP_SecPkgInfoW
|
|
|
|
};
|
|
|
|
|
|
|
|
SecurityFunctionTableA SSPI_SecurityFunctionTableA;
|
|
|
|
SecurityFunctionTableW SSPI_SecurityFunctionTableW;
|
2012-03-24 08:14:45 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
struct _SecurityFunctionTableA_NAME
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
SEC_CHAR* Name;
|
|
|
|
const SecurityFunctionTableA* SecurityFunctionTable;
|
|
|
|
};
|
|
|
|
typedef struct _SecurityFunctionTableA_NAME SecurityFunctionTableA_NAME;
|
|
|
|
|
|
|
|
struct _SecurityFunctionTableW_NAME
|
|
|
|
{
|
|
|
|
SEC_WCHAR* Name;
|
|
|
|
const SecurityFunctionTableW* SecurityFunctionTable;
|
|
|
|
};
|
|
|
|
typedef struct _SecurityFunctionTableW_NAME SecurityFunctionTableW_NAME;
|
|
|
|
|
|
|
|
const SecurityFunctionTableA_NAME SecurityFunctionTableA_NAME_LIST[] =
|
|
|
|
{
|
|
|
|
{ "NTLM", &NTLM_SecurityFunctionTableA },
|
|
|
|
{ "CREDSSP", &CREDSSP_SecurityFunctionTableA }
|
2012-02-23 08:41:22 +04:00
|
|
|
};
|
|
|
|
|
2012-06-04 03:59:35 +04:00
|
|
|
WCHAR NTLM_NAME_W[] = { 'N','T','L','M','\0' };
|
|
|
|
WCHAR CREDSSP_NAME_W[] = { 'C','r','e','d','S','S','P','\0' };
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
const SecurityFunctionTableW_NAME SecurityFunctionTableW_NAME_LIST[] =
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-06-04 03:59:35 +04:00
|
|
|
{ NTLM_NAME_W, &NTLM_SecurityFunctionTableW },
|
|
|
|
{ CREDSSP_NAME_W, &CREDSSP_SecurityFunctionTableW }
|
2012-02-23 08:41:22 +04:00
|
|
|
};
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
#endif
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
#define SecHandle_LOWER_MAX 0xFFFFFFFF
|
|
|
|
#define SecHandle_UPPER_MAX 0xFFFFFFFE
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-02-25 00:00:49 +04:00
|
|
|
struct _CONTEXT_BUFFER_ALLOC_ENTRY
|
|
|
|
{
|
|
|
|
void* contextBuffer;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 allocatorIndex;
|
2012-02-25 00:00:49 +04:00
|
|
|
};
|
|
|
|
typedef struct _CONTEXT_BUFFER_ALLOC_ENTRY CONTEXT_BUFFER_ALLOC_ENTRY;
|
|
|
|
|
|
|
|
struct _CONTEXT_BUFFER_ALLOC_TABLE
|
|
|
|
{
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cEntries;
|
|
|
|
UINT32 cMaxEntries;
|
2012-02-25 00:00:49 +04:00
|
|
|
CONTEXT_BUFFER_ALLOC_ENTRY* entries;
|
|
|
|
};
|
|
|
|
typedef struct _CONTEXT_BUFFER_ALLOC_TABLE CONTEXT_BUFFER_ALLOC_TABLE;
|
|
|
|
|
|
|
|
CONTEXT_BUFFER_ALLOC_TABLE ContextBufferAllocTable;
|
|
|
|
|
|
|
|
void sspi_ContextBufferAllocTableNew()
|
|
|
|
{
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
ContextBufferAllocTable.cEntries = 0;
|
2012-02-25 00:35:48 +04:00
|
|
|
ContextBufferAllocTable.cMaxEntries = 4;
|
2012-02-25 00:00:49 +04:00
|
|
|
|
|
|
|
size = sizeof(CONTEXT_BUFFER_ALLOC_ENTRY) * ContextBufferAllocTable.cMaxEntries;
|
|
|
|
|
2012-05-26 00:42:35 +04:00
|
|
|
ContextBufferAllocTable.entries = malloc(size);
|
|
|
|
ZeroMemory(ContextBufferAllocTable.entries, size);
|
2012-02-25 00:00:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void sspi_ContextBufferAllocTableGrow()
|
|
|
|
{
|
|
|
|
size_t size;
|
|
|
|
ContextBufferAllocTable.cEntries = 0;
|
|
|
|
ContextBufferAllocTable.cMaxEntries *= 2;
|
|
|
|
|
|
|
|
size = sizeof(CONTEXT_BUFFER_ALLOC_ENTRY) * ContextBufferAllocTable.cMaxEntries;
|
|
|
|
|
2012-05-29 22:14:26 +04:00
|
|
|
ContextBufferAllocTable.entries = realloc(ContextBufferAllocTable.entries, size);
|
|
|
|
ZeroMemory((void*) &ContextBufferAllocTable.entries[ContextBufferAllocTable.cMaxEntries / 2], size / 2);
|
2012-02-25 00:00:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void sspi_ContextBufferAllocTableFree()
|
|
|
|
{
|
|
|
|
ContextBufferAllocTable.cEntries = ContextBufferAllocTable.cMaxEntries = 0;
|
2012-05-26 00:42:35 +04:00
|
|
|
free(ContextBufferAllocTable.entries);
|
2012-02-25 00:00:49 +04:00
|
|
|
}
|
|
|
|
|
2012-05-25 01:05:12 +04:00
|
|
|
void* sspi_ContextBufferAlloc(UINT32 allocatorIndex, size_t size)
|
2012-02-25 00:00:49 +04:00
|
|
|
{
|
|
|
|
int index;
|
2012-02-25 00:35:48 +04:00
|
|
|
void* contextBuffer;
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-02-28 19:01:47 +04:00
|
|
|
for (index = 0; index < (int) ContextBufferAllocTable.cMaxEntries; index++)
|
2012-02-25 00:00:49 +04:00
|
|
|
{
|
|
|
|
if (ContextBufferAllocTable.entries[index].contextBuffer == NULL)
|
|
|
|
{
|
2012-05-26 00:42:35 +04:00
|
|
|
contextBuffer = malloc(size);
|
|
|
|
ZeroMemory(contextBuffer, size);
|
2012-02-25 00:00:49 +04:00
|
|
|
ContextBufferAllocTable.cEntries++;
|
2012-02-25 00:35:48 +04:00
|
|
|
|
|
|
|
ContextBufferAllocTable.entries[index].contextBuffer = contextBuffer;
|
2012-02-25 00:00:49 +04:00
|
|
|
ContextBufferAllocTable.entries[index].allocatorIndex = allocatorIndex;
|
2012-02-25 00:35:48 +04:00
|
|
|
|
2012-02-25 00:00:49 +04:00
|
|
|
return ContextBufferAllocTable.entries[index].contextBuffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no available entry was found, the table needs to be grown */
|
|
|
|
|
|
|
|
sspi_ContextBufferAllocTableGrow();
|
|
|
|
|
|
|
|
/* the next call to sspi_ContextBufferAlloc() should now succeed */
|
|
|
|
|
|
|
|
return sspi_ContextBufferAlloc(allocatorIndex, size);
|
|
|
|
}
|
|
|
|
|
2012-02-24 00:56:50 +04:00
|
|
|
CREDENTIALS* sspi_CredentialsNew()
|
|
|
|
{
|
|
|
|
CREDENTIALS* credentials;
|
|
|
|
|
2012-05-26 00:42:35 +04:00
|
|
|
credentials = (CREDENTIALS*) malloc(sizeof(CREDENTIALS));
|
|
|
|
ZeroMemory(credentials, sizeof(CREDENTIALS));
|
2012-02-24 00:56:50 +04:00
|
|
|
|
|
|
|
if (credentials != NULL)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return credentials;
|
|
|
|
}
|
|
|
|
|
|
|
|
void sspi_CredentialsFree(CREDENTIALS* credentials)
|
|
|
|
{
|
|
|
|
if (!credentials)
|
|
|
|
return;
|
|
|
|
|
2012-05-26 00:42:35 +04:00
|
|
|
free(credentials);
|
2012-02-24 00:56:50 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
void sspi_SecBufferAlloc(PSecBuffer SecBuffer, size_t size)
|
2012-02-25 02:17:38 +04:00
|
|
|
{
|
2012-03-16 04:37:38 +04:00
|
|
|
SecBuffer->cbBuffer = size;
|
2012-05-26 00:42:35 +04:00
|
|
|
SecBuffer->pvBuffer = malloc(size);
|
|
|
|
ZeroMemory(SecBuffer->pvBuffer, SecBuffer->cbBuffer);
|
2012-02-25 02:17:38 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
void sspi_SecBufferFree(PSecBuffer SecBuffer)
|
2012-02-25 02:17:38 +04:00
|
|
|
{
|
2012-05-26 00:42:35 +04:00
|
|
|
free(SecBuffer->pvBuffer);
|
2012-03-16 04:37:38 +04:00
|
|
|
SecBuffer->pvBuffer = NULL;
|
2012-05-26 00:42:35 +04:00
|
|
|
SecBuffer->cbBuffer = 0;
|
2012-02-25 02:17:38 +04:00
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
SecHandle* sspi_SecureHandleAlloc()
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
2012-05-26 00:42:35 +04:00
|
|
|
SecHandle* handle = (SecHandle*) malloc(sizeof(SecHandle));
|
2012-02-24 06:26:00 +04:00
|
|
|
sspi_SecureHandleInit(handle);
|
2012-02-24 00:56:50 +04:00
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void sspi_SecureHandleInit(SecHandle* handle)
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
memset(handle, 0xFF, sizeof(SecHandle));
|
2012-02-24 00:56:50 +04:00
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void sspi_SecureHandleInvalidate(SecHandle* handle)
|
2012-02-24 06:26:00 +04:00
|
|
|
{
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sspi_SecureHandleInit(handle);
|
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void* sspi_SecureHandleGetLowerPointer(SecHandle* handle)
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
|
|
|
void* pointer;
|
|
|
|
|
|
|
|
if (!handle)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pointer = (void*) ~((size_t) handle->dwLower);
|
|
|
|
|
|
|
|
return pointer;
|
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void sspi_SecureHandleSetLowerPointer(SecHandle* handle, void* pointer)
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
handle->dwLower = (ULONG_PTR) (~((size_t) pointer));
|
2012-02-24 00:56:50 +04:00
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void* sspi_SecureHandleGetUpperPointer(SecHandle* handle)
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
|
|
|
void* pointer;
|
|
|
|
|
|
|
|
if (!handle)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pointer = (void*) ~((size_t) handle->dwUpper);
|
|
|
|
|
|
|
|
return pointer;
|
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void sspi_SecureHandleSetUpperPointer(SecHandle* handle, void* pointer)
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
handle->dwUpper = (ULONG_PTR) (~((size_t) pointer));
|
2012-02-24 00:56:50 +04:00
|
|
|
}
|
|
|
|
|
2012-03-16 04:37:38 +04:00
|
|
|
void sspi_SecureHandleFree(SecHandle* handle)
|
2012-02-24 00:56:50 +04:00
|
|
|
{
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
free(handle);
|
2012-02-24 00:56:50 +04:00
|
|
|
}
|
|
|
|
|
2012-05-25 01:05:12 +04:00
|
|
|
void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* domain, char* password)
|
|
|
|
{
|
|
|
|
identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
|
|
|
|
2012-06-04 03:59:35 +04:00
|
|
|
if (user)
|
|
|
|
{
|
2012-06-07 05:16:47 +04:00
|
|
|
identity->UserLength = MultiByteToWideChar(CP_UTF8, 0, user, strlen(user), NULL, 0);
|
|
|
|
identity->User = (UINT16*) malloc(identity->UserLength * sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_UTF8, 0, user, identity->UserLength, (LPWSTR) identity->User, identity->UserLength * sizeof(WCHAR));
|
2012-06-04 03:59:35 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
identity->User = (UINT16*) NULL;
|
|
|
|
identity->UserLength = 0;
|
|
|
|
}
|
2012-05-25 01:05:12 +04:00
|
|
|
|
|
|
|
if (domain)
|
|
|
|
{
|
2012-06-07 05:16:47 +04:00
|
|
|
identity->DomainLength = MultiByteToWideChar(CP_UTF8, 0, domain, strlen(domain), NULL, 0);
|
|
|
|
identity->Domain = (UINT16*) malloc(identity->DomainLength * sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_UTF8, 0, domain, identity->DomainLength, (LPWSTR) identity->Domain, identity->DomainLength * sizeof(WCHAR));
|
2012-05-25 01:05:12 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
identity->Domain = (UINT16*) NULL;
|
|
|
|
identity->DomainLength = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (password != NULL)
|
|
|
|
{
|
2012-06-07 05:16:47 +04:00
|
|
|
identity->PasswordLength = MultiByteToWideChar(CP_UTF8, 0, password, strlen(password), NULL, 0);
|
|
|
|
identity->Password = (UINT16*) malloc(identity->PasswordLength * sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_UTF8, 0, password, identity->PasswordLength, (LPWSTR) identity->Password, identity->PasswordLength * sizeof(WCHAR));
|
2012-05-25 01:05:12 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
identity->Password = NULL;
|
|
|
|
identity->PasswordLength = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-25 06:20:51 +04:00
|
|
|
void sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDENTITY* srcIdentity)
|
|
|
|
{
|
|
|
|
if (identity->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI)
|
|
|
|
{
|
|
|
|
sspi_SetAuthIdentity(identity, (char*) srcIdentity->User,
|
|
|
|
(char*) srcIdentity->Domain, (char*) srcIdentity->Password);
|
|
|
|
|
|
|
|
identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
|
|
|
|
|
|
|
identity->UserLength = srcIdentity->UserLength;
|
2012-06-07 08:14:47 +04:00
|
|
|
identity->User = (UINT16*) malloc(identity->UserLength * sizeof(WCHAR));
|
|
|
|
CopyMemory(identity->User, srcIdentity->User, identity->UserLength * sizeof(WCHAR));
|
2012-05-25 06:20:51 +04:00
|
|
|
|
|
|
|
identity->DomainLength = srcIdentity->DomainLength;
|
2012-06-07 08:14:47 +04:00
|
|
|
identity->Domain = (UINT16*) malloc(identity->DomainLength * sizeof(WCHAR));
|
|
|
|
CopyMemory(identity->Domain, srcIdentity->Domain, identity->DomainLength * sizeof(WCHAR));
|
2012-05-25 06:20:51 +04:00
|
|
|
|
|
|
|
identity->PasswordLength = srcIdentity->PasswordLength;
|
2012-06-07 08:14:47 +04:00
|
|
|
identity->Password = (UINT16*) malloc(identity->PasswordLength * sizeof(WCHAR));
|
|
|
|
CopyMemory(identity->Password, srcIdentity->Password, identity->PasswordLength * sizeof(WCHAR));
|
2012-05-25 06:20:51 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
void sspi_GlobalInit()
|
|
|
|
{
|
2012-08-23 09:18:47 +04:00
|
|
|
SSL_load_error_strings();
|
|
|
|
SSL_library_init();
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
sspi_ContextBufferAllocTableNew();
|
|
|
|
}
|
|
|
|
|
|
|
|
void sspi_GlobalFinish()
|
|
|
|
{
|
|
|
|
sspi_ContextBufferAllocTableFree();
|
|
|
|
}
|
|
|
|
|
2012-06-06 10:59:37 +04:00
|
|
|
#ifndef WITH_NATIVE_SSPI
|
2012-03-24 08:14:45 +04:00
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
SecurityFunctionTableA* sspi_GetSecurityFunctionTableAByNameA(const SEC_CHAR* Name)
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
|
|
|
int index;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-02-28 19:01:47 +04:00
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
if (strcmp(Name, SecurityFunctionTableA_NAME_LIST[index].Name) == 0)
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
return (SecurityFunctionTableA*) SecurityFunctionTableA_NAME_LIST[index].SecurityFunctionTable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
SecurityFunctionTableA* sspi_GetSecurityFunctionTableAByNameW(const SEC_WCHAR* Name)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SecurityFunctionTableW* sspi_GetSecurityFunctionTableWByNameW(const SEC_WCHAR* Name)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
int index;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-03-24 23:47:16 +04:00
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoW_LIST) / sizeof(*(SecPkgInfoW_LIST));
|
2012-03-24 23:47:16 +04:00
|
|
|
|
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
|
|
|
{
|
2012-06-04 00:30:15 +04:00
|
|
|
if (lstrcmpW(Name, SecurityFunctionTableW_NAME_LIST[index].Name) == 0)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
return (SecurityFunctionTableW*) SecurityFunctionTableW_NAME_LIST[index].SecurityFunctionTable;
|
2012-02-23 08:41:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
SecurityFunctionTableW* sspi_GetSecurityFunctionTableWByNameA(const SEC_CHAR* Name)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
SEC_WCHAR* NameW;
|
|
|
|
SecurityFunctionTableW* table;
|
|
|
|
|
|
|
|
length = strlen(Name);
|
|
|
|
NameW = (SEC_WCHAR*) malloc((length + 1) * 2);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, Name, length, (LPWSTR) NameW, length);
|
|
|
|
NameW[length] = 0;
|
|
|
|
|
|
|
|
table = sspi_GetSecurityFunctionTableWByNameW(NameW);
|
|
|
|
free(NameW);
|
|
|
|
|
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
void FreeContextBuffer_EnumerateSecurityPackages(void* contextBuffer);
|
|
|
|
void FreeContextBuffer_QuerySecurityPackageInfo(void* contextBuffer);
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
void sspi_ContextBufferFree(void* contextBuffer)
|
2012-02-25 00:00:49 +04:00
|
|
|
{
|
2012-03-24 08:14:45 +04:00
|
|
|
int index;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 allocatorIndex;
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-03-24 08:14:45 +04:00
|
|
|
for (index = 0; index < (int) ContextBufferAllocTable.cMaxEntries; index++)
|
|
|
|
{
|
|
|
|
if (contextBuffer == ContextBufferAllocTable.entries[index].contextBuffer)
|
|
|
|
{
|
|
|
|
contextBuffer = ContextBufferAllocTable.entries[index].contextBuffer;
|
|
|
|
allocatorIndex = ContextBufferAllocTable.entries[index].allocatorIndex;
|
|
|
|
|
|
|
|
ContextBufferAllocTable.cEntries--;
|
|
|
|
|
|
|
|
ContextBufferAllocTable.entries[index].allocatorIndex = 0;
|
|
|
|
ContextBufferAllocTable.entries[index].contextBuffer = NULL;
|
|
|
|
|
|
|
|
switch (allocatorIndex)
|
|
|
|
{
|
|
|
|
case EnumerateSecurityPackagesIndex:
|
|
|
|
FreeContextBuffer_EnumerateSecurityPackages(contextBuffer);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QuerySecurityPackageInfoIndex:
|
|
|
|
FreeContextBuffer_QuerySecurityPackageInfo(contextBuffer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 02:53:10 +04:00
|
|
|
|
2012-02-21 02:33:21 +04:00
|
|
|
/* Package Management */
|
2012-02-21 01:17:57 +04:00
|
|
|
|
2012-08-23 06:24:29 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(ULONG* pcPackages, PSecPkgInfoW* ppPackageInfo)
|
2012-02-21 01:17:57 +04:00
|
|
|
{
|
2012-02-23 08:41:22 +04:00
|
|
|
int index;
|
2012-02-25 00:00:49 +04:00
|
|
|
size_t size;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecPkgInfoW* pPackageInfo;
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoW_LIST) / sizeof(*(SecPkgInfoW_LIST));
|
2012-03-24 23:47:16 +04:00
|
|
|
size = sizeof(SecPkgInfoW) * cPackages;
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
pPackageInfo = (SecPkgInfoW*) sspi_ContextBufferAlloc(EnumerateSecurityPackagesIndex, size);
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-02-28 19:01:47 +04:00
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
pPackageInfo[index].fCapabilities = SecPkgInfoW_LIST[index]->fCapabilities;
|
|
|
|
pPackageInfo[index].wVersion = SecPkgInfoW_LIST[index]->wVersion;
|
|
|
|
pPackageInfo[index].wRPCID = SecPkgInfoW_LIST[index]->wRPCID;
|
|
|
|
pPackageInfo[index].cbMaxToken = SecPkgInfoW_LIST[index]->cbMaxToken;
|
2012-05-06 06:39:00 +04:00
|
|
|
pPackageInfo[index].Name = _wcsdup(SecPkgInfoW_LIST[index]->Name);
|
|
|
|
pPackageInfo[index].Comment = _wcsdup(SecPkgInfoW_LIST[index]->Comment);
|
2012-03-24 23:47:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
*(pcPackages) = cPackages;
|
|
|
|
*(ppPackageInfo) = pPackageInfo;
|
|
|
|
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-23 06:24:29 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(ULONG* pcPackages, PSecPkgInfoA* ppPackageInfo)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
int index;
|
|
|
|
size_t size;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecPkgInfoA* pPackageInfo;
|
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
|
2012-03-24 23:47:16 +04:00
|
|
|
size = sizeof(SecPkgInfoA) * cPackages;
|
|
|
|
|
|
|
|
pPackageInfo = (SecPkgInfoA*) sspi_ContextBufferAlloc(EnumerateSecurityPackagesIndex, size);
|
|
|
|
|
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
|
|
|
{
|
|
|
|
pPackageInfo[index].fCapabilities = SecPkgInfoA_LIST[index]->fCapabilities;
|
|
|
|
pPackageInfo[index].wVersion = SecPkgInfoA_LIST[index]->wVersion;
|
|
|
|
pPackageInfo[index].wRPCID = SecPkgInfoA_LIST[index]->wRPCID;
|
|
|
|
pPackageInfo[index].cbMaxToken = SecPkgInfoA_LIST[index]->cbMaxToken;
|
2012-05-06 06:39:00 +04:00
|
|
|
pPackageInfo[index].Name = _strdup(SecPkgInfoA_LIST[index]->Name);
|
|
|
|
pPackageInfo[index].Comment = _strdup(SecPkgInfoA_LIST[index]->Comment);
|
2012-02-23 08:41:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
*(pcPackages) = cPackages;
|
|
|
|
*(ppPackageInfo) = pPackageInfo;
|
|
|
|
|
2012-02-21 01:17:57 +04:00
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-02-25 00:35:48 +04:00
|
|
|
void FreeContextBuffer_EnumerateSecurityPackages(void* contextBuffer)
|
2012-02-25 00:00:49 +04:00
|
|
|
{
|
|
|
|
int index;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecPkgInfoA* pPackageInfo = (SecPkgInfoA*) contextBuffer;
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-05-06 06:39:00 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-02-28 19:01:47 +04:00
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
2012-02-25 00:00:49 +04:00
|
|
|
{
|
|
|
|
if (pPackageInfo[index].Name)
|
2012-05-06 05:33:19 +04:00
|
|
|
free(pPackageInfo[index].Name);
|
2012-02-25 00:00:49 +04:00
|
|
|
|
|
|
|
if (pPackageInfo[index].Comment)
|
2012-05-06 05:33:19 +04:00
|
|
|
free(pPackageInfo[index].Comment);
|
2012-02-25 00:00:49 +04:00
|
|
|
}
|
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
free(pPackageInfo);
|
2012-02-25 00:00:49 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableW* SEC_ENTRY InitSecurityInterfaceW(void)
|
|
|
|
{
|
|
|
|
return &SSPI_SecurityFunctionTableW;
|
|
|
|
}
|
|
|
|
|
|
|
|
SecurityFunctionTableA* SEC_ENTRY InitSecurityInterfaceA(void)
|
|
|
|
{
|
|
|
|
return &SSPI_SecurityFunctionTableA;
|
|
|
|
}
|
|
|
|
|
|
|
|
SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageName, PSecPkgInfoW* ppPackageInfo)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
int index;
|
|
|
|
size_t size;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecPkgInfoW* pPackageInfo;
|
|
|
|
|
2012-05-06 06:39:00 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoW_LIST) / sizeof(*(SecPkgInfoW_LIST));
|
2012-03-24 23:47:16 +04:00
|
|
|
|
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
|
|
|
{
|
2012-06-04 03:59:35 +04:00
|
|
|
if (lstrcmpW(pszPackageName, SecPkgInfoW_LIST[index]->Name) == 0)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
size = sizeof(SecPkgInfoW);
|
|
|
|
pPackageInfo = (SecPkgInfoW*) sspi_ContextBufferAlloc(QuerySecurityPackageInfoIndex, size);
|
|
|
|
|
|
|
|
pPackageInfo->fCapabilities = SecPkgInfoW_LIST[index]->fCapabilities;
|
|
|
|
pPackageInfo->wVersion = SecPkgInfoW_LIST[index]->wVersion;
|
|
|
|
pPackageInfo->wRPCID = SecPkgInfoW_LIST[index]->wRPCID;
|
|
|
|
pPackageInfo->cbMaxToken = SecPkgInfoW_LIST[index]->cbMaxToken;
|
2012-05-06 06:39:00 +04:00
|
|
|
pPackageInfo->Name = _wcsdup(SecPkgInfoW_LIST[index]->Name);
|
|
|
|
pPackageInfo->Comment = _wcsdup(SecPkgInfoW_LIST[index]->Comment);
|
2012-03-24 23:47:16 +04:00
|
|
|
|
|
|
|
*(ppPackageInfo) = pPackageInfo;
|
|
|
|
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*(ppPackageInfo) = NULL;
|
|
|
|
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
2012-02-21 02:33:21 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(SEC_CHAR* pszPackageName, PSecPkgInfoA* ppPackageInfo)
|
2012-02-21 01:17:57 +04:00
|
|
|
{
|
2012-02-23 08:41:22 +04:00
|
|
|
int index;
|
2012-02-25 00:00:49 +04:00
|
|
|
size_t size;
|
2012-05-25 01:05:12 +04:00
|
|
|
UINT32 cPackages;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecPkgInfoA* pPackageInfo;
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-05-06 06:39:00 +04:00
|
|
|
cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-02-28 19:01:47 +04:00
|
|
|
for (index = 0; index < (int) cPackages; index++)
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
if (strcmp(pszPackageName, SecPkgInfoA_LIST[index]->Name) == 0)
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
2012-03-24 23:47:16 +04:00
|
|
|
size = sizeof(SecPkgInfoA);
|
|
|
|
pPackageInfo = (SecPkgInfoA*) sspi_ContextBufferAlloc(QuerySecurityPackageInfoIndex, size);
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
pPackageInfo->fCapabilities = SecPkgInfoA_LIST[index]->fCapabilities;
|
|
|
|
pPackageInfo->wVersion = SecPkgInfoA_LIST[index]->wVersion;
|
|
|
|
pPackageInfo->wRPCID = SecPkgInfoA_LIST[index]->wRPCID;
|
|
|
|
pPackageInfo->cbMaxToken = SecPkgInfoA_LIST[index]->cbMaxToken;
|
2012-05-06 06:39:00 +04:00
|
|
|
pPackageInfo->Name = _strdup(SecPkgInfoA_LIST[index]->Name);
|
|
|
|
pPackageInfo->Comment = _strdup(SecPkgInfoA_LIST[index]->Comment);
|
2012-02-23 08:41:22 +04:00
|
|
|
|
|
|
|
*(ppPackageInfo) = pPackageInfo;
|
|
|
|
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*(ppPackageInfo) = NULL;
|
|
|
|
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
2012-02-21 01:17:57 +04:00
|
|
|
}
|
|
|
|
|
2012-02-25 00:35:48 +04:00
|
|
|
void FreeContextBuffer_QuerySecurityPackageInfo(void* contextBuffer)
|
2012-02-25 00:00:49 +04:00
|
|
|
{
|
2012-03-16 04:37:38 +04:00
|
|
|
SecPkgInfo* pPackageInfo = (SecPkgInfo*) contextBuffer;
|
2012-02-25 00:35:48 +04:00
|
|
|
|
2012-02-25 00:00:49 +04:00
|
|
|
if (pPackageInfo->Name)
|
2012-05-06 05:33:19 +04:00
|
|
|
free(pPackageInfo->Name);
|
2012-02-25 00:00:49 +04:00
|
|
|
|
|
|
|
if (pPackageInfo->Comment)
|
2012-05-06 05:33:19 +04:00
|
|
|
free(pPackageInfo->Comment);
|
2012-02-25 00:00:49 +04:00
|
|
|
|
2012-05-06 05:33:19 +04:00
|
|
|
free(pPackageInfo);
|
2012-02-25 00:00:49 +04:00
|
|
|
}
|
|
|
|
|
2012-02-21 02:04:45 +04:00
|
|
|
/* Credential Management */
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(SEC_WCHAR* pszPrincipal, SEC_WCHAR* pszPackage,
|
2012-08-23 06:38:27 +04:00
|
|
|
ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
2012-03-24 23:47:16 +04:00
|
|
|
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
|
|
|
{
|
2012-03-25 00:23:14 +04:00
|
|
|
SECURITY_STATUS status;
|
2012-07-27 02:35:39 +04:00
|
|
|
SecurityFunctionTableW* table = sspi_GetSecurityFunctionTableWByNameW(pszPackage);
|
2012-03-25 00:23:14 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->AcquireCredentialsHandleW == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->AcquireCredentialsHandleW(pszPrincipal, pszPackage, fCredentialUse,
|
|
|
|
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry);
|
|
|
|
|
|
|
|
return status;
|
2012-03-24 23:47:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage,
|
2012-08-23 06:38:27 +04:00
|
|
|
ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
2012-03-24 09:01:28 +04:00
|
|
|
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-02-23 08:41:22 +04:00
|
|
|
SECURITY_STATUS status;
|
2012-07-27 02:35:39 +04:00
|
|
|
SecurityFunctionTableA* table = sspi_GetSecurityFunctionTableAByNameA(pszPackage);
|
2012-02-23 08:41:22 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
if (table->AcquireCredentialsHandleA == NULL)
|
2012-02-23 08:41:22 +04:00
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
status = table->AcquireCredentialsHandleA(pszPrincipal, pszPackage, fCredentialUse,
|
2012-02-23 08:41:22 +04:00
|
|
|
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-08-23 06:24:29 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY ExportSecurityContext(PCtxtHandle phContext, ULONG fFlags, PSecBuffer pPackedContext, HANDLE* pToken)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(PCredHandle phCredential)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-02-25 00:00:49 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-02-25 00:00:49 +04:00
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phCredential);
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-02-25 00:00:49 +04:00
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-02-25 00:00:49 +04:00
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-02-27 08:41:59 +04:00
|
|
|
if (table->FreeCredentialsHandle == NULL)
|
2012-02-25 00:00:49 +04:00
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->FreeCredentialsHandle(phCredential);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-08-23 06:24:29 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR* pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-23 06:24:29 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR* pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
SEC_WCHAR* Name;
|
|
|
|
SECURITY_STATUS status;
|
|
|
|
SecurityFunctionTableW* table;
|
|
|
|
|
|
|
|
Name = (SEC_WCHAR*) sspi_SecureHandleGetUpperPointer(phCredential);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableWByNameW(Name);
|
2012-03-24 23:47:16 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->QueryCredentialsAttributesW == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->QueryCredentialsAttributesW(phCredential, ulAttribute, pBuffer);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
2012-02-24 00:56:50 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-24 00:56:50 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phCredential);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-24 00:56:50 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
if (table->QueryCredentialsAttributesA == NULL)
|
2012-02-27 08:41:59 +04:00
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
status = table->QueryCredentialsAttributesA(phCredential, ulAttribute, pBuffer);
|
2012-02-24 00:56:50 +04:00
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:33:21 +04:00
|
|
|
}
|
|
|
|
|
2012-02-21 02:04:45 +04:00
|
|
|
/* Context Management */
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
|
2012-05-22 04:39:45 +04:00
|
|
|
PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-03-05 06:56:41 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-03-05 06:56:41 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phCredential);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-03-05 06:56:41 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->AcceptSecurityContext == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->AcceptSecurityContext(phCredential, phContext, pInput, fContextReq,
|
|
|
|
TargetDataRep, phNewContext, pOutput, pfContextAttr, ptsTimeStamp);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext, PSecBufferDesc pInput)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext, PSecBufferDesc pToken)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
2012-03-16 21:12:49 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-03-16 21:12:49 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-03-16 21:12:49 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->DeleteSecurityContext == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->DeleteSecurityContext(phContext);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:33:21 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY FreeContextBuffer(void* pvContextBuffer)
|
2012-02-21 01:17:57 +04:00
|
|
|
{
|
2012-02-25 00:00:49 +04:00
|
|
|
if (!pvContextBuffer)
|
|
|
|
return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
sspi_ContextBufferFree(pvContextBuffer);
|
2012-02-21 01:17:57 +04:00
|
|
|
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
2012-02-21 02:04:45 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(PCtxtHandle phContext)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext,
|
2012-05-22 04:39:45 +04:00
|
|
|
SEC_WCHAR* pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
|
|
|
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-03-25 00:23:14 +04:00
|
|
|
SEC_CHAR* Name;
|
|
|
|
SECURITY_STATUS status;
|
|
|
|
SecurityFunctionTableW* table;
|
|
|
|
|
|
|
|
Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phCredential);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableWByNameA(Name);
|
2012-03-25 00:23:14 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->InitializeSecurityContextW == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->InitializeSecurityContextW(phCredential, phContext,
|
|
|
|
pszTargetName, fContextReq, Reserved1, TargetDataRep,
|
|
|
|
pInput, Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
|
|
|
|
|
|
|
return status;
|
2012-03-24 23:47:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext,
|
2012-05-22 04:39:45 +04:00
|
|
|
SEC_CHAR* pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
|
|
|
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
SEC_CHAR* Name;
|
2012-02-24 00:56:50 +04:00
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phCredential);
|
2012-02-24 00:56:50 +04:00
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-24 00:56:50 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
if (table->InitializeSecurityContextA == NULL)
|
2012-02-27 08:41:59 +04:00
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
status = table->InitializeSecurityContextA(phCredential, phContext,
|
2012-02-24 00:56:50 +04:00
|
|
|
pszTargetName, fContextReq, Reserved1, TargetDataRep,
|
|
|
|
pInput, Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-03-25 00:23:14 +04:00
|
|
|
SEC_CHAR* Name;
|
2012-02-27 08:41:59 +04:00
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableW* table;
|
2012-02-27 08:41:59 +04:00
|
|
|
|
2012-03-25 00:23:14 +04:00
|
|
|
Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phContext);
|
2012-03-24 23:47:16 +04:00
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableWByNameA(Name);
|
2012-03-24 23:47:16 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->QueryContextAttributesW == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->QueryContextAttributesW(phContext, ulAttribute, pBuffer);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer)
|
2012-03-24 23:47:16 +04:00
|
|
|
{
|
|
|
|
SEC_CHAR* Name;
|
|
|
|
SECURITY_STATUS status;
|
|
|
|
SecurityFunctionTableA* table;
|
|
|
|
|
|
|
|
Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phContext);
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
if (table->QueryContextAttributesA == NULL)
|
2012-02-27 08:41:59 +04:00
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
status = table->QueryContextAttributesA(phContext, ulAttribute, pBuffer);
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-08-23 06:24:29 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(PCtxtHandle phContext, HANDLE* phToken)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY SetContextAttributes(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY RevertSecurityContext(PCtxtHandle phContext)
|
2012-02-21 02:33:21 +04:00
|
|
|
{
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2012-02-21 02:04:45 +04:00
|
|
|
/* Message Support */
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-02-27 07:08:43 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-27 07:08:43 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-27 07:08:43 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-02-27 08:41:59 +04:00
|
|
|
if (table->DecryptMessage == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
2012-02-27 07:08:43 +04:00
|
|
|
status = table->DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-02-27 05:07:42 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-27 05:07:42 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-27 05:07:42 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-02-27 08:41:59 +04:00
|
|
|
if (table->EncryptMessage == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
2012-02-27 05:07:42 +04:00
|
|
|
status = table->EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-02-27 08:41:59 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->MakeSignature == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->MakeSignature(phContext, fQOP, pMessage, MessageSeqNo);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
|
|
|
|
2012-05-22 04:39:45 +04:00
|
|
|
SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
|
2012-02-21 02:04:45 +04:00
|
|
|
{
|
2012-02-27 08:41:59 +04:00
|
|
|
char* Name;
|
|
|
|
SECURITY_STATUS status;
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA* table;
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);
|
|
|
|
|
|
|
|
if (!Name)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
2012-07-27 02:35:39 +04:00
|
|
|
table = sspi_GetSecurityFunctionTableAByNameA(Name);
|
2012-02-27 08:41:59 +04:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return SEC_E_SECPKG_NOT_FOUND;
|
|
|
|
|
|
|
|
if (table->VerifySignature == NULL)
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
|
|
|
|
status = table->VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP);
|
|
|
|
|
|
|
|
return status;
|
2012-02-21 02:04:45 +04:00
|
|
|
}
|
2012-02-23 08:41:22 +04:00
|
|
|
|
2012-03-24 23:47:16 +04:00
|
|
|
SecurityFunctionTableA SSPI_SecurityFunctionTableA =
|
2012-02-23 08:41:22 +04:00
|
|
|
{
|
|
|
|
1, /* dwVersion */
|
2012-03-24 23:47:16 +04:00
|
|
|
EnumerateSecurityPackagesA, /* EnumerateSecurityPackages */
|
|
|
|
QueryCredentialsAttributesA, /* QueryCredentialsAttributes */
|
|
|
|
AcquireCredentialsHandleA, /* AcquireCredentialsHandle */
|
2012-02-23 08:41:22 +04:00
|
|
|
FreeCredentialsHandle, /* FreeCredentialsHandle */
|
|
|
|
NULL, /* Reserved2 */
|
2012-03-24 09:01:28 +04:00
|
|
|
InitializeSecurityContextA, /* InitializeSecurityContext */
|
2012-02-23 08:41:22 +04:00
|
|
|
AcceptSecurityContext, /* AcceptSecurityContext */
|
|
|
|
CompleteAuthToken, /* CompleteAuthToken */
|
|
|
|
DeleteSecurityContext, /* DeleteSecurityContext */
|
|
|
|
ApplyControlToken, /* ApplyControlToken */
|
2012-08-11 02:05:37 +04:00
|
|
|
QueryContextAttributesA, /* QueryContextAttributes */
|
2012-02-23 08:41:22 +04:00
|
|
|
ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
|
|
|
RevertSecurityContext, /* RevertSecurityContext */
|
|
|
|
MakeSignature, /* MakeSignature */
|
|
|
|
VerifySignature, /* VerifySignature */
|
|
|
|
FreeContextBuffer, /* FreeContextBuffer */
|
2012-03-24 09:01:28 +04:00
|
|
|
QuerySecurityPackageInfoA, /* QuerySecurityPackageInfo */
|
2012-02-23 08:41:22 +04:00
|
|
|
NULL, /* Reserved3 */
|
|
|
|
NULL, /* Reserved4 */
|
2012-03-24 23:47:16 +04:00
|
|
|
ExportSecurityContext, /* ExportSecurityContext */
|
|
|
|
ImportSecurityContextA, /* ImportSecurityContext */
|
|
|
|
NULL, /* AddCredentials */
|
|
|
|
NULL, /* Reserved8 */
|
|
|
|
QuerySecurityContextToken, /* QuerySecurityContextToken */
|
|
|
|
EncryptMessage, /* EncryptMessage */
|
|
|
|
DecryptMessage, /* DecryptMessage */
|
|
|
|
SetContextAttributes, /* 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 */
|
2012-08-11 02:05:37 +04:00
|
|
|
QueryContextAttributesW, /* QueryContextAttributes */
|
2012-03-24 23:47:16 +04:00
|
|
|
ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
|
|
|
RevertSecurityContext, /* RevertSecurityContext */
|
|
|
|
MakeSignature, /* MakeSignature */
|
|
|
|
VerifySignature, /* VerifySignature */
|
|
|
|
FreeContextBuffer, /* FreeContextBuffer */
|
|
|
|
QuerySecurityPackageInfoW, /* QuerySecurityPackageInfo */
|
|
|
|
NULL, /* Reserved3 */
|
|
|
|
NULL, /* Reserved4 */
|
|
|
|
ExportSecurityContext, /* ExportSecurityContext */
|
|
|
|
ImportSecurityContextW, /* ImportSecurityContext */
|
2012-02-23 08:41:22 +04:00
|
|
|
NULL, /* AddCredentials */
|
|
|
|
NULL, /* Reserved8 */
|
|
|
|
QuerySecurityContextToken, /* QuerySecurityContextToken */
|
|
|
|
EncryptMessage, /* EncryptMessage */
|
|
|
|
DecryptMessage, /* DecryptMessage */
|
|
|
|
SetContextAttributes, /* SetContextAttributes */
|
|
|
|
};
|
2012-03-24 02:53:10 +04:00
|
|
|
|
|
|
|
#endif
|