7429b2c070e70d451956fce1618d19c168bbcd11
[reactos.git] / reactos / dll / win32 / schannel / lsamode.c
1 /*
2 * LSA-mode functions of the SChannel security provider
3 *
4 * Copyright 2007 Yuval Fledel
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include <stdarg.h>
22
23 #include <ntstatus.h>
24 #define WIN32_NO_STATUS
25 #define _INC_WINDOWS
26 #define COM_NO_WINDOWS_H
27 #include <windef.h>
28 #include <winbase.h>
29 #include <sspi.h>
30 #include <ntsecapi.h>
31 #include <ntsecpkg.h>
32 #include <schannel.h>
33
34 #include <wine/debug.h>
35
36 WINE_DEFAULT_DEBUG_CHANNEL(schannel);
37
38 /***********************************************************************
39 * SpGetInfoUnified
40 */
41 static NTSTATUS WINAPI SpGetInfoUnified(PSecPkgInfoW PackageInfo)
42 {
43 TRACE("(%p)\n", PackageInfo);
44
45 PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH |
46 SECPKG_FLAG_INTEGRITY | SECPKG_FLAG_PRIVACY |
47 SECPKG_FLAG_CONNECTION | SECPKG_FLAG_MULTI_REQUIRED |
48 SECPKG_FLAG_EXTENDED_ERROR | SECPKG_FLAG_IMPERSONATION |
49 SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_STREAM;
50 PackageInfo->wVersion = 1;
51 PackageInfo->wRPCID = UNISP_RPC_ID;
52 PackageInfo->cbMaxToken = 0x4000;
53 PackageInfo->Name = (LPWSTR)UNISP_NAME_W;
54 PackageInfo->Comment = (LPWSTR)UNISP_NAME_W;
55
56 return STATUS_SUCCESS;
57 }
58
59 static SEC_WCHAR schannelCommentW[] = { 'S','c','h','a','n','n','e','l',
60 ' ','S','e','c','u','r','i','t','y',' ','P','a','c','k','a','g','e',0 };
61
62 /***********************************************************************
63 * SpGetInfoSChannel
64 */
65 static NTSTATUS WINAPI SpGetInfoSChannel(PSecPkgInfoW PackageInfo)
66 {
67 TRACE("(%p)\n", PackageInfo);
68
69 PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH |
70 SECPKG_FLAG_INTEGRITY | SECPKG_FLAG_PRIVACY |
71 SECPKG_FLAG_CONNECTION | SECPKG_FLAG_MULTI_REQUIRED |
72 SECPKG_FLAG_EXTENDED_ERROR | SECPKG_FLAG_IMPERSONATION |
73 SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_STREAM;
74 PackageInfo->wVersion = 1;
75 PackageInfo->wRPCID = UNISP_RPC_ID;
76 PackageInfo->cbMaxToken = 0x4000;
77 PackageInfo->Name = (LPWSTR)SCHANNEL_NAME_W;
78 PackageInfo->Comment = schannelCommentW;
79
80 return STATUS_SUCCESS;
81 }
82
83 static SECPKG_FUNCTION_TABLE secPkgFunctionTable[2] =
84 { {
85 NULL, /* InitializePackage */
86 NULL, /* LsaLogonUser */
87 NULL, /* CallPackage */
88 NULL, /* LogonTerminated */
89 NULL, /* CallPackageUntrusted */
90 NULL, /* CallPackagePassthrough */
91 NULL, /* LogonUserEx */
92 NULL, /* LogonUserEx2 */
93 NULL, /* Initialize */
94 NULL, /* Shutdown */
95 SpGetInfoUnified,
96 NULL, /* AcceptCredentials */
97 NULL, /* SpAcquireCredentialsHandle */
98 NULL, /* SpQueryCredentialsAttributes */
99 NULL, /* FreeCredentialsHandle */
100 NULL, /* SaveCredentials */
101 NULL, /* GetCredentials */
102 NULL, /* DeleteCredentials */
103 NULL, /* InitLsaModeContext */
104 NULL, /* AcceptLsaModeContext */
105 NULL, /* DeleteContext */
106 NULL, /* ApplyControlToken */
107 NULL, /* GetUserInfo */
108 NULL, /* GetExtendedInformation */
109 NULL, /* SpQueryContextAttributes */
110 NULL, /* SpAddCredentials */
111 NULL, /* SetExtendedInformation */
112 NULL, /* SetContextAttributes */
113 NULL, /* SetCredentialsAttributes */
114 NULL, /* ChangeAccountPassword */
115 NULL, /* QueryMetaData */
116 NULL, /* ExchangeMetaData */
117 NULL, /* GetCredUIContext */
118 NULL, /* UpdateCredentials */
119 NULL, /* ValidateTargetInfo */
120 }, {
121 NULL, /* InitializePackage */
122 NULL, /* LsaLogonUser */
123 NULL, /* CallPackage */
124 NULL, /* LogonTerminated */
125 NULL, /* CallPackageUntrusted */
126 NULL, /* CallPackagePassthrough */
127 NULL, /* LogonUserEx */
128 NULL, /* LogonUserEx2 */
129 NULL, /* Initialize */
130 NULL, /* Shutdown */
131 SpGetInfoSChannel,
132 NULL, /* AcceptCredentials */
133 NULL, /* SpAcquireCredentialsHandle */
134 NULL, /* SpQueryCredentialsAttributes */
135 NULL, /* FreeCredentialsHandle */
136 NULL, /* SaveCredentials */
137 NULL, /* GetCredentials */
138 NULL, /* DeleteCredentials */
139 NULL, /* InitLsaModeContext */
140 NULL, /* AcceptLsaModeContext */
141 NULL, /* DeleteContext */
142 NULL, /* ApplyControlToken */
143 NULL, /* GetUserInfo */
144 NULL, /* GetExtendedInformation */
145 NULL, /* SpQueryContextAttributes */
146 NULL, /* SpAddCredentials */
147 NULL, /* SetExtendedInformation */
148 NULL, /* SetContextAttributes */
149 NULL, /* SetCredentialsAttributes */
150 NULL, /* ChangeAccountPassword */
151 NULL, /* QueryMetaData */
152 NULL, /* ExchangeMetaData */
153 NULL, /* GetCredUIContext */
154 NULL, /* UpdateCredentials */
155 NULL, /* ValidateTargetInfo */
156 }
157 };
158
159 /***********************************************************************
160 * SpLsaModeInitialize (SCHANNEL.@)
161 */
162 NTSTATUS WINAPI SpLsaModeInitialize(ULONG LsaVersion, PULONG PackageVersion,
163 PSECPKG_FUNCTION_TABLE *ppTables, PULONG pcTables)
164 {
165 TRACE("(%u, %p, %p, %p)\n", LsaVersion, PackageVersion, ppTables, pcTables);
166
167 *PackageVersion = SECPKG_INTERFACE_VERSION_6;
168 *pcTables = 2;
169 *ppTables = secPkgFunctionTable;
170
171 return STATUS_SUCCESS;
172 }