xref: /reactos/dll/win32/schannel/lsamode.c (revision cc439606)
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 #include "windef.h"
26 #include "winbase.h"
27 #include "sspi.h"
28 #include "ntsecapi.h"
29 #include "ntsecpkg.h"
30 #include "schannel.h"
31 
32 #include "wine/debug.h"
33 
34 WINE_DEFAULT_DEBUG_CHANNEL(schannel);
35 
36 /***********************************************************************
37  *              SpGetInfoUnified
38  */
39 static NTSTATUS WINAPI SpGetInfoUnified(PSecPkgInfoW PackageInfo)
40 {
41     TRACE("(%p)\n", PackageInfo);
42 
43     PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH |
44         SECPKG_FLAG_INTEGRITY | SECPKG_FLAG_PRIVACY |
45         SECPKG_FLAG_CONNECTION | SECPKG_FLAG_MULTI_REQUIRED |
46         SECPKG_FLAG_EXTENDED_ERROR | SECPKG_FLAG_IMPERSONATION |
47         SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_STREAM;
48     PackageInfo->wVersion   = 1;
49     PackageInfo->wRPCID     = UNISP_RPC_ID;
50     PackageInfo->cbMaxToken = 0x4000;
51     PackageInfo->Name       = (LPWSTR)UNISP_NAME_W;
52     PackageInfo->Comment    = (LPWSTR)UNISP_NAME_W;
53 
54     return STATUS_SUCCESS;
55 }
56 
57 static SEC_WCHAR schannelCommentW[] = { 'S','c','h','a','n','n','e','l',
58      ' ','S','e','c','u','r','i','t','y',' ','P','a','c','k','a','g','e',0 };
59 
60 /***********************************************************************
61  *              SpGetInfoSChannel
62  */
63 static NTSTATUS WINAPI SpGetInfoSChannel(PSecPkgInfoW PackageInfo)
64 {
65     TRACE("(%p)\n", PackageInfo);
66 
67     PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH |
68         SECPKG_FLAG_INTEGRITY | SECPKG_FLAG_PRIVACY |
69         SECPKG_FLAG_CONNECTION | SECPKG_FLAG_MULTI_REQUIRED |
70         SECPKG_FLAG_EXTENDED_ERROR | SECPKG_FLAG_IMPERSONATION |
71         SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_STREAM;
72     PackageInfo->wVersion   = 1;
73     PackageInfo->wRPCID     = UNISP_RPC_ID;
74     PackageInfo->cbMaxToken = 0x4000;
75     PackageInfo->Name       = (LPWSTR)SCHANNEL_NAME_W;
76     PackageInfo->Comment    = schannelCommentW;
77 
78     return STATUS_SUCCESS;
79 }
80 
81 static SECPKG_FUNCTION_TABLE secPkgFunctionTable[2] =
82 { {
83     NULL, /* InitializePackage */
84     NULL, /* LsaLogonUser */
85     NULL, /* CallPackage */
86     NULL, /* LogonTerminated */
87     NULL, /* CallPackageUntrusted */
88     NULL, /* CallPackagePassthrough */
89     NULL, /* LogonUserEx */
90     NULL, /* LogonUserEx2 */
91     NULL, /* Initialize */
92     NULL, /* Shutdown */
93     SpGetInfoUnified,
94     NULL, /* AcceptCredentials */
95     NULL, /* SpAcquireCredentialsHandle */
96     NULL, /* SpQueryCredentialsAttributes */
97     NULL, /* FreeCredentialsHandle */
98     NULL, /* SaveCredentials */
99     NULL, /* GetCredentials */
100     NULL, /* DeleteCredentials */
101     NULL, /* InitLsaModeContext */
102     NULL, /* AcceptLsaModeContext */
103     NULL, /* DeleteContext */
104     NULL, /* ApplyControlToken */
105     NULL, /* GetUserInfo */
106     NULL, /* GetExtendedInformation */
107     NULL, /* SpQueryContextAttributes */
108     NULL, /* SpAddCredentials */
109     NULL, /* SetExtendedInformation */
110     NULL, /* SetContextAttributes */
111     NULL, /* SetCredentialsAttributes */
112     NULL, /* ChangeAccountPassword */
113     NULL, /* QueryMetaData */
114     NULL, /* ExchangeMetaData */
115     NULL, /* GetCredUIContext */
116     NULL, /* UpdateCredentials */
117     NULL, /* ValidateTargetInfo */
118     NULL, /* PostLogonUser */
119   }, {
120     NULL, /* InitializePackage */
121     NULL, /* LsaLogonUser */
122     NULL, /* CallPackage */
123     NULL, /* LogonTerminated */
124     NULL, /* CallPackageUntrusted */
125     NULL, /* CallPackagePassthrough */
126     NULL, /* LogonUserEx */
127     NULL, /* LogonUserEx2 */
128     NULL, /* Initialize */
129     NULL, /* Shutdown */
130     SpGetInfoSChannel,
131     NULL, /* AcceptCredentials */
132     NULL, /* SpAcquireCredentialsHandle */
133     NULL, /* SpQueryCredentialsAttributes */
134     NULL, /* FreeCredentialsHandle */
135     NULL, /* SaveCredentials */
136     NULL, /* GetCredentials */
137     NULL, /* DeleteCredentials */
138     NULL, /* InitLsaModeContext */
139     NULL, /* AcceptLsaModeContext */
140     NULL, /* DeleteContext */
141     NULL, /* ApplyControlToken */
142     NULL, /* GetUserInfo */
143     NULL, /* GetExtendedInformation */
144     NULL, /* SpQueryContextAttributes */
145     NULL, /* SpAddCredentials */
146     NULL, /* SetExtendedInformation */
147     NULL, /* SetContextAttributes */
148     NULL, /* SetCredentialsAttributes */
149     NULL, /* ChangeAccountPassword */
150     NULL, /* QueryMetaData */
151     NULL, /* ExchangeMetaData */
152     NULL, /* GetCredUIContext */
153     NULL, /* UpdateCredentials */
154     NULL, /* ValidateTargetInfo */
155     NULL, /* PostLogonUser */
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_7;
168     *pcTables = 2;
169     *ppTables = secPkgFunctionTable;
170 
171     return STATUS_SUCCESS;
172 }
173