Author: hbelusca Date: Wed Feb 8 02:37:58 2017 New Revision: 73753 URL: http://svn.reactos.org/svn/reactos?rev=73753&view=rev Log: Add back ntlmssp and the old code of secur32 that were lost in syncs.
Added: branches/sspi-bringup/reactos/dll/win32/ntlmssp/ (props changed) - copied from r73749, branches/sspi-bringup/reactos/dll/win32/ntlmssp/ branches/sspi-bringup/reactos/dll/win32/secur32/secext.c - copied unchanged from r73749, branches/sspi-bringup/reactos/dll/win32/secur32/secext.c branches/sspi-bringup/reactos/dll/win32/secur32/secur32.c - copied unchanged from r73749, branches/sspi-bringup/reactos/dll/win32/secur32/secur32.c branches/sspi-bringup/reactos/dll/win32/secur32/sspap.c - copied unchanged from r73749, branches/sspi-bringup/reactos/dll/win32/secur32/sspap.c Removed: branches/sspi-bringup/reactos/dll/win32/secur32/lsalpc.c Modified: branches/sspi-bringup/reactos/dll/win32/CMakeLists.txt branches/sspi-bringup/reactos/dll/win32/secur32/CMakeLists.txt branches/sspi-bringup/reactos/dll/win32/secur32/dllmain.c (contents, props changed) branches/sspi-bringup/reactos/dll/win32/secur32/precomp.h branches/sspi-bringup/reactos/dll/win32/secur32/secur32.rc (contents, props changed) branches/sspi-bringup/reactos/dll/win32/secur32/secur32.spec branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h (contents, props changed) branches/sspi-bringup/reactos/dll/win32/secur32/sspi.c branches/sspi-bringup/reactos/dll/win32/secur32/stubs.c branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c (contents, props changed) branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h (contents, props changed) branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c (contents, props changed) Modified: branches/sspi-bringup/reactos/dll/win32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/CMakeLists.txt?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/CMakeLists.txt [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/CMakeLists.txt [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -138,6 +138,7 @@ add_subdirectory(npptools) add_subdirectory(ntdsapi) add_subdirectory(ntlanman) +add_subdirectory(ntlmssp) add_subdirectory(ntmarta) add_subdirectory(ntprint) add_subdirectory(objsel) Propchange: branches/sspi-bringup/reactos/dll/win32/ntlmssp/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Feb 8 02:37:58 2017 @@ -0,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: branches/sspi-bringup/reactos/dll/win32/ntlmssp/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: branches/sspi-bringup/reactos/dll/win32/ntlmssp/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID% Propchange: branches/sspi-bringup/reactos/dll/win32/ntlmssp/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Wed Feb 8 02:37:58 2017 @@ -0,0 +1,13 @@ +/branches/GSoC_2011/GSoC_Network/dll/win32/ntlmssp:51548 +/branches/GSoC_2011/GSoC_TcpIpDriver/dll/win32/ntlmssp:51550 +/branches/GSoC_2011/TcpIpDriver/dll/win32/ntlmssp:51551-53074,53076-53119 +/branches/GSoC_Network/dll/win32/ntlmssp:51545-51546 +/branches/cmake-bringup/dll/win32/ntlmssp:50484,50693,50719,51544-52564 +/branches/header-work/dll/win32/ntlmssp:45691-47721 +/branches/reactos-yarotows/dll/win32/ntlmssp:45219-46371,46373-48025,48027-49273 +/branches/reactx/reactos/dll/win32/ntlmssp:49994-49995 +/branches/ros-amd64-bringup/dll/win32/ntlmssp:36852 +/branches/ros-amd64-bringup/reactos/dll/win32/ntlmssp:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,4 1536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 +/branches/shell32_new-bringup/dll/win32/ntlmssp:51893-53652,53661,53700 +/branches/tcp-rewrite-branch/dll/win32/ntlmssp:48720,48840-48841,49424-49426,49454 +/trunk/reactos/dll/win32/ntlmssp:51592-54878 Propchange: branches/sspi-bringup/reactos/dll/win32/ntlmssp/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Modified: branches/sspi-bringup/reactos/dll/win32/secur32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/CMakeLists.txt?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/CMakeLists.txt [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/CMakeLists.txt [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -1,11 +1,13 @@ add_definitions(-D__SECUR32__) -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys) +include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys) spec2def(secur32.dll secur32.spec ADD_IMPORTLIB) list(APPEND SOURCE dllmain.c - lsalpc.c + secext.c + secur32.c + sspap.c sspi.c stubs.c thunks.c Modified: branches/sspi-bringup/reactos/dll/win32/secur32/dllmain.c URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/dllmain.c?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/dllmain.c [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/dllmain.c [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -1,4 +1,5 @@ -/* +/* $Id$ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/secur32/lsa.c @@ -7,42 +8,25 @@ * Created 05/08/00 */ -#include "precomp.h" +/* INCLUDES ******************************************************************/ +#include <precomp.h> -VOID LsapInitLsaPort(VOID); -VOID LsapCloseLsaPort(VOID); - -/* GLOBALS *******************************************************************/ - -HANDLE Secur32Heap; +void SECUR32_initializeProviders(void); +void SECUR32_freeProviders(void); /* FUNCTIONS *****************************************************************/ -BOOL -WINAPI -DllMain(HINSTANCE hInstance, - ULONG Reason, - PVOID Reserved) +BOOL WINAPI DllMain(HINSTANCE hInstance, ULONG Reason, PVOID Reserved) { switch (Reason) { - case DLL_PROCESS_ATTACH: - Secur32Heap = RtlCreateHeap(0, NULL, 0, 4096, NULL, NULL); - if (Secur32Heap == 0) - { - return FALSE; - } - LsapInitLsaPort(); - break; - - case DLL_PROCESS_DETACH: - LsapCloseLsaPort(); - if (!RtlDestroyHeap(Secur32Heap)) - { - return FALSE; - } - break; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hInstance); + SECUR32_initializeProviders(); + break; + case DLL_PROCESS_DETACH: + SECUR32_freeProviders(); + break; } - - return TRUE; + return(TRUE); } Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/dllmain.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Removed: branches/sspi-bringup/reactos/dll/win32/secur32/lsalpc.c URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/lsalpc.c?rev=73752 ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/lsalpc.c [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/lsalpc.c (removed) @@ -1,242 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/secur32/lsalpc.c - * PURPOSE: LSA LPC port functions - */ - -/* INCLUDES ******************************************************************/ - -#include "precomp.h" - -#include <ndk/lpctypes.h> -#include <ndk/lpcfuncs.h> -#include <ndk/mmfuncs.h> -#include <ndk/rtlfuncs.h> -#include <ndk/obfuncs.h> -#include <psdk/ntsecapi.h> -#include <lsass/lsass.h> - -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(secur32); - - -/* GLOBALS *******************************************************************/ - -HANDLE LsaPortHandle; - -extern HANDLE Secur32Heap; - - -/* FUNCTIONS *****************************************************************/ - -VOID -LsapInitLsaPort(VOID) -{ - LsaPortHandle = NULL; -} - - -VOID -LsapCloseLsaPort(VOID) -{ - if (LsaPortHandle != NULL) - { - NtClose(LsaPortHandle); - LsaPortHandle = NULL; - } -} - - -NTSTATUS -LsapOpenLsaPort(VOID) -{ - UNICODE_STRING PortName; - SECURITY_QUALITY_OF_SERVICE SecurityQos; - LSA_CONNECTION_INFO ConnectInfo; - ULONG ConnectInfoLength; - NTSTATUS Status; - - TRACE("LsapOpenLsaPort()\n"); - - if (LsaPortHandle != NULL) - return STATUS_SUCCESS; - - RtlInitUnicodeString(&PortName, - L"\\LsaAuthenticationPort"); - - SecurityQos.Length = sizeof(SecurityQos); - SecurityQos.ImpersonationLevel = SecurityIdentification; - SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING; - SecurityQos.EffectiveOnly = TRUE; - - RtlZeroMemory(&ConnectInfo, - sizeof(ConnectInfo)); - - ConnectInfo.CreateContext = FALSE; - - ConnectInfoLength = sizeof(LSA_CONNECTION_INFO); - Status = NtConnectPort(&LsaPortHandle, - &PortName, - &SecurityQos, - NULL, - NULL, - NULL, - &ConnectInfo, - &ConnectInfoLength); - if (!NT_SUCCESS(Status)) - { - TRACE("NtConnectPort failed (Status 0x%08lx)\n", Status); - } - - return Status; -/* - if (!NT_SUCCESS(ConnectInfo.Status)) - { - DPRINT1("ConnectInfo.Status: 0x%08lx\n", ConnectInfo.Status); - } - - return ConnectInfo.Status; -*/ -} - - -/* PUBLIC FUNCTIONS **********************************************************/ - -/* - * @implemented - */ -NTSTATUS -NTAPI -LsaEnumerateLogonSessions( - PULONG LogonSessionCount, - PLUID *LogonSessionList) -{ -#if 1 - LSA_API_MSG ApiMessage; - NTSTATUS Status; - - TRACE("LsaEnumerateLogonSessions(%p %p)\n", LogonSessionCount, LogonSessionList); - - Status = LsapOpenLsaPort(); - if (!NT_SUCCESS(Status)) - return Status; - - ApiMessage.ApiNumber = LSASS_REQUEST_ENUM_LOGON_SESSIONS; - ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.EnumLogonSessions); - ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; - ApiMessage.h.u2.ZeroInit = 0; - - Status = NtRequestWaitReplyPort(LsaPortHandle, - (PPORT_MESSAGE)&ApiMessage, - (PPORT_MESSAGE)&ApiMessage); - if (!NT_SUCCESS(Status)) - { - ERR("NtRequestWaitReplyPort() failed (Status 0x%08lx)\n", Status); - return Status; - } - - if (!NT_SUCCESS(ApiMessage.Status)) - { - ERR("NtRequestWaitReplyPort() failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status); - return ApiMessage.Status; - } - - *LogonSessionCount = ApiMessage.EnumLogonSessions.Reply.LogonSessionCount; - *LogonSessionList = ApiMessage.EnumLogonSessions.Reply.LogonSessionBuffer; - - return Status; -#else - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -#endif -} - - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -LsaGetLogonSessionData( - PLUID LogonId, - PSECURITY_LOGON_SESSION_DATA *ppLogonSessionData) -{ -#if 1 - LSA_API_MSG ApiMessage; - PSECURITY_LOGON_SESSION_DATA SessionData; - NTSTATUS Status; - - TRACE("LsaGetLogonSessionData(%p %p)\n", LogonId, ppLogonSessionData); - - Status = LsapOpenLsaPort(); - if (!NT_SUCCESS(Status)) - return Status; - - ApiMessage.ApiNumber = LSASS_REQUEST_GET_LOGON_SESSION_DATA; - ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.GetLogonSessionData); - ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; - ApiMessage.h.u2.ZeroInit = 0; - - RtlCopyLuid(&ApiMessage.GetLogonSessionData.Request.LogonId, - LogonId); - - Status = NtRequestWaitReplyPort(LsaPortHandle, - (PPORT_MESSAGE)&ApiMessage, - (PPORT_MESSAGE)&ApiMessage); - if (!NT_SUCCESS(Status)) - { - ERR("NtRequestWaitReplyPort() failed (Status 0x%08lx)\n", Status); - return Status; - } - - if (!NT_SUCCESS(ApiMessage.Status)) - { - ERR("NtRequestWaitReplyPort() failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status); - return ApiMessage.Status; - } - - SessionData = ApiMessage.GetLogonSessionData.Reply.SessionDataBuffer; - - if (SessionData->UserName.Buffer != NULL) - SessionData->UserName.Buffer = (LPWSTR)((ULONG_PTR)&SessionData->UserName.Buffer + (ULONG_PTR)SessionData->UserName.Buffer); - - if (SessionData->Sid != NULL) - SessionData->Sid = (LPWSTR)((ULONG_PTR)&SessionData->Sid + (ULONG_PTR)SessionData->Sid); - - *ppLogonSessionData = SessionData; - - return Status; -#else - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -#endif -} - - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -LsaRegisterPolicyChangeNotification(POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass, - HANDLE NotificationEventHandle) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -LsaUnregisterPolicyChangeNotification(POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass, - HANDLE NotificationEventHandle) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* EOF */ Modified: branches/sspi-bringup/reactos/dll/win32/secur32/precomp.h URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/precomp.h?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/precomp.h [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/precomp.h [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -6,26 +6,32 @@ * PROGRAMMER: Alex Ionescu (a...@relsoft.net) */ -#ifndef _SECUR32_PCH_ -#define _SECUR32_PCH_ +/* INCLUDES ******************************************************************/ +/* SDK/DDK/NDK Headers. */ + +#include <assert.h> #include <stdarg.h> -/* SDK/DDK/NDK Headers. */ +#include <ntstatus.h> #define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <windef.h> -#include <winbase.h> -#include <winnls.h> -#include <winreg.h> +#include <windows.h> #define NTOS_MODE_USER -#include <ndk/rtlfuncs.h> - +#include <ntndk.h> +#include <lsass/lsass.h> +#define SECURITY_WIN32 +#define _NO_KSECDD_IMPORT_ +#include <ntsecapi.h> #include <secext.h> #include <security.h> +#include <ntsecpkg.h> +#include <sspi.h> +#include "lmcons.h" #include "secur32_priv.h" #include "thunks.h" -#endif /* _SECUR32_PCH_ */ + +extern SecurityFunctionTableA securityFunctionTableA; +extern SecurityFunctionTableW securityFunctionTableW; + Modified: branches/sspi-bringup/reactos/dll/win32/secur32/secur32.rc URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/secur32.rc?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/secur32.rc [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/secur32.rc [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -1,5 +1,7 @@ +/* $Id$ */ + #define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "Security" -#define REACTOS_STR_INTERNAL_NAME "secur32" -#define REACTOS_STR_ORIGINAL_FILENAME "secur32.dll" +#define REACTOS_STR_FILE_DESCRIPTION "Security\0" +#define REACTOS_STR_INTERNAL_NAME "secur32\0" +#define REACTOS_STR_ORIGINAL_FILENAME "secur32.dll\0" #include <reactos/version.rc> Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/secur32.rc ------------------------------------------------------------------------------ svn:keywords = author date id revision Modified: branches/sspi-bringup/reactos/dll/win32/secur32/secur32.spec URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/secur32.spec?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/secur32.spec [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/secur32.spec [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -1,3 +1,5 @@ +@ stub SecDeleteUserModeContext +@ stub SecInitUserModeContext @ stdcall AcceptSecurityContext(ptr ptr ptr long long ptr ptr ptr ptr) @ stdcall AcquireCredentialsHandleA(str str long ptr ptr ptr ptr ptr ptr) @ stdcall AcquireCredentialsHandleW(wstr wstr long ptr ptr ptr ptr ptr ptr) @@ -8,7 +10,7 @@ @ stdcall ApplyControlToken(ptr ptr) @ stdcall CompleteAuthToken(ptr ptr) @ stub CredMarshalTargetInfo -@ stub CredUnmarshalTargetInfo +@ stub CredUnMarshalTargetInfo @ stdcall DecryptMessage(ptr ptr long ptr) @ stdcall DeleteSecurityContext(ptr) @ stdcall DeleteSecurityPackageA(str) @@ -54,23 +56,24 @@ @ stub SaslAcceptSecurityContext @ stub SaslEnumerateProfilesA @ stub SaslEnumerateProfilesW +@ stub SaslGetContextOption @ stub SaslGetProfilePackageA @ stub SaslGetProfilePackageW @ stub SaslIdentifyPackageA @ stub SaslIdentifyPackageW @ stub SaslInitializeSecurityContextA @ stub SaslInitializeSecurityContextW -@ stdcall SealMessage(ptr long ptr long) EncryptMessage +@ stub SaslContextOption +@ stdcall SealMessage (ptr long ptr long) @ stub SecCacheSspiPackages -@ stub SecDeleteUserModeContext -@ stub SecGetLocaleSpecificEncryptionRules # not on win32k3 x64 -@ stub SecInitUserModeContext @ stub SecpFreeMemory @ stub SecpTranslateName @ stub SecpTranslateNameEx @ stdcall SetContextAttributesA(ptr long ptr long) @ stdcall SetContextAttributesW(ptr long ptr long) +@ stub SetCredentialsAttributesA +@ stub SetCredentialsAttributesW @ stdcall TranslateNameA(str long long ptr ptr) @ stdcall TranslateNameW(wstr long long ptr ptr) -@ stdcall UnsealMessage(ptr ptr long ptr) DecryptMessage +@ stdcall UnsealMessage(ptr ptr long ptr) @ stdcall VerifySignature(ptr ptr long ptr) Modified: branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -21,7 +21,19 @@ #ifndef __SECUR32_PRIV_H__ #define __SECUR32_PRIV_H__ -#include <wine/list.h> +#include <sys/types.h> +#include "wine/list.h" + + +typedef struct _SecureProviderAp +{ + struct list entry; + BOOL loaded; + PWSTR moduleName; + HMODULE lib; + SecurityFunctionTableA fnTableA; + SecurityFunctionTableW fnTableW; +} SecureProviderAp; typedef struct _SecureProvider { @@ -40,18 +52,57 @@ SecureProvider *provider; } SecurePackage; +typedef struct _SecurePackageTable +{ + DWORD numPackages; + DWORD numAllocated; + struct list table; +} SecurePackageTable; + +typedef struct _SecureProviderTable +{ + DWORD numProviders; + DWORD numAllocated; + struct list table; +} SecureProviderTable; + +/* Tries to load moduleName as a provider. If successful, enumerates what + * packages it can and adds them to the package and provider tables. Resizes + * tables as necessary. + */ +BOOL LoadSSPProvider(PWSTR moduleName); + +BOOL LoadSSPAPProvider(PWSTR moduleName); + + +/* Allocates space for and initializes a new provider. If fnTableA or fnTableW + * is non-NULL, assumes the provider is built-in, and if moduleName is non-NULL, + * means must load the LSA/user mode functions tables from external SSP/AP module. + * Otherwise moduleName must not be NULL. + * Returns a pointer to the stored provider entry, for use adding packages. + */ +SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA, + const SecurityFunctionTableW *fnTableW, PCWSTR moduleName); + +/* Allocates space for and adds toAdd packages with the given provider. + * provider must not be NULL, and either infoA or infoW may be NULL, but not + * both. + */ +void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd, + const SecPkgInfoA *infoA, const SecPkgInfoW *infoW); + /* Tries to find the package named packageName. If it finds it, implicitly * loads the package if it isn't already loaded. */ -SecurePackage *SECUR32_findPackageW(PCWSTR packageName) DECLSPEC_HIDDEN; +SecurePackage *SECUR32_findPackageW(PCWSTR packageName); /* Tries to find the package named packageName. (Thunks to _findPackageW) */ -SecurePackage *SECUR32_findPackageA(PCSTR packageName) DECLSPEC_HIDDEN; +SecurePackage *SECUR32_findPackageA(PCSTR packageName); /* A few string helpers; will return NULL if str is NULL. Free return with * HeapFree */ -PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str) DECLSPEC_HIDDEN; -PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str) DECLSPEC_HIDDEN; +PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str); +PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str); -#endif /* ndef __SECUR32_PRIV_H__ */ +#endif Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h ------------------------------------------------------------------------------ --- charset (original) +++ charset (removed) @@ -1 +0,0 @@ -UTF-8 Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/secur32_priv.h ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type (removed) @@ -1 +0,0 @@ -text/plain Modified: branches/sspi-bringup/reactos/dll/win32/secur32/sspi.c URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/sspi.c?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/sspi.c [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/sspi.c [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -1,60 +1,16 @@ -/* Copyright (C) 2004 Juan Lang - * - * This file implements loading of SSP DLLs. - * - * 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 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "precomp.h" - -#include <assert.h> -#include <lsass/lsass.h> - -#include <wine/debug.h> +#include <precomp.h> + +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(secur32); -#define UNLEN 256 - -typedef struct _SecurePackageTable -{ - DWORD numPackages; - DWORD numAllocated; - struct list table; -} SecurePackageTable; - -typedef struct _SecureProviderTable -{ - DWORD numProviders; - DWORD numAllocated; - struct list table; -} SecureProviderTable; - -static void SECUR32_initializeProviders(void); - -static CRITICAL_SECTION cs; -static CRITICAL_SECTION_DEBUG cs_debug = -{ - 0, 0, &cs, - { &cs_debug.ProcessLocksList, &cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": cs") } -}; -static CRITICAL_SECTION cs = { &cs_debug, -1, 0, 0, 0, 0 }; -static SecurePackageTable *packageTable = NULL; -static SecureProviderTable *providerTable = NULL; - -static SecurityFunctionTableA securityFunctionTableA = { +extern CRITICAL_SECTION cs; +extern SecurePackageTable *packageTable; + +SECURITY_STATUS WINAPI ApplyControlTokenW(PCtxtHandle Handle, PSecBufferDesc Buffer); +SECURITY_STATUS WINAPI ApplyControlTokenA(PCtxtHandle Handle, PSecBufferDesc Buffer); + +SecurityFunctionTableA securityFunctionTableA = +{ SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, EnumerateSecurityPackagesA, QueryCredentialsAttributesA, @@ -65,7 +21,7 @@ AcceptSecurityContext, CompleteAuthToken, DeleteSecurityContext, - ApplyControlToken, + ApplyControlTokenA, QueryContextAttributesA, ImpersonateSecurityContext, RevertSecurityContext, @@ -85,7 +41,8 @@ NULL }; -static SecurityFunctionTableW securityFunctionTableW = { +SecurityFunctionTableW securityFunctionTableW = +{ SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, EnumerateSecurityPackagesW, QueryCredentialsAttributesW, @@ -96,7 +53,7 @@ AcceptSecurityContext, CompleteAuthToken, DeleteSecurityContext, - ApplyControlToken, + ApplyControlTokenW, QueryContextAttributesW, ImpersonateSecurityContext, RevertSecurityContext, @@ -116,535 +73,6 @@ NULL }; -/*********************************************************************** - * InitSecurityInterfaceA (SECUR32.@) - */ -PSecurityFunctionTableA WINAPI InitSecurityInterfaceA(void) -{ - TRACE("InitSecurityInterfaceA() called\n"); - return &securityFunctionTableA; -} - -/*********************************************************************** - * InitSecurityInterfaceW (SECUR32.@) - */ -PSecurityFunctionTableW WINAPI InitSecurityInterfaceW(void) -{ - TRACE("InitSecurityInterfaceW() called\n"); - return &securityFunctionTableW; -} - -static PWSTR SECUR32_strdupW(PCWSTR str) -{ - PWSTR ret; - - if (str) - { - ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(str) + 1) * sizeof(WCHAR)); - if (ret) - lstrcpyW(ret, str); - } - else - ret = NULL; - return ret; -} - -PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str) -{ - PWSTR ret; - - if (str) - { - int charsNeeded = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - - if (charsNeeded) - { - ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded * sizeof(WCHAR)); - if (ret) - MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded); - } - else - ret = NULL; - } - else - ret = NULL; - return ret; -} - -PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str) -{ - PSTR ret; - - if (str) - { - int charsNeeded = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, - NULL, NULL); - - if (charsNeeded) - { - ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded); - if (ret) - WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded, - NULL, NULL); - } - else - ret = NULL; - } - else - ret = NULL; - return ret; -} - -static void _makeFnTableA(PSecurityFunctionTableA fnTableA, - const SecurityFunctionTableA *inFnTableA, - const SecurityFunctionTableW *inFnTableW) -{ - if (fnTableA) - { - if (inFnTableA) - { - /* The size of the version 1 table is based on platform sdk's - * sspi.h, though the sample ssp also provided with platform sdk - * implies only functions through QuerySecurityPackageInfoA are - * implemented (yikes) - */ - size_t tableSize = inFnTableA->dwVersion == 1 ? - (const BYTE *)&inFnTableA->SetContextAttributesA - - (const BYTE *)inFnTableA : sizeof(SecurityFunctionTableA); - - memcpy(fnTableA, inFnTableA, tableSize); - /* override this, since we can do it internally anyway */ - fnTableA->QuerySecurityPackageInfoA = - QuerySecurityPackageInfoA; - } - else if (inFnTableW) - { - /* functions with thunks */ - if (inFnTableW->AcquireCredentialsHandleW) - fnTableA->AcquireCredentialsHandleA = - thunk_AcquireCredentialsHandleA; - if (inFnTableW->InitializeSecurityContextW) - fnTableA->InitializeSecurityContextA = - thunk_InitializeSecurityContextA; - if (inFnTableW->ImportSecurityContextW) - fnTableA->ImportSecurityContextA = - thunk_ImportSecurityContextA; - if (inFnTableW->AddCredentialsW) - fnTableA->AddCredentialsA = - thunk_AddCredentialsA; - if (inFnTableW->QueryCredentialsAttributesW) - fnTableA->QueryCredentialsAttributesA = - thunk_QueryCredentialsAttributesA; - if (inFnTableW->QueryContextAttributesW) - fnTableA->QueryContextAttributesA = - thunk_QueryContextAttributesA; - if (inFnTableW->SetContextAttributesW) - fnTableA->SetContextAttributesA = - thunk_SetContextAttributesA; - /* this can't be thunked, there's no extra param to know which - * package to forward to */ - fnTableA->EnumerateSecurityPackagesA = NULL; - /* functions with no thunks needed */ - fnTableA->AcceptSecurityContext = inFnTableW->AcceptSecurityContext; - fnTableA->CompleteAuthToken = inFnTableW->CompleteAuthToken; - fnTableA->DeleteSecurityContext = inFnTableW->DeleteSecurityContext; - fnTableA->ImpersonateSecurityContext = - inFnTableW->ImpersonateSecurityContext; - fnTableA->RevertSecurityContext = inFnTableW->RevertSecurityContext; - fnTableA->MakeSignature = inFnTableW->MakeSignature; - fnTableA->VerifySignature = inFnTableW->VerifySignature; - fnTableA->FreeContextBuffer = inFnTableW->FreeContextBuffer; - fnTableA->QuerySecurityPackageInfoA = - QuerySecurityPackageInfoA; - fnTableA->ExportSecurityContext = - inFnTableW->ExportSecurityContext; - fnTableA->QuerySecurityContextToken = - inFnTableW->QuerySecurityContextToken; - fnTableA->EncryptMessage = inFnTableW->EncryptMessage; - fnTableA->DecryptMessage = inFnTableW->DecryptMessage; - } - } -} - -static void _makeFnTableW(PSecurityFunctionTableW fnTableW, - const SecurityFunctionTableA *inFnTableA, - const SecurityFunctionTableW *inFnTableW) -{ - if (fnTableW) - { - if (inFnTableW) - { - /* The size of the version 1 table is based on platform sdk's - * sspi.h, though the sample ssp also provided with platform sdk - * implies only functions through QuerySecurityPackageInfoA are - * implemented (yikes) - */ - size_t tableSize = inFnTableW->dwVersion == 1 ? - (const BYTE *)&inFnTableW->SetContextAttributesW - - (const BYTE *)inFnTableW : sizeof(SecurityFunctionTableW); - - memcpy(fnTableW, inFnTableW, tableSize); - /* override this, since we can do it internally anyway */ - fnTableW->QuerySecurityPackageInfoW = - QuerySecurityPackageInfoW; - } - else if (inFnTableA) - { - /* functions with thunks */ - if (inFnTableA->AcquireCredentialsHandleA) - fnTableW->AcquireCredentialsHandleW = - thunk_AcquireCredentialsHandleW; - if (inFnTableA->InitializeSecurityContextA) - fnTableW->InitializeSecurityContextW = - thunk_InitializeSecurityContextW; - if (inFnTableA->ImportSecurityContextA) - fnTableW->ImportSecurityContextW = - thunk_ImportSecurityContextW; - if (inFnTableA->AddCredentialsA) - fnTableW->AddCredentialsW = - thunk_AddCredentialsW; - if (inFnTableA->QueryCredentialsAttributesA) - fnTableW->QueryCredentialsAttributesW = - thunk_QueryCredentialsAttributesW; - if (inFnTableA->QueryContextAttributesA) - fnTableW->QueryContextAttributesW = - thunk_QueryContextAttributesW; - if (inFnTableA->SetContextAttributesA) - fnTableW->SetContextAttributesW = - thunk_SetContextAttributesW; - /* this can't be thunked, there's no extra param to know which - * package to forward to */ - fnTableW->EnumerateSecurityPackagesW = NULL; - /* functions with no thunks needed */ - fnTableW->AcceptSecurityContext = inFnTableA->AcceptSecurityContext; - fnTableW->CompleteAuthToken = inFnTableA->CompleteAuthToken; - fnTableW->DeleteSecurityContext = inFnTableA->DeleteSecurityContext; - fnTableW->ImpersonateSecurityContext = - inFnTableA->ImpersonateSecurityContext; - fnTableW->RevertSecurityContext = inFnTableA->RevertSecurityContext; - fnTableW->MakeSignature = inFnTableA->MakeSignature; - fnTableW->VerifySignature = inFnTableA->VerifySignature; - fnTableW->FreeContextBuffer = inFnTableA->FreeContextBuffer; - fnTableW->QuerySecurityPackageInfoW = - QuerySecurityPackageInfoW; - fnTableW->ExportSecurityContext = - inFnTableA->ExportSecurityContext; - fnTableW->QuerySecurityContextToken = - inFnTableA->QuerySecurityContextToken; - fnTableW->EncryptMessage = inFnTableA->EncryptMessage; - fnTableW->DecryptMessage = inFnTableA->DecryptMessage; - } - } -} - -static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA, - const SecPkgInfoW *inInfoW) -{ - if (info && (inInfoA || inInfoW)) - { - /* odd, I know, but up until Name and Comment the structures are - * identical - */ - memcpy(info, inInfoW ? inInfoW : (const SecPkgInfoW *)inInfoA, sizeof(*info)); - if (inInfoW) - { - info->Name = SECUR32_strdupW(inInfoW->Name); - info->Comment = SECUR32_strdupW(inInfoW->Comment); - } - else - { - info->Name = SECUR32_AllocWideFromMultiByte(inInfoA->Name); - info->Comment = SECUR32_AllocWideFromMultiByte(inInfoA->Comment); - } - } -} - -static -SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA, - const SecurityFunctionTableW *fnTableW, PCWSTR moduleName) -{ - SecureProvider *ret; - - EnterCriticalSection(&cs); - - if (!providerTable) - { - providerTable = HeapAlloc(GetProcessHeap(), 0, sizeof(SecureProviderTable)); - if (!providerTable) - { - LeaveCriticalSection(&cs); - return NULL; - } - - list_init(&providerTable->table); - } - - ret = HeapAlloc(GetProcessHeap(), 0, sizeof(SecureProvider)); - if (!ret) - { - LeaveCriticalSection(&cs); - return NULL; - } - - list_add_tail(&providerTable->table, &ret->entry); - ret->lib = NULL; - - if (fnTableA || fnTableW) - { - ret->moduleName = moduleName ? SECUR32_strdupW(moduleName) : NULL; - _makeFnTableA(&ret->fnTableA, fnTableA, fnTableW); - _makeFnTableW(&ret->fnTableW, fnTableA, fnTableW); - ret->loaded = !moduleName; - } - else - { - ret->moduleName = SECUR32_strdupW(moduleName); - ret->loaded = FALSE; - } - - LeaveCriticalSection(&cs); - return ret; -} - -static -void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd, - const SecPkgInfoA *infoA, const SecPkgInfoW *infoW) -{ - ULONG i; - - assert(provider); - assert(infoA || infoW); - - EnterCriticalSection(&cs); - - if (!packageTable) - { - packageTable = HeapAlloc(GetProcessHeap(), 0, sizeof(SecurePackageTable)); - if (!packageTable) - { - LeaveCriticalSection(&cs); - return; - } - - packageTable->numPackages = 0; - list_init(&packageTable->table); - } - - for (i = 0; i < toAdd; i++) - { - SecurePackage *package = HeapAlloc(GetProcessHeap(), 0, sizeof(SecurePackage)); - if (!package) - continue; - - list_add_tail(&packageTable->table, &package->entry); - - package->provider = provider; - _copyPackageInfo(&package->infoW, - infoA ? &infoA[i] : NULL, - infoW ? &infoW[i] : NULL); - } - packageTable->numPackages += toAdd; - - LeaveCriticalSection(&cs); -} - -static void _tryLoadProvider(PWSTR moduleName) -{ - HMODULE lib = LoadLibraryW(moduleName); - - if (lib) - { - INIT_SECURITY_INTERFACE_W pInitSecurityInterfaceW = - (INIT_SECURITY_INTERFACE_W)GetProcAddress(lib, - SECURITY_ENTRYPOINT_ANSIW); - INIT_SECURITY_INTERFACE_A pInitSecurityInterfaceA = - (INIT_SECURITY_INTERFACE_A)GetProcAddress(lib, - SECURITY_ENTRYPOINT_ANSIA); - - TRACE("loaded %s, InitSecurityInterfaceA is %p, InitSecurityInterfaceW is %p\n", - debugstr_w(moduleName), pInitSecurityInterfaceA, - pInitSecurityInterfaceW); - if (pInitSecurityInterfaceW || pInitSecurityInterfaceA) - { - PSecurityFunctionTableA fnTableA = NULL; - PSecurityFunctionTableW fnTableW = NULL; - ULONG toAdd = 0; - PSecPkgInfoA infoA = NULL; - PSecPkgInfoW infoW = NULL; - SECURITY_STATUS ret = SEC_E_OK; - - if (pInitSecurityInterfaceA) - fnTableA = pInitSecurityInterfaceA(); - if (pInitSecurityInterfaceW) - fnTableW = pInitSecurityInterfaceW(); - if (fnTableW && fnTableW->EnumerateSecurityPackagesW) - { - if (fnTableW != &securityFunctionTableW) - ret = fnTableW->EnumerateSecurityPackagesW(&toAdd, &infoW); - else - TRACE("%s has built-in providers, skip adding\n", debugstr_w(moduleName)); - } - else if (fnTableA && fnTableA->EnumerateSecurityPackagesA) - { - if (fnTableA != &securityFunctionTableA) - ret = fnTableA->EnumerateSecurityPackagesA(&toAdd, &infoA); - else - TRACE("%s has built-in providers, skip adding\n", debugstr_w(moduleName)); - } - if (ret == SEC_E_OK && toAdd > 0 && (infoW || infoA)) - { - SecureProvider *provider = SECUR32_addProvider(NULL, NULL, - moduleName); - - if (provider) - SECUR32_addPackages(provider, toAdd, infoA, infoW); - if (infoW) - fnTableW->FreeContextBuffer(infoW); - else - fnTableA->FreeContextBuffer(infoA); - } - } - FreeLibrary(lib); - } - else - WARN("failed to load %s\n", debugstr_w(moduleName)); -} - -static const WCHAR securityProvidersKeyW[] = { - 'S','Y','S','T','E','M','\\','C','u','r','r','e','n','t','C','o','n','t','r', - 'o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','S','e','c','u','r', - 'i','t','y','P','r','o','v','i','d','e','r','s','\0' - }; -static const WCHAR securityProvidersW[] = { - 'S','e','c','u','r','i','t','y','P','r','o','v','i','d','e','r','s',0 - }; - - /* FIXME: we're missing SECUR32_freeProviders, so all of this gets leaked */ -static void SECUR32_initializeProviders(void) -{ - HKEY key; - LSTATUS apiRet; - - /* Now load providers from registry */ - apiRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, securityProvidersKeyW, 0, - KEY_READ, &key); - if (apiRet == ERROR_SUCCESS) - { - WCHAR securityPkgNames[MAX_PATH]; /* arbitrary len */ - DWORD size = sizeof(securityPkgNames) / sizeof(WCHAR), type; - - apiRet = RegQueryValueExW(key, securityProvidersW, NULL, &type, - (PBYTE)securityPkgNames, &size); - if (apiRet == ERROR_SUCCESS && type == REG_SZ) - { - WCHAR *ptr; - - size = size / sizeof(WCHAR); - for (ptr = securityPkgNames; - ptr < securityPkgNames + size; ) - { - WCHAR *comma; - - for (comma = ptr; *comma && *comma != ','; comma++) - ; - if (*comma == ',') - *comma = '\0'; - for (; *ptr && isspace(*ptr) && ptr < securityPkgNames + size; - ptr++) - ; - if (*ptr) - _tryLoadProvider(ptr); - ptr += lstrlenW(ptr) + 1; - } - } - RegCloseKey(key); - } -} - -SecurePackage *SECUR32_findPackageW(PCWSTR packageName) -{ - SecurePackage *ret = NULL; - BOOL matched = FALSE; - -#ifdef __REACTOS__ - if (!packageTable) - SECUR32_initializeProviders(); -#endif - - if (packageTable && packageName) - { - LIST_FOR_EACH_ENTRY(ret, &packageTable->table, SecurePackage, entry) - { - matched = !lstrcmpiW(ret->infoW.Name, packageName); - if (matched) - break; - } - - if (!matched) - return NULL; - - if (ret->provider && !ret->provider->loaded) - { - ret->provider->lib = LoadLibraryW(ret->provider->moduleName); - if (ret->provider->lib) - { - INIT_SECURITY_INTERFACE_W pInitSecurityInterfaceW = - (INIT_SECURITY_INTERFACE_W)GetProcAddress(ret->provider->lib, - SECURITY_ENTRYPOINT_ANSIW); - INIT_SECURITY_INTERFACE_A pInitSecurityInterfaceA = - (INIT_SECURITY_INTERFACE_A)GetProcAddress(ret->provider->lib, - SECURITY_ENTRYPOINT_ANSIA); - PSecurityFunctionTableA fnTableA = NULL; - PSecurityFunctionTableW fnTableW = NULL; - - if (pInitSecurityInterfaceA) - fnTableA = pInitSecurityInterfaceA(); - if (pInitSecurityInterfaceW) - fnTableW = pInitSecurityInterfaceW(); - /* don't update built-in SecurityFunctionTable */ - if (fnTableA != &securityFunctionTableA) - _makeFnTableA(&ret->provider->fnTableA, fnTableA, fnTableW); - if (fnTableW != &securityFunctionTableW) - _makeFnTableW(&ret->provider->fnTableW, fnTableA, fnTableW); - ret->provider->loaded = TRUE; - } - else - ret = NULL; - } - } - return ret; -} - -SecurePackage *SECUR32_findPackageA(PCSTR packageName) -{ - SecurePackage *ret; - - if (packageName) - { - UNICODE_STRING package; - - RtlCreateUnicodeStringFromAsciiz(&package, packageName); - ret = SECUR32_findPackageW(package.Buffer); - RtlFreeUnicodeString(&package); - } - else - ret = NULL; - return ret; -} - -/*********************************************************************** - * FreeContextBuffer (SECUR32.@) - * - * Doh--if pv was allocated by a crypto package, this may not be correct. - * The sample ssp seems to use LocalAlloc/LocalFee, but there doesn't seem to - * be any guarantee, nor is there an alloc function in secur32. - */ -SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv) -{ - HeapFree(GetProcessHeap(), 0, pv); - - return SEC_E_OK; -} /*********************************************************************** * EnumerateSecurityPackagesW (SECUR32.@) @@ -656,12 +84,7 @@ TRACE("(%p, %p)\n", pcPackages, ppPackageInfo); -#ifdef __REACTOS__ - if (!packageTable) - SECUR32_initializeProviders(); -#endif - - /* windows just crashes if pcPackages or ppPackageInfo is NULL, so will I */ + *ppPackageInfo = NULL; *pcPackages = 0; EnterCriticalSection(&cs); if (packageTable) @@ -725,7 +148,7 @@ /* Converts info (which is assumed to be an array of cPackages SecPkgInfoW * structures) into an array of SecPkgInfoA structures, which it returns. */ -static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages, +PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages, const SecPkgInfoW *info) { PSecPkgInfoA ret; @@ -815,280 +238,46 @@ return ret; } -/*********************************************************************** - * GetComputerObjectNameA (SECUR32.@) - * - * Get the local computer's name using the format specified. - * - * PARAMS - * NameFormat [I] The format for the name. - * lpNameBuffer [O] Pointer to buffer to receive the name. - * nSize [I/O] Size in characters of buffer. - * - * RETURNS - * TRUE If the name was written to lpNameBuffer. - * FALSE If the name couldn't be written. - * - * NOTES - * If lpNameBuffer is NULL, then the size of the buffer needed to hold the - * name will be returned in *nSize. - * - * nSize returns the number of characters written when lpNameBuffer is not - * NULL or the size of the buffer needed to hold the name when the buffer - * is too short or lpNameBuffer is NULL. - * - * It the buffer is too short, ERROR_INSUFFICIENT_BUFFER error will be set. - */ -BOOLEAN WINAPI GetComputerObjectNameA( - EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize) -{ - BOOLEAN rc; - LPWSTR bufferW = NULL; - ULONG sizeW = *nSize; - TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); - if (lpNameBuffer) { - bufferW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR)); - if (bufferW == NULL) { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - } - rc = GetComputerObjectNameW(NameFormat, bufferW, &sizeW); - if (rc && bufferW) { - ULONG len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, bufferW, -1, lpNameBuffer, *nSize, NULL, NULL); - *nSize = len; - } - else - *nSize = sizeW; - HeapFree(GetProcessHeap(), 0, bufferW); - return rc; -} - -/*********************************************************************** - * GetComputerObjectNameW (SECUR32.@) - */ -BOOLEAN WINAPI GetComputerObjectNameW( - EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize) -{ - LSA_HANDLE policyHandle; - LSA_OBJECT_ATTRIBUTES objectAttributes; - PPOLICY_DNS_DOMAIN_INFO domainInfo; - NTSTATUS ntStatus; - BOOLEAN status; - TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); - - if (NameFormat == NameUnknown) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - ZeroMemory(&objectAttributes, sizeof(objectAttributes)); - objectAttributes.Length = sizeof(objectAttributes); - - ntStatus = LsaOpenPolicy(NULL, &objectAttributes, - POLICY_VIEW_LOCAL_INFORMATION, - &policyHandle); - if (ntStatus != STATUS_SUCCESS) - { - SetLastError(LsaNtStatusToWinError(ntStatus)); - WARN("LsaOpenPolicy failed with NT status %u\n", GetLastError()); - return FALSE; - } - - ntStatus = LsaQueryInformationPolicy(policyHandle, - PolicyDnsDomainInformation, - (PVOID *)&domainInfo); - if (ntStatus != STATUS_SUCCESS) - { - SetLastError(LsaNtStatusToWinError(ntStatus)); - WARN("LsaQueryInformationPolicy failed with NT status %u\n", - GetLastError()); - LsaClose(policyHandle); - return FALSE; - } - - if (domainInfo->Sid) - { - switch (NameFormat) - { - case NameSamCompatible: - { - WCHAR name[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD size = sizeof(name)/sizeof(name[0]); - if (GetComputerNameW(name, &size)) - { - DWORD len = domainInfo->Name.Length + size + 3; - if (lpNameBuffer) - { - if (*nSize < len) - { - *nSize = len; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - status = FALSE; - } - else - { - WCHAR bs[] = { '\\', 0 }; - WCHAR ds[] = { '$', 0 }; - lstrcpyW(lpNameBuffer, domainInfo->Name.Buffer); - lstrcatW(lpNameBuffer, bs); - lstrcatW(lpNameBuffer, name); - lstrcatW(lpNameBuffer, ds); - status = TRUE; - } - } - else /* just requesting length required */ - { - *nSize = len; - status = TRUE; - } - } - else - { - SetLastError(ERROR_INTERNAL_ERROR); - status = FALSE; - } - } - break; - case NameFullyQualifiedDN: - case NameDisplay: - case NameUniqueId: - case NameCanonical: - case NameUserPrincipal: - case NameCanonicalEx: - case NameServicePrincipal: - case NameDnsDomain: - FIXME("NameFormat %d not implemented\n", NameFormat); - SetLastError(ERROR_CANT_ACCESS_DOMAIN_INFO); - status = FALSE; - break; - default: - SetLastError(ERROR_INVALID_PARAMETER); - status = FALSE; - } - } - else - { - SetLastError(ERROR_CANT_ACCESS_DOMAIN_INFO); - status = FALSE; - } - - LsaFreeMemory(domainInfo); - LsaClose(policyHandle); - - return status; -} - -/*********************************************************************** - * GetUserNameExA (SECUR32.@) - */ -BOOLEAN WINAPI GetUserNameExA( - EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize) -{ - BOOLEAN rc; - LPWSTR bufferW = NULL; - ULONG sizeW = *nSize; - TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); - if (lpNameBuffer) { - bufferW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR)); - if (bufferW == NULL) { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - } - rc = GetUserNameExW(NameFormat, bufferW, &sizeW); - if (rc) { - ULONG len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL); - if (len <= *nSize) - { - WideCharToMultiByte(CP_ACP, 0, bufferW, -1, lpNameBuffer, *nSize, NULL, NULL); - *nSize = len - 1; - } - else - { - *nSize = len; - rc = FALSE; - SetLastError(ERROR_MORE_DATA); - } - } - else - *nSize = sizeW; - HeapFree(GetProcessHeap(), 0, bufferW); - return rc; -} - -BOOLEAN WINAPI GetUserNameExW( - EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize) -{ - TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); - - switch (NameFormat) - { - case NameSamCompatible: - { - WCHAR samname[UNLEN + 1 + MAX_COMPUTERNAME_LENGTH + 1]; - LPWSTR out; - DWORD len; - - /* This assumes the current user is always a local account */ - len = MAX_COMPUTERNAME_LENGTH + 1; - if (GetComputerNameW(samname, &len)) - { - out = samname + lstrlenW(samname); - *out++ = '\\'; - len = UNLEN + 1; - if (GetUserNameW(out, &len)) - { - if (lstrlenW(samname) < *nSize) - { - lstrcpyW(lpNameBuffer, samname); - *nSize = lstrlenW(samname); - return TRUE; - } - - SetLastError(ERROR_MORE_DATA); - *nSize = lstrlenW(samname) + 1; - } - } - return FALSE; - } - - case NameUnknown: - case NameFullyQualifiedDN: - case NameDisplay: - case NameUniqueId: - case NameCanonical: - case NameUserPrincipal: - case NameCanonicalEx: - case NameServicePrincipal: - case NameDnsDomain: - SetLastError(ERROR_NONE_MAPPED); - return FALSE; - - default: - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } -} - -BOOLEAN WINAPI TranslateNameA( - LPCSTR lpAccountName, EXTENDED_NAME_FORMAT AccountNameFormat, - EXTENDED_NAME_FORMAT DesiredNameFormat, LPSTR lpTranslatedName, - PULONG nSize) -{ - FIXME("%p %d %d %p %p\n", lpAccountName, AccountNameFormat, - DesiredNameFormat, lpTranslatedName, nSize); - return FALSE; -} - -BOOLEAN WINAPI TranslateNameW( - LPCWSTR lpAccountName, EXTENDED_NAME_FORMAT AccountNameFormat, - EXTENDED_NAME_FORMAT DesiredNameFormat, LPWSTR lpTranslatedName, - PULONG nSize) -{ - FIXME("%p %d %d %p %p\n", lpAccountName, AccountNameFormat, - DesiredNameFormat, lpTranslatedName, nSize); - return FALSE; -} +SECURITY_STATUS +WINAPI +ApplyControlTokenW(PCtxtHandle Handle, + PSecBufferDesc Buffer) +{ + UNIMPLEMENTED; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +SECURITY_STATUS +WINAPI +ApplyControlTokenA(PCtxtHandle Handle, + PSecBufferDesc Buffer) +{ + UNIMPLEMENTED; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +SECURITY_STATUS +WINAPI +FreeContextBuffer ( + PVOID pvoid + ) +{ + HeapFree(GetProcessHeap(), 0, pvoid); + return SEC_E_OK; +} + +PSecurityFunctionTableW +WINAPI +InitSecurityInterfaceW(VOID) +{ + return &securityFunctionTableW; +} + + +PSecurityFunctionTableA +WINAPI +InitSecurityInterfaceA(VOID) +{ + return &securityFunctionTableA; +} + Modified: branches/sspi-bringup/reactos/dll/win32/secur32/stubs.c URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/stubs.c?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/stubs.c [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/stubs.c [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -1,11 +1,10 @@ -#include "precomp.h" + +#include <precomp.h> + +#include <precomp.h> #define NDEBUG #include <reactos/debug.h> - -#define SEC_ENTRY WINAPI - -typedef PVOID PSECURITY_PACKAGE_OPTIONS, PSecurityUserData; SECURITY_STATUS SEC_ENTRY @@ -49,3 +48,27 @@ UNIMPLEMENTED; return STATUS_UNSUCCESSFUL; } + +SECURITY_STATUS +SEC_ENTRY +UnsealMessage( + LSA_SEC_HANDLE ContextHandle, + PSecBufferDesc MessageBuffers, + ULONG MessageSequenceNumber, + PULONG QualityOfProtection) +{ + UNIMPLEMENTED; + return STATUS_UNSUCCESSFUL; +} + +SECURITY_STATUS +SEC_ENTRY +SealMessage( + LSA_SEC_HANDLE ContextHandle, + ULONG QualityOfProtection, + PSecBufferDesc MessageBuffers, + ULONG MessageSequenceNumber) +{ + UNIMPLEMENTED; + return STATUS_UNSUCCESSFUL; +} Modified: branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -17,7 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <precomp.h> #include "wine/debug.h" Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c ------------------------------------------------------------------------------ --- charset (original) +++ charset (removed) @@ -1 +0,0 @@ -UTF-8 Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/thunks.c ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type (removed) @@ -1 +0,0 @@ -text/plain Modified: branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -27,48 +27,48 @@ SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleA( SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, - PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry) DECLSPEC_HIDDEN; + PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry); SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleW( SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, - PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry) DECLSPEC_HIDDEN; + PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry); SECURITY_STATUS SEC_ENTRY thunk_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) DECLSPEC_HIDDEN; + ULONG *pfContextAttr, PTimeStamp ptsExpiry); SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextW( 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) DECLSPEC_HIDDEN; + ULONG *pfContextAttr, PTimeStamp ptsExpiry); SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextA( SEC_CHAR *pszPackage, PSecBuffer pPackedContext, void *Token, - PCtxtHandle phContext) DECLSPEC_HIDDEN; + PCtxtHandle phContext); SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW( SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, void *Token, - PCtxtHandle phContext) DECLSPEC_HIDDEN; + PCtxtHandle phContext); SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsA(PCredHandle hCredentials, SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, - PTimeStamp ptsExpiry) DECLSPEC_HIDDEN; + PTimeStamp ptsExpiry); SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsW(PCredHandle hCredentials, SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, - PTimeStamp ptsExpiry) DECLSPEC_HIDDEN; + PTimeStamp ptsExpiry); SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesA( - PCredHandle phCredential, ULONG ulAttribute, void *pBuffer) DECLSPEC_HIDDEN; + PCredHandle phCredential, ULONG ulAttribute, void *pBuffer); SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesW( - PCredHandle phCredential, ULONG ulAttribute, void *pBuffer) DECLSPEC_HIDDEN; + PCredHandle phCredential, ULONG ulAttribute, void *pBuffer); SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesA( - PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer) DECLSPEC_HIDDEN; + PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer); SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesW( - PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer) DECLSPEC_HIDDEN; + PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer); SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesA(PCtxtHandle phContext, - ULONG ulAttribute, void *pBuffer, ULONG cbBuffer) DECLSPEC_HIDDEN; + ULONG ulAttribute, void *pBuffer, ULONG cbBuffer); SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesW(PCtxtHandle phContext, - ULONG ulAttribute, void *pBuffer, ULONG cbBuffer) DECLSPEC_HIDDEN; + ULONG ulAttribute, void *pBuffer, ULONG cbBuffer); #endif /* ndef __SECUR32_THUNKS_H__ */ Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h ------------------------------------------------------------------------------ --- charset (original) +++ charset (removed) @@ -1 +0,0 @@ -UTF-8 Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/thunks.h ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type (removed) @@ -1 +0,0 @@ -text/plain Modified: branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c URL: http://svn.reactos.org/svn/reactos/branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c?rev=73753&r1=73752&r2=73753&view=diff ============================================================================== --- branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c [iso-8859-1] (original) +++ branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c [iso-8859-1] Wed Feb 8 02:37:58 2017 @@ -16,7 +16,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" + +#include <precomp.h> #include "wine/debug.h" @@ -32,7 +33,7 @@ { SECURITY_STATUS ret; - TRACE("%p %p %p\n", phSec, package, realHandle); + TRACE("makeSecHandle %p %p %p\n", phSec, package, realHandle); if (phSec && package && realHandle) { @@ -151,9 +152,9 @@ SECURITY_STATUS WINAPI FreeCredentialsHandle( PCredHandle phCredential) { - SECURITY_STATUS ret; - - TRACE("%p\n", phCredential); + SECURITY_STATUS ret = SEC_E_INVALID_HANDLE; + + TRACE("FreeCredentialsHandle %p\n", phCredential); if (phCredential) { SecurePackage *package = (SecurePackage *)phCredential->dwUpper; @@ -162,12 +163,9 @@ if (package && package->provider && package->provider->fnTableW.FreeCredentialsHandle) ret = package->provider->fnTableW.FreeCredentialsHandle(cred); - else - ret = SEC_E_INVALID_HANDLE; HeapFree(GetProcessHeap(), 0, cred); } - else - ret = SEC_E_INVALID_HANDLE; + return ret; } @@ -788,6 +786,7 @@ { (*ppPackageInfo)->Comment = nextString; lstrcpynW(nextString, package->infoW.Comment, commentLen); + nextString += commentLen; } else (*ppPackageInfo)->Comment = NULL; Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c ------------------------------------------------------------------------------ --- charset (original) +++ charset (removed) @@ -1 +0,0 @@ -UTF-8 Propchange: branches/sspi-bringup/reactos/dll/win32/secur32/wrapper.c ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type (removed) @@ -1 +0,0 @@ -text/plain