libfreerdp-sspi: fix compilation on Linux
This commit is contained in:
parent
d1280c1bd1
commit
679d5b68c6
@ -31,13 +31,16 @@
|
|||||||
#define SECURITY_WIN32
|
#define SECURITY_WIN32
|
||||||
#include <sspi.h>
|
#include <sspi.h>
|
||||||
#pragma comment(lib, "secur32.lib")
|
#pragma comment(lib, "secur32.lib")
|
||||||
|
#else
|
||||||
|
#define FREERDP_SSPI
|
||||||
|
#define SEC_ENTRY __stdcall
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define SEC_ENTRY
|
#define FREERDP_SSPI
|
||||||
|
|
||||||
typedef sint8 CHAR;
|
typedef char CHAR;
|
||||||
typedef uint16 WCHAR;
|
typedef uint16 WCHAR;
|
||||||
|
|
||||||
typedef CHAR* LPSTR;
|
typedef CHAR* LPSTR;
|
||||||
@ -47,9 +50,11 @@ typedef uint64* ULONG_PTR;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NATIVE_SSPI
|
#ifdef FREERDP_SSPI
|
||||||
|
|
||||||
#define SEC_ENTRY __stdcall
|
#ifndef SEC_ENTRY
|
||||||
|
#define SEC_ENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef CHAR SEC_CHAR;
|
typedef CHAR SEC_CHAR;
|
||||||
typedef WCHAR SEC_WCHAR;
|
typedef WCHAR SEC_WCHAR;
|
||||||
@ -258,7 +263,7 @@ typedef SecPkgInfoW* PSecPkgInfoW;
|
|||||||
#define SECPKG_ATTR_NEGO_STATUS 32
|
#define SECPKG_ATTR_NEGO_STATUS 32
|
||||||
#define SECPKG_ATTR_CONTEXT_DELETED 33
|
#define SECPKG_ATTR_CONTEXT_DELETED 33
|
||||||
|
|
||||||
#ifndef NATIVE_SSPI
|
#ifdef FREERDP_SSPI
|
||||||
|
|
||||||
struct _SecPkgContext_AccessToken
|
struct _SecPkgContext_AccessToken
|
||||||
{
|
{
|
||||||
@ -585,7 +590,7 @@ typedef SecPkgCredentials_NamesW* PSecPkgCredentials_NamesW;
|
|||||||
#define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
|
#define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
|
||||||
#define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2
|
#define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2
|
||||||
|
|
||||||
#ifndef NATIVE_SSPI
|
#ifdef FREERDP_SSPI
|
||||||
|
|
||||||
struct _SEC_WINNT_AUTH_IDENTITY
|
struct _SEC_WINNT_AUTH_IDENTITY
|
||||||
{
|
{
|
||||||
@ -641,7 +646,7 @@ typedef CtxtHandle* PCtxtHandle;
|
|||||||
#define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
|
#define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
|
||||||
#define SECBUFFER_RESERVED 0x60000000
|
#define SECBUFFER_RESERVED 0x60000000
|
||||||
|
|
||||||
#ifndef NATIVE_SSPI
|
#ifdef FREERDP_SSPI
|
||||||
|
|
||||||
struct _SecBuffer
|
struct _SecBuffer
|
||||||
{
|
{
|
||||||
@ -840,33 +845,33 @@ typedef struct _SecurityFunctionTable SecurityFunctionTable;
|
|||||||
struct _SecurityFunctionTableA
|
struct _SecurityFunctionTableA
|
||||||
{
|
{
|
||||||
uint32 dwVersion;
|
uint32 dwVersion;
|
||||||
ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesW;
|
ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
|
||||||
QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesW;
|
QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
|
||||||
ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleW;
|
ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
|
||||||
FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
|
FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
|
||||||
void* Reserved2;
|
void* Reserved2;
|
||||||
INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextW;
|
INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
|
||||||
ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
|
ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
|
||||||
COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
|
COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
|
||||||
DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
|
DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
|
||||||
APPLY_CONTROL_TOKEN_FN ApplyControlToken;
|
APPLY_CONTROL_TOKEN_FN ApplyControlToken;
|
||||||
QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesW;
|
QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
|
||||||
IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
|
IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
|
||||||
REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
|
REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
|
||||||
MAKE_SIGNATURE_FN MakeSignature;
|
MAKE_SIGNATURE_FN MakeSignature;
|
||||||
VERIFY_SIGNATURE_FN VerifySignature;
|
VERIFY_SIGNATURE_FN VerifySignature;
|
||||||
FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
|
FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
|
||||||
QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoW;
|
QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
|
||||||
void* Reserved3;
|
void* Reserved3;
|
||||||
void* Reserved4;
|
void* Reserved4;
|
||||||
EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
|
EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
|
||||||
IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextW;
|
IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
|
||||||
ADD_CREDENTIALS_FN_A AddCredentialsW;
|
ADD_CREDENTIALS_FN_A AddCredentialsA;
|
||||||
void* Reserved8;
|
void* Reserved8;
|
||||||
QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
|
QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
|
||||||
ENCRYPT_MESSAGE_FN EncryptMessage;
|
ENCRYPT_MESSAGE_FN EncryptMessage;
|
||||||
DECRYPT_MESSAGE_FN DecryptMessage;
|
DECRYPT_MESSAGE_FN DecryptMessage;
|
||||||
SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesW;
|
SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
|
||||||
};
|
};
|
||||||
typedef struct _SecurityFunctionTableA SecurityFunctionTableA;
|
typedef struct _SecurityFunctionTableA SecurityFunctionTableA;
|
||||||
typedef SecurityFunctionTableA* PSecurityFunctionTableA;
|
typedef SecurityFunctionTableA* PSecurityFunctionTableA;
|
||||||
@ -906,9 +911,11 @@ typedef struct _SecurityFunctionTableW SecurityFunctionTableW;
|
|||||||
typedef SecurityFunctionTableW* PSecurityFunctionTableW;
|
typedef SecurityFunctionTableW* PSecurityFunctionTableW;
|
||||||
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
|
#define InitSecurityInterface InitSecurityInterfaceW
|
||||||
#define SecurityFunctionTable SecurityFunctionTableW
|
#define SecurityFunctionTable SecurityFunctionTableW
|
||||||
#define PSecurityFunctionTable PSecurityFunctionTableW
|
#define PSecurityFunctionTable PSecurityFunctionTableW
|
||||||
#else
|
#else
|
||||||
|
#define InitSecurityInterface InitSecurityInterfaceA
|
||||||
#define SecurityFunctionTable SecurityFunctionTableA
|
#define SecurityFunctionTable SecurityFunctionTableA
|
||||||
#define PSecurityFunctionTable PSecurityFunctionTableA
|
#define PSecurityFunctionTable PSecurityFunctionTableA
|
||||||
#endif
|
#endif
|
||||||
|
@ -275,7 +275,7 @@ KRB_CONTEXT* krb_ContextNew()
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_AcquireCredentialsHandle(char* pszPrincipal, char* pszPackage,
|
SECURITY_STATUS SEC_ENTRY krb_AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage,
|
||||||
uint32 fCredentialUse, void* pvLogonID, void* pAuthData, void* pGetKeyFn,
|
uint32 fCredentialUse, void* pvLogonID, void* pAuthData, void* pGetKeyFn,
|
||||||
void* pvGetKeyArgument, PCredHandle phCredential, TimeStamp* ptsExpiry)
|
void* pvGetKeyArgument, PCredHandle phCredential, TimeStamp* ptsExpiry)
|
||||||
{
|
{
|
||||||
@ -315,7 +315,7 @@ SECURITY_STATUS SEC_ENTRY krb_FreeCredentialsHandle(PCredHandle phCredential)
|
|||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_QueryCredentialsAttributes(PCredHandle phCredential, uint32 ulAttribute, void* pBuffer)
|
SECURITY_STATUS SEC_ENTRY krb_QueryCredentialsAttributesA(PCredHandle phCredential, uint32 ulAttribute, void* pBuffer)
|
||||||
{
|
{
|
||||||
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
||||||
{
|
{
|
||||||
@ -381,9 +381,9 @@ void krb_SetContextIdentity(KRB_CONTEXT* context, SEC_WINNT_AUTH_IDENTITY* ident
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_InitializeSecurityContext(PCredHandle phCredential, CtxtHandle* phContext,
|
SECURITY_STATUS SEC_ENTRY krb_InitializeSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
|
||||||
char* pszTargetName, uint32 fContextReq, uint32 Reserved1, uint32 TargetDataRep,
|
char* pszTargetName, uint32 fContextReq, uint32 Reserved1, uint32 TargetDataRep,
|
||||||
PSecBufferDesc pInput, uint32 Reserved2, CtxtHandle* phNewContext,
|
PSecBufferDesc pInput, uint32 Reserved2, PCtxtHandle phNewContext,
|
||||||
PSecBufferDesc pOutput, uint32* pfContextAttr, TimeStamp* ptsExpiry)
|
PSecBufferDesc pOutput, uint32* pfContextAttr, TimeStamp* ptsExpiry)
|
||||||
{
|
{
|
||||||
KRB_CONTEXT* krb_ctx;
|
KRB_CONTEXT* krb_ctx;
|
||||||
@ -432,7 +432,7 @@ SECURITY_STATUS SEC_ENTRY krb_InitializeSecurityContext(PCredHandle phCredential
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CtxtHandle* krbctx_client_init(rdpSettings* settings, SEC_WINNT_AUTH_IDENTITY* identity)
|
PCtxtHandle krbctx_client_init(rdpSettings* settings, SEC_WINNT_AUTH_IDENTITY* identity)
|
||||||
{
|
{
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
KDCENTRY* kdclist;
|
KDCENTRY* kdclist;
|
||||||
@ -1144,7 +1144,7 @@ void krb_ContextFree(KRB_CONTEXT* krb_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS krb_QueryContextAttributes(CtxtHandle* phContext, uint32 ulAttribute, void* pBuffer)
|
SECURITY_STATUS krb_QueryContextAttributesA(PCtxtHandle phContext, uint32 ulAttribute, void* pBuffer)
|
||||||
{
|
{
|
||||||
if (!phContext)
|
if (!phContext)
|
||||||
return SEC_E_INVALID_HANDLE;
|
return SEC_E_INVALID_HANDLE;
|
||||||
@ -1167,22 +1167,22 @@ SECURITY_STATUS krb_QueryContextAttributes(CtxtHandle* phContext, uint32 ulAttri
|
|||||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_EncryptMessage(CtxtHandle* phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
SECURITY_STATUS SEC_ENTRY krb_EncryptMessage(PCtxtHandle phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_DecryptMessage(CtxtHandle* phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
SECURITY_STATUS SEC_ENTRY krb_DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_MakeSignature(CtxtHandle* phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
SECURITY_STATUS SEC_ENTRY krb_MakeSignature(PCtxtHandle phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY krb_VerifySignature(CtxtHandle* phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
SECURITY_STATUS SEC_ENTRY krb_VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
@ -1201,9 +1201,8 @@ const SecurityFunctionTable KRB_SecurityFunctionTable =
|
|||||||
{
|
{
|
||||||
1, /* dwVersion */
|
1, /* dwVersion */
|
||||||
NULL, /* EnumerateSecurityPackages */
|
NULL, /* EnumerateSecurityPackages */
|
||||||
NULL, /* Reserved1 */
|
krb_QueryCredentialsAttributesA, /* QueryCredentialsAttributes */
|
||||||
krb_QueryCredentialsAttributes, /* QueryCredentialsAttributes */
|
krb_AcquireCredentialsHandleA, /* AcquireCredentialsHandle */
|
||||||
krb_AcquireCredentialsHandle, /* AcquireCredentialsHandle */
|
|
||||||
krb_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
krb_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
||||||
NULL, /* Reserved2 */
|
NULL, /* Reserved2 */
|
||||||
krb_InitializeSecurityContext, /* InitializeSecurityContext */
|
krb_InitializeSecurityContext, /* InitializeSecurityContext */
|
||||||
@ -1211,7 +1210,7 @@ const SecurityFunctionTable KRB_SecurityFunctionTable =
|
|||||||
NULL, /* CompleteAuthToken */
|
NULL, /* CompleteAuthToken */
|
||||||
NULL, /* DeleteSecurityContext */
|
NULL, /* DeleteSecurityContext */
|
||||||
NULL, /* ApplyControlToken */
|
NULL, /* ApplyControlToken */
|
||||||
krb_QueryContextAttributes, /* QueryContextAttributes */
|
krb_QueryContextAttributesA, /* QueryContextAttributes */
|
||||||
NULL, /* ImpersonateSecurityContext */
|
NULL, /* ImpersonateSecurityContext */
|
||||||
NULL, /* RevertSecurityContext */
|
NULL, /* RevertSecurityContext */
|
||||||
krb_MakeSignature, /* MakeSignature */
|
krb_MakeSignature, /* MakeSignature */
|
||||||
|
@ -138,9 +138,9 @@ void ntlm_ContextFree(NTLM_CONTEXT* context)
|
|||||||
xfree(context);
|
xfree(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS ntlm_AcquireCredentialsHandle(char* pszPrincipal, char* pszPackage,
|
SECURITY_STATUS ntlm_AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage,
|
||||||
uint32 fCredentialUse, void* pvLogonID, void* pAuthData, void* pGetKeyFn,
|
uint32 fCredentialUse, void* pvLogonID, void* pAuthData, void* pGetKeyFn,
|
||||||
void* pvGetKeyArgument, PCredHandle phCredential, TimeStamp* ptsExpiry)
|
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
||||||
{
|
{
|
||||||
CREDENTIALS* credentials;
|
CREDENTIALS* credentials;
|
||||||
SEC_WINNT_AUTH_IDENTITY* identity;
|
SEC_WINNT_AUTH_IDENTITY* identity;
|
||||||
@ -190,7 +190,7 @@ SECURITY_STATUS ntlm_FreeCredentialsHandle(PCredHandle phCredential)
|
|||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributes(PCredHandle phCredential, uint32 ulAttribute, void* pBuffer)
|
SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesA(PCredHandle phCredential, uint32 ulAttribute, void* pBuffer)
|
||||||
{
|
{
|
||||||
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
||||||
{
|
{
|
||||||
@ -210,9 +210,9 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributes(PCredHandle phCredenti
|
|||||||
|
|
||||||
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375512/ */
|
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375512/ */
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, CtxtHandle* phContext,
|
SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
|
||||||
PSecBufferDesc pInput, uint32 fContextReq, uint32 TargetDataRep, CtxtHandle* phNewContext,
|
PSecBufferDesc pInput, uint32 fContextReq, uint32 TargetDataRep, PCtxtHandle phNewContext,
|
||||||
PSecBufferDesc pOutput, uint32* pfContextAttr, TimeStamp* ptsTimeStamp)
|
PSecBufferDesc pOutput, uint32* pfContextAttr, PTimeStamp ptsTimeStamp)
|
||||||
{
|
{
|
||||||
NTLM_CONTEXT* context;
|
NTLM_CONTEXT* context;
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
@ -307,15 +307,15 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, C
|
|||||||
return SEC_E_OUT_OF_SEQUENCE;
|
return SEC_E_OUT_OF_SEQUENCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_ImpersonateSecurityContext(CtxtHandle* phContext)
|
SECURITY_STATUS SEC_ENTRY ntlm_ImpersonateSecurityContext(PCtxtHandle phContext)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContext(PCredHandle phCredential, CtxtHandle* phContext,
|
SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext,
|
||||||
char* pszTargetName, uint32 fContextReq, uint32 Reserved1, uint32 TargetDataRep,
|
char* pszTargetName, uint32 fContextReq, uint32 Reserved1, uint32 TargetDataRep,
|
||||||
PSecBufferDesc pInput, uint32 Reserved2, CtxtHandle* phNewContext,
|
PSecBufferDesc pInput, uint32 Reserved2, PCtxtHandle phNewContext,
|
||||||
PSecBufferDesc pOutput, uint32* pfContextAttr, TimeStamp* ptsExpiry)
|
PSecBufferDesc pOutput, uint32* pfContextAttr, PTimeStamp ptsExpiry)
|
||||||
{
|
{
|
||||||
NTLM_CONTEXT* context;
|
NTLM_CONTEXT* context;
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
@ -411,7 +411,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContext(PCredHandle phCredentia
|
|||||||
|
|
||||||
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375354 */
|
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375354 */
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(CtxtHandle* phContext)
|
SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(PCtxtHandle phContext)
|
||||||
{
|
{
|
||||||
NTLM_CONTEXT* context;
|
NTLM_CONTEXT* context;
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(CtxtHandle* phContext)
|
|||||||
|
|
||||||
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa379337/ */
|
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa379337/ */
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributes(CtxtHandle* phContext, uint32 ulAttribute, void* pBuffer)
|
SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesA(PCtxtHandle phContext, uint32 ulAttribute, void* pBuffer)
|
||||||
{
|
{
|
||||||
if (!phContext)
|
if (!phContext)
|
||||||
return SEC_E_INVALID_HANDLE;
|
return SEC_E_INVALID_HANDLE;
|
||||||
@ -448,12 +448,12 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributes(CtxtHandle* phContext, uin
|
|||||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_RevertSecurityContext(CtxtHandle* phContext)
|
SECURITY_STATUS SEC_ENTRY ntlm_RevertSecurityContext(PCtxtHandle phContext)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(CtxtHandle* phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int length;
|
int length;
|
||||||
@ -530,7 +530,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(CtxtHandle* phContext, uint32 fQOP
|
|||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(CtxtHandle* phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int length;
|
int length;
|
||||||
@ -596,12 +596,12 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(CtxtHandle* phContext, PSecBufferD
|
|||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_MakeSignature(CtxtHandle* phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
SECURITY_STATUS SEC_ENTRY ntlm_MakeSignature(PCtxtHandle phContext, uint32 fQOP, PSecBufferDesc pMessage, uint32 MessageSeqNo)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY ntlm_VerifySignature(CtxtHandle* phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
SECURITY_STATUS SEC_ENTRY ntlm_VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, uint32 MessageSeqNo, uint32* pfQOP)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
@ -620,17 +620,16 @@ const SecurityFunctionTable NTLM_SecurityFunctionTable =
|
|||||||
{
|
{
|
||||||
1, /* dwVersion */
|
1, /* dwVersion */
|
||||||
NULL, /* EnumerateSecurityPackages */
|
NULL, /* EnumerateSecurityPackages */
|
||||||
NULL, /* Reserved1 */
|
ntlm_QueryCredentialsAttributesA, /* QueryCredentialsAttributes */
|
||||||
ntlm_QueryCredentialsAttributes, /* QueryCredentialsAttributes */
|
ntlm_AcquireCredentialsHandleA, /* AcquireCredentialsHandle */
|
||||||
ntlm_AcquireCredentialsHandle, /* AcquireCredentialsHandle */
|
|
||||||
ntlm_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
ntlm_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
||||||
NULL, /* Reserved2 */
|
NULL, /* Reserved2 */
|
||||||
ntlm_InitializeSecurityContext, /* InitializeSecurityContext */
|
ntlm_InitializeSecurityContextA, /* InitializeSecurityContext */
|
||||||
ntlm_AcceptSecurityContext, /* AcceptSecurityContext */
|
ntlm_AcceptSecurityContext, /* AcceptSecurityContext */
|
||||||
NULL, /* CompleteAuthToken */
|
NULL, /* CompleteAuthToken */
|
||||||
ntlm_DeleteSecurityContext, /* DeleteSecurityContext */
|
ntlm_DeleteSecurityContext, /* DeleteSecurityContext */
|
||||||
NULL, /* ApplyControlToken */
|
NULL, /* ApplyControlToken */
|
||||||
ntlm_QueryContextAttributes, /* QueryContextAttributes */
|
ntlm_QueryContextAttributesA, /* QueryContextAttributes */
|
||||||
ntlm_ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
ntlm_ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
||||||
ntlm_RevertSecurityContext, /* RevertSecurityContext */
|
ntlm_RevertSecurityContext, /* RevertSecurityContext */
|
||||||
ntlm_MakeSignature, /* MakeSignature */
|
ntlm_MakeSignature, /* MakeSignature */
|
||||||
|
@ -194,7 +194,7 @@ SECURITY_STATUS SEC_ENTRY negotiate_AcquireCredentialsHandle(char* pszPrincipal,
|
|||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS SEC_ENTRY negotiate_QueryCredentialsAttributes(PCredHandle phCredential, uint32 ulAttribute, void* pBuffer)
|
SECURITY_STATUS SEC_ENTRY negotiate_QueryCredentialsAttributesA(PCredHandle phCredential, uint32 ulAttribute, void* pBuffer)
|
||||||
{
|
{
|
||||||
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
||||||
{
|
{
|
||||||
@ -253,8 +253,7 @@ const SecurityFunctionTable NEGOTIATE_SecurityFunctionTable =
|
|||||||
{
|
{
|
||||||
1, /* dwVersion */
|
1, /* dwVersion */
|
||||||
NULL, /* EnumerateSecurityPackages */
|
NULL, /* EnumerateSecurityPackages */
|
||||||
NULL, /* Reserved1 */
|
negotiate_QueryCredentialsAttributesA, /* QueryCredentialsAttributes */
|
||||||
negotiate_QueryCredentialsAttributes, /* QueryCredentialsAttributes */
|
|
||||||
negotiate_AcquireCredentialsHandle, /* AcquireCredentialsHandle */
|
negotiate_AcquireCredentialsHandle, /* AcquireCredentialsHandle */
|
||||||
negotiate_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
negotiate_FreeCredentialsHandle, /* FreeCredentialsHandle */
|
||||||
NULL, /* Reserved2 */
|
NULL, /* Reserved2 */
|
||||||
|
@ -152,7 +152,7 @@ int credssp_ntlm_server_init(rdpCredssp* credssp)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NTLM_PACKAGE_NAME L"NTLM"
|
#define NTLM_PACKAGE_NAME "NTLM"
|
||||||
|
|
||||||
int credssp_client_authenticate(rdpCredssp* credssp)
|
int credssp_client_authenticate(rdpCredssp* credssp)
|
||||||
{
|
{
|
||||||
@ -1032,7 +1032,6 @@ const SecurityFunctionTable CREDSSP_SecurityFunctionTable =
|
|||||||
{
|
{
|
||||||
1, /* dwVersion */
|
1, /* dwVersion */
|
||||||
NULL, /* EnumerateSecurityPackages */
|
NULL, /* EnumerateSecurityPackages */
|
||||||
NULL, /* Reserved1 */
|
|
||||||
NULL, /* QueryCredentialsAttributes */
|
NULL, /* QueryCredentialsAttributes */
|
||||||
NULL, /* AcquireCredentialsHandle */
|
NULL, /* AcquireCredentialsHandle */
|
||||||
NULL, /* FreeCredentialsHandle */
|
NULL, /* FreeCredentialsHandle */
|
||||||
@ -1058,7 +1057,7 @@ const SecurityFunctionTable CREDSSP_SecurityFunctionTable =
|
|||||||
NULL, /* QuerySecurityContextToken */
|
NULL, /* QuerySecurityContextToken */
|
||||||
NULL, /* EncryptMessage */
|
NULL, /* EncryptMessage */
|
||||||
NULL, /* DecryptMessage */
|
NULL, /* DecryptMessage */
|
||||||
NULL, /* SetContextAttributes */
|
NULL /* SetContextAttributes */
|
||||||
};
|
};
|
||||||
|
|
||||||
const SecPkgInfo CREDSSP_SecPkgInfo =
|
const SecPkgInfo CREDSSP_SecPkgInfo =
|
||||||
@ -1067,6 +1066,6 @@ const SecPkgInfo CREDSSP_SecPkgInfo =
|
|||||||
1, /* wVersion */
|
1, /* wVersion */
|
||||||
0xFFFF, /* wRPCID */
|
0xFFFF, /* wRPCID */
|
||||||
0x000090A8, /* cbMaxToken */
|
0x000090A8, /* cbMaxToken */
|
||||||
L"CREDSSP", /* Name */
|
"CREDSSP", /* Name */
|
||||||
L"Microsoft CredSSP Security Provider" /* Comment */
|
"Microsoft CredSSP Security Provider" /* Comment */
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
/* Authentication Functions: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374731/ */
|
/* Authentication Functions: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374731/ */
|
||||||
|
|
||||||
#ifndef NATIVE_SSPI
|
#ifdef FREERDP_SSPI
|
||||||
|
|
||||||
extern const SecPkgInfo NTLM_SecPkgInfo;
|
extern const SecPkgInfo NTLM_SecPkgInfo;
|
||||||
extern const SecPkgInfo CREDSSP_SecPkgInfo;
|
extern const SecPkgInfo CREDSSP_SecPkgInfo;
|
||||||
@ -362,7 +362,7 @@ SecurityFunctionTable* InitSecurityInterface(void)
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS QuerySecurityPackageInfo(char* pszPackageName, SecPkgInfo** ppPackageInfo)
|
SECURITY_STATUS QuerySecurityPackageInfoA(SEC_CHAR* pszPackageName, PSecPkgInfoA* ppPackageInfo)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -411,9 +411,9 @@ void FreeContextBuffer_QuerySecurityPackageInfo(void* contextBuffer)
|
|||||||
|
|
||||||
/* Credential Management */
|
/* Credential Management */
|
||||||
|
|
||||||
SECURITY_STATUS AcquireCredentialsHandle(char* pszPrincipal, char* pszPackage,
|
SECURITY_STATUS AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage,
|
||||||
uint32 fCredentialUse, void* pvLogonID, void* pAuthData, void* pGetKeyFn,
|
uint32 fCredentialUse, void* pvLogonID, void* pAuthData, void* pGetKeyFn,
|
||||||
void* pvGetKeyArgument, PCredHandle phCredential, TimeStamp* ptsExpiry)
|
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
||||||
{
|
{
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
SecurityFunctionTable* table = sspi_GetSecurityFunctionTableByName(pszPackage);
|
SecurityFunctionTable* table = sspi_GetSecurityFunctionTableByName(pszPackage);
|
||||||
@ -430,7 +430,7 @@ SECURITY_STATUS AcquireCredentialsHandle(char* pszPrincipal, char* pszPackage,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS ExportSecurityContext(PCtxtHandle phContext, uint32 fFlags, PSecBuffer pPackedContext, void* pToken)
|
SECURITY_STATUS ExportSecurityContextA(PCtxtHandle phContext, uint32 fFlags, PSecBuffer pPackedContext, void* pToken)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
@ -459,7 +459,7 @@ SECURITY_STATUS FreeCredentialsHandle(PCredHandle phCredential)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS ImportSecurityContext(char* pszPackage, PSecBuffer pPackedContext, void* pToken, PCtxtHandle phContext)
|
SECURITY_STATUS ImportSecurityContextA(char* pszPackage, PSecBuffer pPackedContext, void* pToken, PCtxtHandle phContext)
|
||||||
{
|
{
|
||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
@ -492,7 +492,7 @@ SECURITY_STATUS QueryCredentialsAttributes(PCredHandle phCredential, uint32 ulAt
|
|||||||
|
|
||||||
SECURITY_STATUS AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
|
SECURITY_STATUS AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
|
||||||
PSecBufferDesc pInput, uint32 fContextReq, uint32 TargetDataRep, PCtxtHandle phNewContext,
|
PSecBufferDesc pInput, uint32 fContextReq, uint32 TargetDataRep, PCtxtHandle phNewContext,
|
||||||
PSecBufferDesc pOutput, uint32* pfContextAttr, TimeStamp* ptsTimeStamp)
|
PSecBufferDesc pOutput, uint32* pfContextAttr, PTimeStamp ptsTimeStamp)
|
||||||
{
|
{
|
||||||
char* Name;
|
char* Name;
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
@ -566,10 +566,10 @@ SECURITY_STATUS ImpersonateSecurityContext(PCtxtHandle phContext)
|
|||||||
return SEC_E_OK;
|
return SEC_E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECURITY_STATUS InitializeSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
|
SECURITY_STATUS InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext,
|
||||||
char* pszTargetName, uint32 fContextReq, uint32 Reserved1, uint32 TargetDataRep,
|
char* pszTargetName, uint32 fContextReq, uint32 Reserved1, uint32 TargetDataRep,
|
||||||
PSecBufferDesc pInput, uint32 Reserved2, PCtxtHandle phNewContext,
|
PSecBufferDesc pInput, uint32 Reserved2, PCtxtHandle phNewContext,
|
||||||
PSecBufferDesc pOutput, uint32* pfContextAttr, TimeStamp* ptsExpiry)
|
PSecBufferDesc pOutput, uint32* pfContextAttr, PTimeStamp ptsExpiry)
|
||||||
{
|
{
|
||||||
char* Name;
|
char* Name;
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
@ -736,12 +736,11 @@ const SecurityFunctionTable SSPI_SecurityFunctionTable =
|
|||||||
{
|
{
|
||||||
1, /* dwVersion */
|
1, /* dwVersion */
|
||||||
EnumerateSecurityPackages, /* EnumerateSecurityPackages */
|
EnumerateSecurityPackages, /* EnumerateSecurityPackages */
|
||||||
NULL, /* Reserved1 */
|
|
||||||
QueryCredentialsAttributes, /* QueryCredentialsAttributes */
|
QueryCredentialsAttributes, /* QueryCredentialsAttributes */
|
||||||
AcquireCredentialsHandle, /* AcquireCredentialsHandle */
|
AcquireCredentialsHandle, /* AcquireCredentialsHandle */
|
||||||
FreeCredentialsHandle, /* FreeCredentialsHandle */
|
FreeCredentialsHandle, /* FreeCredentialsHandle */
|
||||||
NULL, /* Reserved2 */
|
NULL, /* Reserved2 */
|
||||||
InitializeSecurityContext, /* InitializeSecurityContext */
|
InitializeSecurityContextA, /* InitializeSecurityContext */
|
||||||
AcceptSecurityContext, /* AcceptSecurityContext */
|
AcceptSecurityContext, /* AcceptSecurityContext */
|
||||||
CompleteAuthToken, /* CompleteAuthToken */
|
CompleteAuthToken, /* CompleteAuthToken */
|
||||||
DeleteSecurityContext, /* DeleteSecurityContext */
|
DeleteSecurityContext, /* DeleteSecurityContext */
|
||||||
@ -752,10 +751,10 @@ const SecurityFunctionTable SSPI_SecurityFunctionTable =
|
|||||||
MakeSignature, /* MakeSignature */
|
MakeSignature, /* MakeSignature */
|
||||||
VerifySignature, /* VerifySignature */
|
VerifySignature, /* VerifySignature */
|
||||||
FreeContextBuffer, /* FreeContextBuffer */
|
FreeContextBuffer, /* FreeContextBuffer */
|
||||||
QuerySecurityPackageInfo, /* QuerySecurityPackageInfo */
|
QuerySecurityPackageInfoA, /* QuerySecurityPackageInfo */
|
||||||
NULL, /* Reserved3 */
|
NULL, /* Reserved3 */
|
||||||
NULL, /* Reserved4 */
|
NULL, /* Reserved4 */
|
||||||
ExportSecurityContext, /* ExportSecurityContext */
|
ExportSecurityContextA, /* ExportSecurityContext */
|
||||||
ImportSecurityContext, /* ImportSecurityContext */
|
ImportSecurityContext, /* ImportSecurityContext */
|
||||||
NULL, /* AddCredentials */
|
NULL, /* AddCredentials */
|
||||||
NULL, /* Reserved8 */
|
NULL, /* Reserved8 */
|
||||||
|
Loading…
Reference in New Issue
Block a user