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