7aca1701a6e1fc431ff67c20695b5999326c8846
[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 "afsd.h"
29 #include "ms-wkssvc.h"
30 #include "AFS_component_version_number.h"
31
32 #define PLATFORM_ID_AFS 800
33
34 #pragma warning( disable: 4027 )  /* func w/o formal parameter list */
35
36 unsigned long NetrWkstaGetInfo(
37     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
38     /* [in] */ unsigned long Level,
39     /* [switch_is][out] */ LPWKSTA_INFO WkstaInfo)
40 {
41     osi_Log1(afsd_logp, "NetrWkstaGetInfo level %u", Level);
42
43     /*
44     * How much space do we need and do we have that much room?
45     * For now, just assume we can return everything in one shot
46     * because the reality is that in this function call we do
47     * not know the max size of the RPC response.
48     */
49     switch (Level) {
50     case 100:
51         WkstaInfo->WkstaInfo100 = calloc(1, sizeof(WKSTA_INFO_100));
52         break;
53     }
54
55     if (WkstaInfo->WkstaInfo100 == NULL) {
56         return ERROR_NOT_ENOUGH_MEMORY;
57     }
58
59     switch (Level) {
60     case  100:
61         WkstaInfo->WkstaInfo100->wki100_platform_id = PLATFORM_ID_AFS;
62         WkstaInfo->WkstaInfo100->wki100_computername = wcsdup(ServerName);
63         WkstaInfo->WkstaInfo100->wki100_ver_major = AFSPRODUCT_VERSION_MAJOR;
64         WkstaInfo->WkstaInfo100->wki100_ver_major = AFSPRODUCT_VERSION_MINOR;
65         return 0;
66     case  502:
67     case 1013:
68     case 1018:
69     case 1046:
70     default:
71         return ERROR_INVALID_LEVEL;
72     }
73 }
74
75 unsigned long NetrWkstaSetInfo(
76     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
77     /* [in] */ unsigned long Level,
78     /* [switch_is][in] */ LPWKSTA_INFO WkstaInfo,
79     /* [unique][out][in] */ unsigned long *ErrorParameter)
80 {
81     osi_Log0(afsd_logp, "NetrWkstaSetInfo not supported");
82     return ERROR_NOT_SUPPORTED;
83 }
84
85 unsigned long NetrWkstaUserEnum(
86     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
87     /* [out][in] */ LPWKSTA_USER_ENUM_STRUCT UserInfo,
88     /* [in] */ unsigned long PreferredMaximumLength,
89     /* [out] */ unsigned long *TotalEntries,
90     /* [unique][out][in] */ unsigned long *ResumeHandle)
91 {
92     osi_Log0(afsd_logp, "NetrWkstaUserEnum not supported");
93     return ERROR_NOT_SUPPORTED;
94 }
95
96 unsigned long NetrWkstaTransportEnum(
97     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
98     /* [out][in] */ LPWKSTA_TRANSPORT_ENUM_STRUCT TransportInfo,
99     /* [in] */ unsigned long PreferredMaximumLength,
100     /* [out] */ unsigned long *TotalEntries,
101     /* [unique][out][in] */ unsigned long *ResumeHandle)
102 {
103     osi_Log0(afsd_logp, "NetrWkstaTransportEnum not supported");
104     return ERROR_NOT_SUPPORTED;
105 }
106
107 unsigned long NetrWkstaTransportAdd(
108     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
109     /* [in] */ unsigned long Level,
110     /* [in] */ LPWKSTA_TRANSPORT_INFO_0 TransportInfo,
111     /* [unique][out][in] */ unsigned long *ErrorParameter)
112 {
113     osi_Log0(afsd_logp, "NetrWkstaTransportAdd not supported");
114     return ERROR_NOT_SUPPORTED;
115 }
116
117 unsigned long NetrWkstaTransportDel(
118     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
119     /* [unique][string][in] */ wchar_t *TransportName,
120     /* [in] */ unsigned long ForceLevel)
121 {
122     osi_Log0(afsd_logp, "NetrWkstaTransportDel not supported");
123     return ERROR_NOT_SUPPORTED;
124 }
125
126 unsigned long NetrWorkstationStatisticsGet(
127     /* [unique][string][in] */ WKSSVC_IDENTIFY_HANDLE ServerName,
128     /* [unique][string][in] */ wchar_t *ServiceName,
129     /* [in] */ unsigned long Level,
130     /* [in] */ unsigned long Options,
131     /* [out] */ LPSTAT_WORKSTATION_0 *Buffer)
132 {
133     osi_Log0(afsd_logp, "NetrWorkstationStatisticsGet not supported");
134     return ERROR_NOT_SUPPORTED;
135 }
136
137 unsigned long NetrGetJoinInformation(
138     /* [unique][string][in] */ WKSSVC_IMPERSONATE_HANDLE ServerName,
139     /* [string][out][in] */ wchar_t **NameBuffer,
140     /* [out] */ PNETSETUP_JOIN_STATUS BufferType)
141 {
142     osi_Log0(afsd_logp, "NetrGetJoinInformation not supported");
143     return ERROR_NOT_SUPPORTED;
144 }
145
146 unsigned long NetrJoinDomain2(
147     /* [in] */ handle_t RpcBindingHandle,
148     /* [unique][string][in] */ wchar_t *ServerName,
149     /* [string][in] */ wchar_t *DomainName,
150     /* [unique][string][in] */ wchar_t *MachineAccountOU,
151     /* [unique][string][in] */ wchar_t *AccountName,
152     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
153     /* [in] */ unsigned long Options)
154 {
155     osi_Log0(afsd_logp, "NetrJoinDomain2 not supported");
156     return ERROR_NOT_SUPPORTED;
157 }
158
159 unsigned long NetrUnjoinDomain2(
160     /* [in] */ handle_t RpcBindingHandle,
161     /* [unique][string][in] */ wchar_t *ServerName,
162     /* [unique][string][in] */ wchar_t *AccountName,
163     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
164     /* [in] */ unsigned long Options)
165 {
166     osi_Log0(afsd_logp, "NetrUnjoinDomain2 not supported");
167     return ERROR_NOT_SUPPORTED;
168 }
169
170 unsigned long NetrRenameMachineInDomain2(
171     /* [in] */ handle_t RpcBindingHandle,
172     /* [unique][string][in] */ wchar_t *ServerName,
173     /* [unique][string][in] */ wchar_t *MachineName,
174     /* [unique][string][in] */ wchar_t *AccountName,
175     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
176     /* [in] */ unsigned long Options)
177 {
178     osi_Log0(afsd_logp, "NetrRenameMachineInDomain2 not supported");
179     return ERROR_NOT_SUPPORTED;
180 }
181
182 unsigned long NetrValidateName2(
183     /* [in] */ handle_t RpcBindingHandle,
184     /* [unique][string][in] */ wchar_t *ServerName,
185     /* [string][in] */ wchar_t *NameToValidate,
186     /* [unique][string][in] */ wchar_t *AccountName,
187     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
188     /* [in] */ NETSETUP_NAME_TYPE NameType)
189 {
190     osi_Log0(afsd_logp, "NetrValidateName2 not supported");
191     return ERROR_NOT_SUPPORTED;
192 }
193
194 unsigned long NetrGetJoinableOUs2(
195     /* [in] */ handle_t RpcBindingHandle,
196     /* [unique][string][in] */ wchar_t *ServerName,
197     /* [string][in] */ wchar_t *DomainName,
198     /* [unique][string][in] */ wchar_t *AccountName,
199     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD Password,
200     /* [out][in] */ unsigned long *OUCount,
201     /* [size_is][size_is][string][out] */ wchar_t ***OUs)
202 {
203     osi_Log0(afsd_logp, "NetrGetJoinableOUs2 not supported");
204     return ERROR_NOT_SUPPORTED;
205 }
206
207 unsigned long NetrAddAlternateComputerName(
208     /* [in] */ handle_t RpcBindingHandle,
209     /* [unique][string][in] */ wchar_t *ServerName,
210     /* [unique][string][in] */ wchar_t *AlternateName,
211     /* [unique][string][in] */ wchar_t *DomainAccount,
212     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
213     /* [in] */ unsigned long Reserved)
214 {
215     osi_Log0(afsd_logp, "NetrAddAlternateComputerName not supported");
216     return ERROR_NOT_SUPPORTED;
217 }
218
219 unsigned long NetrRemoveAlternateComputerName(
220     /* [in] */ handle_t RpcBindingHandle,
221     /* [unique][string][in] */ wchar_t *ServerName,
222     /* [unique][string][in] */ wchar_t *AlternateName,
223     /* [unique][string][in] */ wchar_t *DomainAccount,
224     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
225     /* [in] */ unsigned long Reserved)
226 {
227     osi_Log0(afsd_logp, "NetrRemoveAlternateComputerName not supported");
228     return ERROR_NOT_SUPPORTED;
229 }
230
231 unsigned long NetrSetPrimaryComputerName(
232     /* [in] */ handle_t RpcBindingHandle,
233     /* [unique][string][in] */ wchar_t *ServerName,
234     /* [unique][string][in] */ wchar_t *PrimaryName,
235     /* [unique][string][in] */ wchar_t *DomainAccount,
236     /* [unique][in] */ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
237     /* [in] */ unsigned long Reserved)
238 {
239     osi_Log0(afsd_logp, "NetrSetPrimaryComputerName not supported");
240     return ERROR_NOT_SUPPORTED;
241 }
242
243 unsigned long NetrEnumerateComputerNames(
244     /* [unique][string][in] */ WKSSVC_IMPERSONATE_HANDLE ServerName,
245     /* [in] */ NET_COMPUTER_NAME_TYPE NameType,
246     /* [in] */ unsigned long Reserved,
247     /* [out] */ PNET_COMPUTER_NAME_ARRAY *ComputerNames)
248 {
249     osi_Log0(afsd_logp, "NetrEnumerateComputerName not supported");
250     return ERROR_NOT_SUPPORTED;
251 }
252
253 /* [nocode] */ void Opnum3NotUsedOnWire(
254     /* [in] */ handle_t IDL_handle)
255 {
256 }
257
258 /* [nocode] */ void Opnum4NotUsedOnWire(
259     /* [in] */ handle_t IDL_handle)
260 {
261 }
262
263 /* [nocode] */ void Opnum8NotUsedOnWire(
264     /* [in] */ handle_t IDL_handle)
265 {
266 }
267
268 /* [nocode] */ void Opnum9NotUsedOnWire(
269     /* [in] */ handle_t IDL_handle)
270 {
271 }
272
273 /* [nocode] */ void Opnum10NotUsedOnWire(
274     /* [in] */ handle_t IDL_handle)
275 {
276 }
277
278 /* [nocode] */ void Opnum11NotUsedOnWire(
279     /* [in] */ handle_t IDL_handle)
280 {
281 }
282
283 /* [nocode] */ void Opnum12NotUsedOnWire(
284     /* [in] */ handle_t IDL_handle)
285 {
286 }
287
288
289 /* [nocode] */ void Opnum14NotUsedOnWire(
290     /* [in] */ handle_t IDL_handle)
291 {
292 }
293
294 /* [nocode] */ void Opnum15NotUsedOnWire(
295     /* [in] */ handle_t IDL_handle)
296 {
297 }
298
299 /* [nocode] */ void Opnum16NotUsedOnWire(
300     /* [in] */ handle_t IDL_handle)
301 {
302 }
303
304 /* [nocode] */ void Opnum17NotUsedOnWire(
305     /* [in] */ handle_t IDL_handle)
306 {
307 }
308
309 /* [nocode] */ void Opnum18NotUsedOnWire(
310     /* [in] */ handle_t IDL_handle)
311 {
312 }
313
314 /* [nocode] */ void Opnum19NotUsedOnWire(
315     /* [in] */ handle_t IDL_handle)
316 {
317 }
318
319
320 /* [nocode] */ void Opnum21NotUsedOnWire(
321     /* [in] */ handle_t IDL_handle)
322 {
323 }
324