Windows: Implement SRVSVC and WKSSVC RPC interfaces
[openafs.git] / src / WINNT / afsd / rpc_wkssvc.c
1 /*
2  * Copyright (c) 2009 Secure Endpoints Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person
5  * obtaining a copy of this software and associated documentation
6  * files (the "Software"), to deal in the Software without
7  * restriction, including without limitation the rights to use, copy,
8  * modify, merge, publish, distribute, sublicense, and/or sell copies
9  * of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24
25 #include <windows.h>
26 #include <lmcons.h>
27 #include <stdlib.h>
28 #include "ms-wkssvc.h"
29 #include "AFS_component_version_number.h"
30
31 #define PLATFORM_ID_AFS 800
32
33 #pragma warning( disable: 4027 )  /* func w/o formal parameter list */
34
35 unsigned long NetrWkstaGetInfo(
36     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
37     /* [in] */ unsigned long Level,
38     /* [switch_is][out] */ LPWKSTA_INFO WkstaInfo)
39 {
40     /*
41     * How much space do we need and do we have that much room?
42     * For now, just assume we can return everything in one shot
43     * because the reality is that in this function call we do
44     * not know the max size of the RPC response.
45     */
46     switch (Level) {
47     case 100:
48         WkstaInfo->WkstaInfo100 = calloc(1, sizeof(WKSTA_INFO_100));
49         break;
50     }
51
52     if (WkstaInfo->WkstaInfo100 == NULL) {
53         return ERROR_NOT_ENOUGH_MEMORY;
54     }
55
56     switch (Level) {
57     case  100:
58         WkstaInfo->WkstaInfo100->wki100_platform_id = PLATFORM_ID_AFS;
59         WkstaInfo->WkstaInfo100->wki100_computername = wcsdup(ServerName);
60         WkstaInfo->WkstaInfo100->wki100_ver_major = AFSPRODUCT_VERSION_MAJOR;
61         WkstaInfo->WkstaInfo100->wki100_ver_major = AFSPRODUCT_VERSION_MINOR;
62         return 0;
63     case  502:
64     case 1013:
65     case 1018:
66     case 1046:
67     default:
68         return ERROR_INVALID_LEVEL;
69     }
70 }
71
72 unsigned long NetrWkstaSetInfo(
73     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
74     /* [in] */ unsigned long Level,
75     /* [switch_is][in] */ LPWKSTA_INFO WkstaInfo,
76     /* [unique][out][in] */ unsigned long *ErrorParameter)
77 {
78     return ERROR_NOT_SUPPORTED;
79 }
80
81 unsigned long NetrWkstaUserEnum(
82     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
83     /* [out][in] */ LPWKSTA_USER_ENUM_STRUCT UserInfo,
84     /* [in] */ unsigned long PreferredMaximumLength,
85     /* [out] */ unsigned long *TotalEntries,
86     /* [unique][out][in] */ unsigned long *ResumeHandle)
87 {
88     return ERROR_NOT_SUPPORTED;
89 }
90
91 unsigned long NetrWkstaTransportEnum(
92     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
93     /* [out][in] */ LPWKSTA_TRANSPORT_ENUM_STRUCT TransportInfo,
94     /* [in] */ unsigned long PreferredMaximumLength,
95     /* [out] */ unsigned long *TotalEntries,
96     /* [unique][out][in] */ unsigned long *ResumeHandle)
97 {
98     return ERROR_NOT_SUPPORTED;
99 }
100
101 unsigned long NetrWkstaTransportAdd(
102     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
103     /* [in] */ unsigned long Level,
104     /* [in] */ LPWKSTA_TRANSPORT_INFO_0 TransportInfo,
105     /* [unique][out][in] */ unsigned long *ErrorParameter)
106 {
107     return ERROR_NOT_SUPPORTED;
108 }
109
110 unsigned long NetrWkstaTransportDel(
111     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
112     /* [unique][string][in] */ wchar_t *TransportName,
113     /* [in] */ unsigned long ForceLevel)
114 {
115     return ERROR_NOT_SUPPORTED;
116 }
117
118 unsigned long NetrWorkstationStatisticsGet(
119     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
120     /* [unique][string][in] */ wchar_t *ServiceName,
121     /* [in] */ unsigned long Level,
122     /* [in] */ unsigned long Options,
123     /* [out] */ LPSTAT_WORKSTATION_0 *Buffer)
124 {
125     return ERROR_NOT_SUPPORTED;
126 }
127
128 unsigned long NetrGetJoinInformation(
129     /* [unique][string][in] */ WKSSVC_IMPERSONATE_HANDLE ServerName,
130     /* [string][out][in] */ wchar_t **NameBuffer,
131     /* [out] */ PNETSETUP_JOIN_STATUS BufferType)
132 {
133     return ERROR_NOT_SUPPORTED;
134 }
135
136 unsigned long NetrJoinDomain2(
137     /* [in] */ handle_t RpcBindingHandle,
138     /* [unique][string][in] */ wchar_t *ServerName,
139     /* [string][in] */ wchar_t *DomainName,
140     /* [unique][string][in] */ wchar_t *MachineAccountOU,
141     /* [unique][string][in] */ wchar_t *AccountName,
142     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
143     /* [in] */ unsigned long Options)
144 {
145     return ERROR_NOT_SUPPORTED;
146 }
147
148 unsigned long NetrUnjoinDomain2(
149     /* [in] */ handle_t RpcBindingHandle,
150     /* [unique][string][in] */ wchar_t *ServerName,
151     /* [unique][string][in] */ wchar_t *AccountName,
152     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
153     /* [in] */ unsigned long Options)
154 {
155     return ERROR_NOT_SUPPORTED;
156 }
157
158 unsigned long NetrRenameMachineInDomain2(
159     /* [in] */ handle_t RpcBindingHandle,
160     /* [unique][string][in] */ wchar_t *ServerName,
161     /* [unique][string][in] */ wchar_t *MachineName,
162     /* [unique][string][in] */ wchar_t *AccountName,
163     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
164     /* [in] */ unsigned long Options)
165 {
166     return ERROR_NOT_SUPPORTED;
167 }
168
169 unsigned long NetrValidateName2(
170     /* [in] */ handle_t RpcBindingHandle,
171     /* [unique][string][in] */ wchar_t *ServerName,
172     /* [string][in] */ wchar_t *NameToValidate,
173     /* [unique][string][in] */ wchar_t *AccountName,
174     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
175     /* [in] */ NETSETUP_NAME_TYPE NameType)
176 {
177     return ERROR_NOT_SUPPORTED;
178 }
179
180 unsigned long NetrGetJoinableOUs2(
181     /* [in] */ handle_t RpcBindingHandle,
182     /* [unique][string][in] */ wchar_t *ServerName,
183     /* [string][in] */ wchar_t *DomainName,
184     /* [unique][string][in] */ wchar_t *AccountName,
185     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
186     /* [out][in] */ unsigned long *OUCount,
187     /* [size_is][size_is][string][out] */ wchar_t ***OUs)
188 {
189     return ERROR_NOT_SUPPORTED;
190 }
191
192 unsigned long NetrAddAlternateComputerName(
193     /* [in] */ handle_t RpcBindingHandle,
194     /* [unique][string][in] */ wchar_t *ServerName,
195     /* [unique][string][in] */ wchar_t *AlternateName,
196     /* [unique][string][in] */ wchar_t *DomainAccount,
197     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
198     /* [in] */ unsigned long Reserved)
199 {
200     return ERROR_NOT_SUPPORTED;
201 }
202
203 unsigned long NetrRemoveAlternateComputerName(
204     /* [in] */ handle_t RpcBindingHandle,
205     /* [unique][string][in] */ wchar_t *ServerName,
206     /* [unique][string][in] */ wchar_t *AlternateName,
207     /* [unique][string][in] */ wchar_t *DomainAccount,
208     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
209     /* [in] */ unsigned long Reserved)
210 {
211     return ERROR_NOT_SUPPORTED;
212 }
213
214 unsigned long NetrSetPrimaryComputerName(
215     /* [in] */ handle_t RpcBindingHandle,
216     /* [unique][string][in] */ wchar_t *ServerName,
217     /* [unique][string][in] */ wchar_t *PrimaryName,
218     /* [unique][string][in] */ wchar_t *DomainAccount,
219     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
220     /* [in] */ unsigned long Reserved)
221 {
222     return ERROR_NOT_SUPPORTED;
223 }
224
225 unsigned long NetrEnumerateComputerNames(
226     /* [unique][string][in] */ WKSSVC_IMPERSONATE_HANDLE ServerName,
227     /* [in] */ NET_COMPUTER_NAME_TYPE NameType,
228     /* [in] */ unsigned long Reserved,
229     /* [out] */ PNET_COMPUTER_NAME_ARRAY *ComputerNames)
230 {
231     return ERROR_NOT_SUPPORTED;
232 }
233
234 /* [nocode] */ void Opnum3NotUsedOnWire(
235     /* [in] */ handle_t IDL_handle)
236 {
237 }
238
239 /* [nocode] */ void Opnum4NotUsedOnWire(
240     /* [in] */ handle_t IDL_handle)
241 {
242 }
243
244 /* [nocode] */ void Opnum8NotUsedOnWire(
245     /* [in] */ handle_t IDL_handle)
246 {
247 }
248
249 /* [nocode] */ void Opnum9NotUsedOnWire(
250     /* [in] */ handle_t IDL_handle)
251 {
252 }
253
254 /* [nocode] */ void Opnum10NotUsedOnWire(
255     /* [in] */ handle_t IDL_handle)
256 {
257 }
258
259 /* [nocode] */ void Opnum11NotUsedOnWire(
260     /* [in] */ handle_t IDL_handle)
261 {
262 }
263
264 /* [nocode] */ void Opnum12NotUsedOnWire(
265     /* [in] */ handle_t IDL_handle)
266 {
267 }
268
269
270 /* [nocode] */ void Opnum14NotUsedOnWire(
271     /* [in] */ handle_t IDL_handle)
272 {
273 }
274
275 /* [nocode] */ void Opnum15NotUsedOnWire(
276     /* [in] */ handle_t IDL_handle)
277 {
278 }
279
280 /* [nocode] */ void Opnum16NotUsedOnWire(
281     /* [in] */ handle_t IDL_handle)
282 {
283 }
284
285 /* [nocode] */ void Opnum17NotUsedOnWire(
286     /* [in] */ handle_t IDL_handle)
287 {
288 }
289
290 /* [nocode] */ void Opnum18NotUsedOnWire(
291     /* [in] */ handle_t IDL_handle)
292 {
293 }
294
295 /* [nocode] */ void Opnum19NotUsedOnWire(
296     /* [in] */ handle_t IDL_handle)
297 {
298 }
299
300
301 /* [nocode] */ void Opnum21NotUsedOnWire(
302     /* [in] */ handle_t IDL_handle)
303 {
304 }
305