2005-08-15 22:52:18 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Kai Blin
|
2012-05-10 13:06:20 +02:00
|
|
|
* Copyright 2012 Hans Leidekker for CodeWeavers
|
2005-08-15 22:52:18 +02:00
|
|
|
*
|
|
|
|
* 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
|
2005-08-15 22:52:18 +02:00
|
|
|
*/
|
2012-05-10 13:06:20 +02:00
|
|
|
|
2005-08-15 22:52:18 +02:00
|
|
|
#include <stdarg.h>
|
2021-05-07 11:54:44 +02:00
|
|
|
#include <stdlib.h>
|
2005-08-15 22:52:18 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "sspi.h"
|
2012-05-10 13:06:20 +02:00
|
|
|
#include "rpc.h"
|
|
|
|
#include "wincred.h"
|
|
|
|
|
2005-08-15 22:52:18 +02:00
|
|
|
#include "wine/debug.h"
|
2021-05-07 11:54:42 +02:00
|
|
|
#include "secur32_priv.h"
|
2005-08-15 22:52:18 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(secur32);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QueryCredentialsAttributesA
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_QueryCredentialsAttributesA(
|
2012-05-10 13:06:20 +02:00
|
|
|
PCredHandle phCredential, ULONG ulAttribute, PVOID pBuffer)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2012-05-10 13:06:20 +02:00
|
|
|
FIXME("%p, %u, %p\n", phCredential, ulAttribute, pBuffer);
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QueryCredentialsAttributesW
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_QueryCredentialsAttributesW(
|
2012-05-10 13:06:20 +02:00
|
|
|
PCredHandle phCredential, ULONG ulAttribute, PVOID pBuffer)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2012-05-10 13:06:20 +02:00
|
|
|
FIXME("%p, %u, %p\n", phCredential, ulAttribute, pBuffer);
|
|
|
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
struct sec_handle
|
|
|
|
{
|
|
|
|
SecureProvider *krb;
|
|
|
|
SecureProvider *ntlm;
|
|
|
|
SecHandle handle_krb;
|
|
|
|
SecHandle handle_ntlm;
|
|
|
|
};
|
|
|
|
|
2021-05-07 11:54:39 +02:00
|
|
|
#define WINE_NO_CACHED_CREDENTIALS 0x10000000
|
2021-04-30 16:42:21 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* AcquireCredentialsHandleW
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleW(
|
|
|
|
SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
|
|
|
|
PLUID pLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
|
|
|
PVOID pGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry )
|
|
|
|
{
|
|
|
|
static SEC_WCHAR ntlmW[] = {'N','T','L','M',0};
|
2018-02-14 14:13:08 +01:00
|
|
|
static SEC_WCHAR kerberosW[] = {'K','e','r','b','e','r','o','s',0};
|
|
|
|
SECURITY_STATUS ret = SEC_E_NO_CREDENTIALS;
|
|
|
|
struct sec_handle *cred;
|
|
|
|
SecurePackage *package;
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%s, %s, 0x%08x, %p, %p, %p, %p, %p, %p\n",
|
|
|
|
debugstr_w(pszPrincipal), debugstr_w(pszPackage), fCredentialUse,
|
|
|
|
pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!pszPackage) return SEC_E_SECPKG_NOT_FOUND;
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(cred = calloc( 1, sizeof(*cred) ))) return SEC_E_INSUFFICIENT_MEMORY;
|
2018-02-14 14:13:08 +01:00
|
|
|
|
|
|
|
if ((package = SECUR32_findPackageW( kerberosW )))
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
ret = package->provider->fnTableW.AcquireCredentialsHandleW( pszPrincipal, kerberosW,
|
|
|
|
fCredentialUse, pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, &cred->handle_krb, ptsExpiry );
|
|
|
|
if (ret == SEC_E_OK) cred->krb = package->provider;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
2018-02-14 14:13:08 +01:00
|
|
|
|
|
|
|
if ((package = SECUR32_findPackageW( ntlmW )))
|
|
|
|
{
|
2021-05-07 11:54:39 +02:00
|
|
|
ULONG cred_use = pAuthData ? fCredentialUse : fCredentialUse | WINE_NO_CACHED_CREDENTIALS;
|
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
ret = package->provider->fnTableW.AcquireCredentialsHandleW( pszPrincipal, ntlmW,
|
2021-05-07 11:54:39 +02:00
|
|
|
cred_use, pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, &cred->handle_ntlm, ptsExpiry );
|
|
|
|
if (ret == SEC_E_OK) cred->ntlm = package->provider;
|
2018-02-14 14:13:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cred->krb || cred->ntlm)
|
|
|
|
{
|
|
|
|
phCredential->dwLower = (ULONG_PTR)cred;
|
|
|
|
phCredential->dwUpper = 0;
|
|
|
|
return SEC_E_OK;
|
|
|
|
}
|
|
|
|
|
2021-05-07 11:54:44 +02:00
|
|
|
free( cred );
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* AcquireCredentialsHandleA
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA(
|
2012-05-10 13:06:20 +02:00
|
|
|
SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
|
|
|
|
PLUID pLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
|
|
|
PVOID pGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry )
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2012-05-10 13:06:20 +02:00
|
|
|
SECURITY_STATUS ret = SEC_E_INSUFFICIENT_MEMORY;
|
|
|
|
SEC_WCHAR *user = NULL, *domain = NULL, *passwd = NULL, *package = NULL;
|
|
|
|
SEC_WINNT_AUTH_IDENTITY_W *identityW = NULL;
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%s, %s, 0x%08x, %p, %p, %p, %p, %p, %p\n",
|
|
|
|
debugstr_a(pszPrincipal), debugstr_a(pszPackage), fCredentialUse,
|
|
|
|
pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
if (pszPackage)
|
|
|
|
{
|
|
|
|
int package_len = MultiByteToWideChar( CP_ACP, 0, pszPackage, -1, NULL, 0 );
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(package = malloc( package_len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY;
|
2012-05-10 13:06:20 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, pszPackage, -1, package, package_len );
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
2012-05-10 13:06:20 +02:00
|
|
|
if (pAuthData)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2012-05-10 13:06:20 +02:00
|
|
|
SEC_WINNT_AUTH_IDENTITY_A *identity = pAuthData;
|
|
|
|
int user_len, domain_len, passwd_len;
|
|
|
|
|
|
|
|
if (identity->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI)
|
|
|
|
{
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(identityW = malloc( sizeof(*identityW) ))) goto done;
|
2012-05-10 13:06:20 +02:00
|
|
|
|
|
|
|
if (!identity->UserLength) user_len = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
user_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->User,
|
|
|
|
identity->UserLength, NULL, 0 );
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(user = malloc( user_len * sizeof(SEC_WCHAR) ))) goto done;
|
2012-05-10 13:06:20 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->User, identity->UserLength,
|
|
|
|
user, user_len );
|
|
|
|
}
|
|
|
|
if (!identity->DomainLength) domain_len = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
domain_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Domain,
|
|
|
|
identity->DomainLength, NULL, 0 );
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(domain = malloc( domain_len * sizeof(SEC_WCHAR) ))) goto done;
|
2012-05-10 13:06:20 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Domain, identity->DomainLength,
|
|
|
|
domain, domain_len );
|
|
|
|
}
|
|
|
|
if (!identity->PasswordLength) passwd_len = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
passwd_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Password,
|
|
|
|
identity->PasswordLength, NULL, 0 );
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(passwd = malloc( passwd_len * sizeof(SEC_WCHAR) ))) goto done;
|
2012-05-10 13:06:20 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Password, identity->PasswordLength,
|
|
|
|
passwd, passwd_len );
|
|
|
|
}
|
|
|
|
identityW->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
|
|
|
identityW->User = user;
|
|
|
|
identityW->UserLength = user_len;
|
|
|
|
identityW->Domain = domain;
|
|
|
|
identityW->DomainLength = domain_len;
|
|
|
|
identityW->Password = passwd;
|
|
|
|
identityW->PasswordLength = passwd_len;
|
|
|
|
}
|
|
|
|
else identityW = (SEC_WINNT_AUTH_IDENTITY_W *)identity;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
2012-05-10 13:06:20 +02:00
|
|
|
ret = nego_AcquireCredentialsHandleW( NULL, package, fCredentialUse, pLogonID, identityW,
|
|
|
|
pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry );
|
|
|
|
done:
|
2021-05-07 11:54:44 +02:00
|
|
|
free( package );
|
|
|
|
free( user );
|
|
|
|
free( domain );
|
|
|
|
free( passwd );
|
|
|
|
free( identityW );
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InitializeSecurityContextW
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextW(
|
2012-05-10 13:06:20 +02:00
|
|
|
PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName,
|
|
|
|
ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
|
|
|
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry )
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *handle = NULL, *ctxt, *new_ctxt = NULL, *cred = NULL;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, %p, %s, 0x%08x, %u, %u, %p, %u, %p, %p, %p, %p\n",
|
|
|
|
phCredential, phContext, debugstr_w(pszTargetName), fContextReq,
|
|
|
|
Reserved1, TargetDataRep, pInput, Reserved1, phNewContext, pOutput,
|
|
|
|
pfContextAttr, ptsExpiry);
|
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
handle = ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
}
|
|
|
|
else if (phCredential)
|
|
|
|
{
|
|
|
|
handle = cred = (struct sec_handle *)phCredential->dwLower;
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(new_ctxt = ctxt = calloc( 1, sizeof(*ctxt) ))) return SEC_E_INSUFFICIENT_MEMORY;
|
2018-02-14 14:13:08 +01:00
|
|
|
ctxt->krb = cred->krb;
|
|
|
|
ctxt->ntlm = cred->ntlm;
|
|
|
|
}
|
|
|
|
if (!handle) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
if (handle->krb)
|
|
|
|
{
|
|
|
|
ret = handle->krb->fnTableW.InitializeSecurityContextW( phCredential ? &cred->handle_krb : NULL,
|
|
|
|
phContext ? &ctxt->handle_krb : NULL, pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
|
|
|
|
Reserved2, phNewContext ? &ctxt->handle_krb : NULL, pOutput, pfContextAttr, ptsExpiry );
|
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
{
|
|
|
|
ctxt->ntlm = NULL;
|
|
|
|
phNewContext->dwLower = (ULONG_PTR)ctxt;
|
|
|
|
phNewContext->dwUpper = 0;
|
|
|
|
if (new_ctxt == ctxt) new_ctxt = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret != SEC_E_OK && ret != SEC_I_CONTINUE_NEEDED && handle->ntlm)
|
|
|
|
{
|
|
|
|
ret = handle->ntlm->fnTableW.InitializeSecurityContextW( phCredential ? &cred->handle_ntlm : NULL,
|
|
|
|
phContext ? &ctxt->handle_ntlm : NULL, pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
|
|
|
|
Reserved2, phNewContext ? &ctxt->handle_ntlm : NULL, pOutput, pfContextAttr, ptsExpiry );
|
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
{
|
|
|
|
ctxt->krb = NULL;
|
|
|
|
phNewContext->dwLower = (ULONG_PTR)ctxt;
|
|
|
|
phNewContext->dwUpper = 0;
|
|
|
|
if (new_ctxt == ctxt) new_ctxt = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-07 11:54:44 +02:00
|
|
|
free( new_ctxt );
|
2018-02-14 14:13:08 +01:00
|
|
|
return ret;
|
2012-05-10 13:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InitializeSecurityContextA
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextA(
|
|
|
|
PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName,
|
|
|
|
ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
|
|
|
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry )
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
|
|
|
SECURITY_STATUS ret;
|
2012-05-10 13:06:20 +02:00
|
|
|
SEC_WCHAR *target = NULL;
|
|
|
|
|
|
|
|
TRACE("%p, %p, %s, 0x%08x, %u, %u, %p, %u, %p, %p, %p, %p\n",
|
|
|
|
phCredential, phContext, debugstr_a(pszTargetName), fContextReq,
|
|
|
|
Reserved1, TargetDataRep, pInput, Reserved1, phNewContext, pOutput,
|
|
|
|
pfContextAttr, ptsExpiry);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
if (pszTargetName)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2012-05-10 13:06:20 +02:00
|
|
|
int target_len = MultiByteToWideChar( CP_ACP, 0, pszTargetName, -1, NULL, 0 );
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(target = malloc( target_len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY;
|
2012-05-10 13:06:20 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, pszTargetName, -1, target, target_len );
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
2012-05-10 13:06:20 +02:00
|
|
|
ret = nego_InitializeSecurityContextW( phCredential, phContext, target, fContextReq,
|
|
|
|
Reserved1, TargetDataRep, pInput, Reserved2,
|
|
|
|
phNewContext, pOutput, pfContextAttr, ptsExpiry );
|
2021-05-07 11:54:44 +02:00
|
|
|
free( target );
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* AcceptSecurityContext
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_AcceptSecurityContext(
|
2012-05-10 13:06:20 +02:00
|
|
|
PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput,
|
|
|
|
ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
|
|
|
|
PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *handle = NULL, *ctxt, *new_ctxt = NULL, *cred = NULL;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, %p, %p, 0x%08x, %u, %p, %p, %p, %p\n", phCredential, phContext,
|
|
|
|
pInput, fContextReq, TargetDataRep, phNewContext, pOutput, pfContextAttr,
|
|
|
|
ptsExpiry);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (phContext)
|
|
|
|
{
|
|
|
|
handle = ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
}
|
|
|
|
else if (phCredential)
|
|
|
|
{
|
|
|
|
handle = cred = (struct sec_handle *)phCredential->dwLower;
|
2021-05-07 11:54:44 +02:00
|
|
|
if (!(new_ctxt = ctxt = calloc( 1, sizeof(*ctxt) ))) return SEC_E_INSUFFICIENT_MEMORY;
|
2018-02-14 14:13:08 +01:00
|
|
|
ctxt->krb = cred->krb;
|
|
|
|
ctxt->ntlm = cred->ntlm;
|
|
|
|
}
|
|
|
|
if (!handle) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
if (handle->krb)
|
|
|
|
{
|
|
|
|
ret = handle->krb->fnTableW.AcceptSecurityContext( phCredential ? &cred->handle_krb : NULL,
|
|
|
|
phContext ? &ctxt->handle_krb : NULL, pInput, fContextReq, TargetDataRep,
|
|
|
|
phNewContext ? &ctxt->handle_krb : NULL, pOutput, pfContextAttr, ptsExpiry );
|
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
{
|
|
|
|
ctxt->ntlm = NULL;
|
|
|
|
phNewContext->dwLower = (ULONG_PTR)ctxt;
|
|
|
|
phNewContext->dwUpper = 0;
|
|
|
|
if (new_ctxt == ctxt) new_ctxt = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret != SEC_E_OK && ret != SEC_I_CONTINUE_NEEDED && handle->ntlm)
|
|
|
|
{
|
|
|
|
ret = handle->ntlm->fnTableW.AcceptSecurityContext( phCredential ? &cred->handle_ntlm : NULL,
|
|
|
|
phContext ? &ctxt->handle_ntlm : NULL, pInput, fContextReq, TargetDataRep,
|
|
|
|
phNewContext ? &ctxt->handle_ntlm : NULL, pOutput, pfContextAttr, ptsExpiry );
|
|
|
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
|
|
|
{
|
|
|
|
ctxt->krb = NULL;
|
|
|
|
phNewContext->dwLower = (ULONG_PTR)ctxt;
|
|
|
|
phNewContext->dwUpper = 0;
|
|
|
|
if (new_ctxt == ctxt) new_ctxt = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-07 11:54:44 +02:00
|
|
|
free( new_ctxt );
|
2018-02-14 14:13:08 +01:00
|
|
|
return ret;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CompleteAuthToken
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_CompleteAuthToken(PCtxtHandle phContext,
|
|
|
|
PSecBufferDesc pToken)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
2005-08-15 22:52:18 +02:00
|
|
|
|
|
|
|
TRACE("%p %p\n", phContext, pToken);
|
2018-02-14 14:13:08 +01:00
|
|
|
|
|
|
|
if (phContext) ret = SEC_E_UNSUPPORTED_FUNCTION;
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DeleteSecurityContext
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_DeleteSecurityContext(PCtxtHandle phContext)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2005-08-15 22:52:18 +02:00
|
|
|
TRACE("%p\n", phContext);
|
2012-05-10 13:06:20 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
|
|
|
{
|
|
|
|
ret = ctxt->krb->fnTableW.DeleteSecurityContext( &ctxt->handle_krb );
|
|
|
|
}
|
|
|
|
else if (ctxt->ntlm)
|
|
|
|
{
|
|
|
|
ret = ctxt->ntlm->fnTableW.DeleteSecurityContext( &ctxt->handle_ntlm );
|
|
|
|
}
|
|
|
|
TRACE( "freeing %p\n", ctxt );
|
2021-05-07 11:54:44 +02:00
|
|
|
free( ctxt );
|
2018-02-14 14:13:08 +01:00
|
|
|
return ret;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* ApplyControlToken
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_ApplyControlToken(PCtxtHandle phContext,
|
|
|
|
PSecBufferDesc pInput)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
2005-08-15 22:52:18 +02:00
|
|
|
|
|
|
|
TRACE("%p %p\n", phContext, pInput);
|
2018-02-14 14:13:08 +01:00
|
|
|
|
|
|
|
if (phContext) ret = SEC_E_UNSUPPORTED_FUNCTION;
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QueryContextAttributesW
|
|
|
|
*/
|
2012-05-10 13:06:20 +02:00
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_QueryContextAttributesW(
|
|
|
|
PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, %u, %p\n", phContext, ulAttribute, pBuffer);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
2012-05-10 13:06:20 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
ret = ctxt->krb->fnTableW.QueryContextAttributesW( &ctxt->handle_krb, ulAttribute, pBuffer );
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
2018-02-14 14:13:08 +01:00
|
|
|
else if (ctxt->ntlm)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
ret = ctxt->ntlm->fnTableW.QueryContextAttributesW( &ctxt->handle_ntlm, ulAttribute, pBuffer );
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
2018-02-14 14:13:08 +01:00
|
|
|
return ret;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QueryContextAttributesA
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_QueryContextAttributesA(PCtxtHandle phContext,
|
2018-02-14 14:13:08 +01:00
|
|
|
ULONG ulAttribute, void *pBuffer)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, %u, %p\n", phContext, ulAttribute, pBuffer);
|
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
2012-05-10 13:06:20 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
ret = ctxt->krb->fnTableA.QueryContextAttributesA( &ctxt->handle_krb, ulAttribute, pBuffer );
|
2012-05-10 13:06:20 +02:00
|
|
|
}
|
2018-02-14 14:13:08 +01:00
|
|
|
else if (ctxt->ntlm)
|
2012-05-10 13:06:20 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
ret = ctxt->ntlm->fnTableA.QueryContextAttributesA( &ctxt->handle_ntlm, ulAttribute, pBuffer );
|
2012-05-10 13:06:20 +02:00
|
|
|
}
|
2018-02-14 14:13:08 +01:00
|
|
|
return ret;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* ImpersonateSecurityContext
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_ImpersonateSecurityContext(PCtxtHandle phContext)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
2005-08-15 22:52:18 +02:00
|
|
|
|
|
|
|
TRACE("%p\n", phContext);
|
2018-02-14 14:13:08 +01:00
|
|
|
|
|
|
|
if (phContext) ret = SEC_E_UNSUPPORTED_FUNCTION;
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RevertSecurityContext
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_RevertSecurityContext(PCtxtHandle phContext)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
2005-08-15 22:52:18 +02:00
|
|
|
|
|
|
|
TRACE("%p\n", phContext);
|
2018-02-14 14:13:08 +01:00
|
|
|
|
|
|
|
if (phContext) ret = SEC_E_UNSUPPORTED_FUNCTION;
|
2005-08-15 22:52:18 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MakeSignature
|
|
|
|
*/
|
2012-05-10 13:06:20 +02:00
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_MakeSignature(PCtxtHandle phContext,
|
|
|
|
ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, 0x%08x, %p, %u\n", phContext, fQOP, pMessage, MessageSeqNo);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
|
|
|
{
|
|
|
|
ret = ctxt->krb->fnTableW.MakeSignature( &ctxt->handle_krb, fQOP, pMessage, MessageSeqNo );
|
|
|
|
}
|
|
|
|
else if (ctxt->ntlm)
|
|
|
|
{
|
|
|
|
ret = ctxt->ntlm->fnTableW.MakeSignature( &ctxt->handle_ntlm, fQOP, pMessage, MessageSeqNo );
|
|
|
|
}
|
|
|
|
return ret;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* VerifySignature
|
|
|
|
*/
|
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_VerifySignature(PCtxtHandle phContext,
|
2012-05-10 13:06:20 +02:00
|
|
|
PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
|
2005-08-15 22:52:18 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, %p, %u, %p\n", phContext, pMessage, MessageSeqNo, pfQOP);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
|
|
|
{
|
|
|
|
ret = ctxt->krb->fnTableW.VerifySignature( &ctxt->handle_krb, pMessage, MessageSeqNo, pfQOP );
|
|
|
|
}
|
|
|
|
else if (ctxt->ntlm)
|
|
|
|
{
|
|
|
|
ret = ctxt->ntlm->fnTableW.VerifySignature( &ctxt->handle_ntlm, pMessage, MessageSeqNo, pfQOP );
|
|
|
|
}
|
|
|
|
return ret;
|
2012-05-10 13:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* FreeCredentialsHandle
|
|
|
|
*/
|
2012-05-20 17:51:53 +02:00
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_FreeCredentialsHandle(PCredHandle phCredential)
|
2012-05-10 13:06:20 +02:00
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
struct sec_handle *cred;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p\n", phCredential);
|
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phCredential) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
cred = (struct sec_handle *)phCredential->dwLower;
|
|
|
|
if (cred->krb) cred->krb->fnTableW.FreeCredentialsHandle( &cred->handle_krb );
|
|
|
|
if (cred->ntlm) cred->ntlm->fnTableW.FreeCredentialsHandle( &cred->handle_ntlm );
|
|
|
|
|
2021-05-07 11:54:44 +02:00
|
|
|
free( cred );
|
2018-02-14 14:13:08 +01:00
|
|
|
return SEC_E_OK;
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* EncryptMessage
|
|
|
|
*/
|
2012-05-20 17:51:53 +02:00
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_EncryptMessage(PCtxtHandle phContext,
|
2012-05-10 13:06:20 +02:00
|
|
|
ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, 0x%08x, %p, %u\n", phContext, fQOP, pMessage, MessageSeqNo);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
|
|
|
{
|
|
|
|
ret = ctxt->krb->fnTableW.EncryptMessage( &ctxt->handle_krb, fQOP, pMessage, MessageSeqNo );
|
|
|
|
}
|
|
|
|
else if (ctxt->ntlm)
|
|
|
|
{
|
|
|
|
ret = ctxt->ntlm->fnTableW.EncryptMessage( &ctxt->handle_ntlm, fQOP, pMessage, MessageSeqNo );
|
|
|
|
}
|
|
|
|
return ret;
|
2012-05-10 13:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DecryptMessage
|
|
|
|
*/
|
2012-05-20 17:51:53 +02:00
|
|
|
static SECURITY_STATUS SEC_ENTRY nego_DecryptMessage(PCtxtHandle phContext,
|
2012-05-10 13:06:20 +02:00
|
|
|
PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
|
|
|
|
{
|
2018-02-14 14:13:08 +01:00
|
|
|
SECURITY_STATUS ret = SEC_E_INVALID_HANDLE;
|
|
|
|
struct sec_handle *ctxt;
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
TRACE("%p, %p, %u, %p\n", phContext, pMessage, MessageSeqNo, pfQOP);
|
|
|
|
|
2018-02-14 14:13:08 +01:00
|
|
|
if (!phContext) return SEC_E_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ctxt = (struct sec_handle *)phContext->dwLower;
|
|
|
|
if (ctxt->krb)
|
|
|
|
{
|
|
|
|
ret = ctxt->krb->fnTableW.DecryptMessage( &ctxt->handle_krb, pMessage, MessageSeqNo, pfQOP );
|
|
|
|
}
|
|
|
|
else if (ctxt->ntlm)
|
|
|
|
{
|
|
|
|
ret = ctxt->ntlm->fnTableW.DecryptMessage( &ctxt->handle_ntlm, pMessage, MessageSeqNo, pfQOP );
|
|
|
|
}
|
|
|
|
return ret;
|
2012-05-10 13:06:20 +02:00
|
|
|
}
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2006-01-24 14:00:32 +01:00
|
|
|
static const SecurityFunctionTableA negoTableA = {
|
2005-08-15 22:52:18 +02:00
|
|
|
1,
|
2012-05-10 13:06:20 +02:00
|
|
|
NULL, /* EnumerateSecurityPackagesA */
|
2005-08-15 22:52:18 +02:00
|
|
|
nego_QueryCredentialsAttributesA, /* QueryCredentialsAttributesA */
|
|
|
|
nego_AcquireCredentialsHandleA, /* AcquireCredentialsHandleA */
|
2012-05-10 13:06:20 +02:00
|
|
|
nego_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
|
|
|
NULL, /* Reserved2 */
|
2005-08-15 22:52:18 +02:00
|
|
|
nego_InitializeSecurityContextA, /* InitializeSecurityContextA */
|
|
|
|
nego_AcceptSecurityContext, /* AcceptSecurityContext */
|
|
|
|
nego_CompleteAuthToken, /* CompleteAuthToken */
|
|
|
|
nego_DeleteSecurityContext, /* DeleteSecurityContext */
|
|
|
|
nego_ApplyControlToken, /* ApplyControlToken */
|
|
|
|
nego_QueryContextAttributesA, /* QueryContextAttributesA */
|
|
|
|
nego_ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
|
|
|
nego_RevertSecurityContext, /* RevertSecurityContext */
|
|
|
|
nego_MakeSignature, /* MakeSignature */
|
|
|
|
nego_VerifySignature, /* VerifySignature */
|
|
|
|
FreeContextBuffer, /* FreeContextBuffer */
|
|
|
|
NULL, /* QuerySecurityPackageInfoA */
|
|
|
|
NULL, /* Reserved3 */
|
|
|
|
NULL, /* Reserved4 */
|
|
|
|
NULL, /* ExportSecurityContext */
|
|
|
|
NULL, /* ImportSecurityContextA */
|
|
|
|
NULL, /* AddCredentialsA */
|
|
|
|
NULL, /* Reserved8 */
|
|
|
|
NULL, /* QuerySecurityContextToken */
|
2012-05-10 13:06:20 +02:00
|
|
|
nego_EncryptMessage, /* EncryptMessage */
|
|
|
|
nego_DecryptMessage, /* DecryptMessage */
|
2005-08-15 22:52:18 +02:00
|
|
|
NULL, /* SetContextAttributesA */
|
|
|
|
};
|
|
|
|
|
2006-01-24 14:00:32 +01:00
|
|
|
static const SecurityFunctionTableW negoTableW = {
|
2005-08-15 22:52:18 +02:00
|
|
|
1,
|
2012-05-10 13:06:20 +02:00
|
|
|
NULL, /* EnumerateSecurityPackagesW */
|
2005-08-15 22:52:18 +02:00
|
|
|
nego_QueryCredentialsAttributesW, /* QueryCredentialsAttributesW */
|
|
|
|
nego_AcquireCredentialsHandleW, /* AcquireCredentialsHandleW */
|
2012-05-10 13:06:20 +02:00
|
|
|
nego_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
|
|
|
NULL, /* Reserved2 */
|
2005-08-15 22:52:18 +02:00
|
|
|
nego_InitializeSecurityContextW, /* InitializeSecurityContextW */
|
|
|
|
nego_AcceptSecurityContext, /* AcceptSecurityContext */
|
|
|
|
nego_CompleteAuthToken, /* CompleteAuthToken */
|
|
|
|
nego_DeleteSecurityContext, /* DeleteSecurityContext */
|
|
|
|
nego_ApplyControlToken, /* ApplyControlToken */
|
|
|
|
nego_QueryContextAttributesW, /* QueryContextAttributesW */
|
|
|
|
nego_ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
|
|
|
nego_RevertSecurityContext, /* RevertSecurityContext */
|
|
|
|
nego_MakeSignature, /* MakeSignature */
|
|
|
|
nego_VerifySignature, /* VerifySignature */
|
|
|
|
FreeContextBuffer, /* FreeContextBuffer */
|
|
|
|
NULL, /* QuerySecurityPackageInfoW */
|
|
|
|
NULL, /* Reserved3 */
|
|
|
|
NULL, /* Reserved4 */
|
|
|
|
NULL, /* ExportSecurityContext */
|
|
|
|
NULL, /* ImportSecurityContextW */
|
|
|
|
NULL, /* AddCredentialsW */
|
|
|
|
NULL, /* Reserved8 */
|
|
|
|
NULL, /* QuerySecurityContextToken */
|
2012-05-10 13:06:20 +02:00
|
|
|
nego_EncryptMessage, /* EncryptMessage */
|
|
|
|
nego_DecryptMessage, /* DecryptMessage */
|
2005-08-15 22:52:18 +02:00
|
|
|
NULL, /* SetContextAttributesW */
|
|
|
|
};
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
#define NEGO_MAX_TOKEN 12000
|
|
|
|
|
|
|
|
static WCHAR nego_name_W[] = {'N','e','g','o','t','i','a','t','e',0};
|
|
|
|
static char nego_name_A[] = "Negotiate";
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
static WCHAR negotiate_comment_W[] =
|
|
|
|
{'M','i','c','r','o','s','o','f','t',' ','P','a','c','k','a','g','e',' ',
|
|
|
|
'N','e','g','o','t','i','a','t','o','r',0};
|
2005-08-15 22:52:18 +02:00
|
|
|
static CHAR negotiate_comment_A[] = "Microsoft Package Negotiator";
|
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
#define CAPS ( \
|
|
|
|
SECPKG_FLAG_INTEGRITY | \
|
|
|
|
SECPKG_FLAG_PRIVACY | \
|
|
|
|
SECPKG_FLAG_CONNECTION | \
|
|
|
|
SECPKG_FLAG_MULTI_REQUIRED | \
|
|
|
|
SECPKG_FLAG_EXTENDED_ERROR | \
|
|
|
|
SECPKG_FLAG_IMPERSONATION | \
|
|
|
|
SECPKG_FLAG_ACCEPT_WIN32_NAME | \
|
|
|
|
SECPKG_FLAG_NEGOTIABLE | \
|
|
|
|
SECPKG_FLAG_GSS_COMPATIBLE | \
|
|
|
|
SECPKG_FLAG_LOGON | \
|
|
|
|
SECPKG_FLAG_RESTRICTED_TOKENS )
|
2005-08-15 22:52:18 +02:00
|
|
|
|
|
|
|
void SECUR32_initNegotiateSP(void)
|
|
|
|
{
|
2012-05-10 13:06:20 +02:00
|
|
|
SecureProvider *provider = SECUR32_addProvider(&negoTableA, &negoTableW, NULL);
|
2005-08-15 22:52:18 +02:00
|
|
|
|
2012-05-10 13:06:20 +02:00
|
|
|
const SecPkgInfoW infoW = {CAPS, 1, RPC_C_AUTHN_GSS_NEGOTIATE, NEGO_MAX_TOKEN,
|
|
|
|
nego_name_W, negotiate_comment_W};
|
|
|
|
const SecPkgInfoA infoA = {CAPS, 1, RPC_C_AUTHN_GSS_NEGOTIATE, NEGO_MAX_TOKEN,
|
|
|
|
nego_name_A, negotiate_comment_A};
|
2009-12-29 16:36:18 +01:00
|
|
|
SECUR32_addPackages(provider, 1L, &infoA, &infoW);
|
2005-08-15 22:52:18 +02:00
|
|
|
}
|