From d87e26dee722bc3611c6f0b22109cfe6cab671ce Mon Sep 17 00:00:00 2001 From: The Wine Synchronizer Date: Fri, 4 Jan 2008 21:53:55 +0000 Subject: [PATCH] Autosyncing with Wine HEAD svn path=/trunk/; revision=31598 --- reactos/dll/win32/schannel/lsamode.c | 158 +++++++++++++++++++++ reactos/dll/win32/schannel/schannel.rbuild | 19 +++ reactos/dll/win32/schannel/schannel.spec | 37 +++++ reactos/dll/win32/schannel/schannel_main.c | 40 ++++++ reactos/dll/win32/schannel/usermode.c | 85 +++++++++++ reactos/dll/win32/schannel/version.rc | 26 ++++ 6 files changed, 365 insertions(+) create mode 100644 reactos/dll/win32/schannel/lsamode.c create mode 100644 reactos/dll/win32/schannel/schannel.rbuild create mode 100644 reactos/dll/win32/schannel/schannel.spec create mode 100644 reactos/dll/win32/schannel/schannel_main.c create mode 100644 reactos/dll/win32/schannel/usermode.c create mode 100644 reactos/dll/win32/schannel/version.rc diff --git a/reactos/dll/win32/schannel/lsamode.c b/reactos/dll/win32/schannel/lsamode.c new file mode 100644 index 00000000000..23d85994cc4 --- /dev/null +++ b/reactos/dll/win32/schannel/lsamode.c @@ -0,0 +1,158 @@ +/* + * LSA-mode functions of the SChannel security provider + * + * Copyright 2007 Yuval Fledel + * + * 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 + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "sspi.h" +#include "ntsecapi.h" +#include "ntsecpkg.h" +#include "schannel.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(schannel); + +/*********************************************************************** + * SpGetInfoUnified + */ +static NTSTATUS WINAPI SpGetInfoUnified(PSecPkgInfoW PackageInfo) +{ + TRACE("(%p)\n", PackageInfo); + + PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH | + 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_STREAM; + PackageInfo->wVersion = 1; + PackageInfo->wRPCID = UNISP_RPC_ID; + PackageInfo->cbMaxToken = 0x4000; + PackageInfo->Name = (LPWSTR)UNISP_NAME_W; + PackageInfo->Comment = (LPWSTR)UNISP_NAME_W; + + return STATUS_SUCCESS; +} + +static SEC_WCHAR schannelCommentW[] = { 'S','c','h','a','n','n','e','l', + ' ','S','e','c','u','r','i','t','y',' ','P','a','c','k','a','g','e',0 }; + +/*********************************************************************** + * SpGetInfoSChannel + */ +static NTSTATUS WINAPI SpGetInfoSChannel(PSecPkgInfoW PackageInfo) +{ + TRACE("(%p)\n", PackageInfo); + + PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH | + 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_STREAM; + PackageInfo->wVersion = 1; + PackageInfo->wRPCID = UNISP_RPC_ID; + PackageInfo->cbMaxToken = 0x4000; + PackageInfo->Name = (LPWSTR)SCHANNEL_NAME_W; + PackageInfo->Comment = schannelCommentW; + + return STATUS_SUCCESS; +} + +static SECPKG_FUNCTION_TABLE secPkgFunctionTable[2] = +{ { + NULL, /* InitializePackage */ + NULL, /* LsaLogonUser */ + NULL, /* CallPackage */ + NULL, /* LogonTerminated */ + NULL, /* CallPackageUntrusted */ + NULL, /* CallPackagePassthrough */ + NULL, /* LogonUserEx */ + NULL, /* LogonUserEx2 */ + NULL, /* Initialize */ + NULL, /* Shutdown */ + SpGetInfoUnified, + NULL, /* AcceptCredentials */ + NULL, /* SpAcquireCredentialsHandle */ + NULL, /* SpQueryCredentialsAttributes */ + NULL, /* FreeCredentialsHandle */ + NULL, /* SaveCredentials */ + NULL, /* GetCredentials */ + NULL, /* DeleteCredentials */ + NULL, /* InitLsaModeContext */ + NULL, /* AcceptLsaModeContext */ + NULL, /* DeleteContext */ + NULL, /* ApplyControlToken */ + NULL, /* GetUserInfo */ + NULL, /* GetExtendedInformation */ + NULL, /* SpQueryContextAttributes */ + NULL, /* SpAddCredentials */ + NULL, /* SetExtendedInformation */ + NULL, /* SetContextAttributes */ + NULL, /* SetCredentialsAttributes */ + }, { + NULL, /* InitializePackage */ + NULL, /* LsaLogonUser */ + NULL, /* CallPackage */ + NULL, /* LogonTerminated */ + NULL, /* CallPackageUntrusted */ + NULL, /* CallPackagePassthrough */ + NULL, /* LogonUserEx */ + NULL, /* LogonUserEx2 */ + NULL, /* Initialize */ + NULL, /* Shutdown */ + SpGetInfoSChannel, + NULL, /* AcceptCredentials */ + NULL, /* SpAcquireCredentialsHandle */ + NULL, /* SpQueryCredentialsAttributes */ + NULL, /* FreeCredentialsHandle */ + NULL, /* SaveCredentials */ + NULL, /* GetCredentials */ + NULL, /* DeleteCredentials */ + NULL, /* InitLsaModeContext */ + NULL, /* AcceptLsaModeContext */ + NULL, /* DeleteContext */ + NULL, /* ApplyControlToken */ + NULL, /* GetUserInfo */ + NULL, /* GetExtendedInformation */ + NULL, /* SpQueryContextAttributes */ + NULL, /* SpAddCredentials */ + NULL, /* SetExtendedInformation */ + NULL, /* SetContextAttributes */ + NULL, /* SetCredentialsAttributes */ + } +}; + +/*********************************************************************** + * SpLsaModeInitialize (SCHANNEL.@) + */ +NTSTATUS WINAPI SpLsaModeInitialize(ULONG LsaVersion, PULONG PackageVersion, + PSECPKG_FUNCTION_TABLE *ppTables, PULONG pcTables) +{ + TRACE("(%u, %p, %p, %p)\n", LsaVersion, PackageVersion, ppTables, pcTables); + + *PackageVersion = SECPKG_INTERFACE_VERSION_3; + *pcTables = 2; + *ppTables = secPkgFunctionTable; + + return STATUS_SUCCESS; +} diff --git a/reactos/dll/win32/schannel/schannel.rbuild b/reactos/dll/win32/schannel/schannel.rbuild new file mode 100644 index 00000000000..3a085816706 --- /dev/null +++ b/reactos/dll/win32/schannel/schannel.rbuild @@ -0,0 +1,19 @@ + + + + + . + include/reactos/wine + + 0x600 + 0x600 + wine + secur32 + kernel32 + ntdll + lsamode.c + schannel_main.c + usermode.c + version.rc + schannel.spec + diff --git a/reactos/dll/win32/schannel/schannel.spec b/reactos/dll/win32/schannel/schannel.spec new file mode 100644 index 00000000000..c330c83ff93 --- /dev/null +++ b/reactos/dll/win32/schannel/schannel.spec @@ -0,0 +1,37 @@ +@ stdcall AcceptSecurityContext(ptr ptr ptr long long ptr ptr ptr ptr) secur32.AcceptSecurityContext +@ stdcall AcquireCredentialsHandleA(str str long ptr ptr ptr ptr ptr ptr) secur32.AcquireCredentialsHandleA +@ stdcall AcquireCredentialsHandleW(wstr wstr long ptr ptr ptr ptr ptr ptr) secur32.AcquireCredentialsHandleW +@ stdcall ApplyControlToken(ptr ptr) secur32.ApplyControlToken +@ stub CloseSslPerformanceData +@ stub CollectSslPerformanceData +@ stdcall CompleteAuthToken(ptr ptr) secur32.CompleteAuthToken +@ stdcall DeleteSecurityContext(ptr) secur32.DeleteSecurityContext +@ stdcall EnumerateSecurityPackagesA(ptr ptr) secur32.EnumerateSecurityPackagesA +@ stdcall EnumerateSecurityPackagesW(ptr ptr) secur32.EnumerateSecurityPackagesW +@ stdcall FreeContextBuffer(ptr) secur32.FreeContextBuffer +@ stdcall FreeCredentialsHandle(ptr) secur32.FreeCredentialsHandle +@ stdcall ImpersonateSecurityContext(ptr) secur32.ImpersonateSecurityContext +@ stdcall InitSecurityInterfaceA() secur32.InitSecurityInterfaceA +@ stdcall InitSecurityInterfaceW() secur32.InitSecurityInterfaceW +@ stdcall InitializeSecurityContextA(ptr ptr str long long long ptr long ptr ptr ptr ptr) secur32.InitializeSecurityContextA +@ stdcall InitializeSecurityContextW(ptr ptr wstr long long long ptr long ptr ptr ptr ptr) secur32.InitializeSecurityContextW +@ stdcall MakeSignature(ptr long ptr long) secur32.MakeSignature +@ stub OpenSslPerformanceData +@ stdcall QueryContextAttributesA(ptr long ptr) secur32.QueryContextAttributesA +@ stdcall QueryContextAttributesW(ptr long ptr) secur32.QueryContextAttributesW +@ stdcall QuerySecurityPackageInfoA(str ptr) secur32.QuerySecurityPackageInfoA +@ stdcall QuerySecurityPackageInfoW(wstr ptr) secur32.QuerySecurityPackageInfoW +@ stdcall RevertSecurityContext(ptr) secur32.RevertSecurityContext +@ stdcall SealMessage(ptr long ptr long) secur32.SealMessage +@ stdcall SpLsaModeInitialize(long ptr ptr ptr) +@ stdcall SpUserModeInitialize(long ptr ptr ptr) +@ stub SslCrackCertificate +@ stub SslEmptyCacheA +@ stub SslEmptyCacheW +@ stub SslFreeCertificate +@ stub SslGenerateKeyPair +@ stub SslGenerateRandomBits +@ stub SslGetMaximumKeySize +@ stub SslLoadCertificate +@ stdcall UnsealMessage(ptr ptr long ptr) secur32.UnsealMessage +@ stdcall VerifySignature(ptr ptr long ptr) secur32.VerifySignature diff --git a/reactos/dll/win32/schannel/schannel_main.c b/reactos/dll/win32/schannel/schannel_main.c new file mode 100644 index 00000000000..9889c5da437 --- /dev/null +++ b/reactos/dll/win32/schannel/schannel_main.c @@ -0,0 +1,40 @@ +/* + * SSL/TLS Security Library + * + * Copyright 2007 Rob Shearman, for CodeWeavers + * + * 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 + +#include "windef.h" +#include "winbase.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(schannel); + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved); + + if (fdwReason == DLL_WINE_PREATTACH) return FALSE; /* prefer native version */ + + if (fdwReason == DLL_PROCESS_ATTACH) + DisableThreadLibraryCalls(hinstDLL); + + return TRUE; +} diff --git a/reactos/dll/win32/schannel/usermode.c b/reactos/dll/win32/schannel/usermode.c new file mode 100644 index 00000000000..0713f822f91 --- /dev/null +++ b/reactos/dll/win32/schannel/usermode.c @@ -0,0 +1,85 @@ +/* + * User-mode functions of the SChannel security provider + * + * Copyright 2007 Yuval Fledel + * + * 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 + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "sspi.h" +#include "ntsecapi.h" +#include "ntsecpkg.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(schannel); + +static SECPKG_USER_FUNCTION_TABLE secPkgUserTables[2] = +{ { + NULL, /* InstanceInit */ + NULL, /* InitUserModeContext */ + NULL, /* MakeSignature */ + NULL, /* VerifySignature */ + NULL, /* SealMessage */ + NULL, /* UnsealMessage */ + NULL, /* GetContextToken */ + NULL, /* SpQueryContextAttributes */ + NULL, /* CompleteAuthToken */ + NULL, /* DeleteUserModeContext */ + NULL, /* FormatCredentials */ + NULL, /* MarshallSupplementalCreds */ + NULL, /* ExportContext */ + NULL, /* ImportContext */ + }, { + NULL, /* InstanceInit */ + NULL, /* InitUserModeContext */ + NULL, /* MakeSignature */ + NULL, /* VerifySignature */ + NULL, /* SealMessage */ + NULL, /* UnsealMessage */ + NULL, /* GetContextToken */ + NULL, /* SpQueryContextAttributes */ + NULL, /* CompleteAuthToken */ + NULL, /* DeleteUserModeContext */ + NULL, /* FormatCredentials */ + NULL, /* MarshallSupplementalCreds */ + NULL, /* ExportContext */ + NULL, /* ImportContext */ + } +}; + +/*********************************************************************** + * SpUserModeInitialize (SCHANNEL.@) + */ +NTSTATUS WINAPI SpUserModeInitialize(ULONG LsaVersion, PULONG PackageVersion, + PSECPKG_USER_FUNCTION_TABLE *ppTables, PULONG pcTables) +{ + TRACE("(%u, %p, %p, %p)\n", LsaVersion, PackageVersion, ppTables, pcTables); + + if (LsaVersion != SECPKG_INTERFACE_VERSION) + return STATUS_INVALID_PARAMETER; + + *PackageVersion = SECPKG_INTERFACE_VERSION; + *pcTables = 2; + *ppTables = secPkgUserTables; + + return STATUS_SUCCESS; +} diff --git a/reactos/dll/win32/schannel/version.rc b/reactos/dll/win32/schannel/version.rc new file mode 100644 index 00000000000..0b41bd5d7dc --- /dev/null +++ b/reactos/dll/win32/schannel/version.rc @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2007 Detlef Riekenberg + * + * 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 + */ + +#define WINE_FILEDESCRIPTION_STR "Wine schannel" +#define WINE_FILENAME_STR "schannel.dll" +#define WINE_FILEVERSION 5,1,2600,2180 +#define WINE_FILEVERSION_STR "5.1.2600.2180" +#define WINE_PRODUCTVERSION 5,1,2600,2180 +#define WINE_PRODUCTVERSION_STR "5.1.2600.2180" + +#include "wine/wine_common_ver.rc"