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