Use struct for server versions.
[ira/wip.git] / source4 / rpc_server / wkssvc / dcesrv_wkssvc.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    endpoint server for the wkssvc pipe
5
6    Copyright (C) Stefan (metze) Metzmacher 2004
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "includes.h"
23 #include "rpc_server/dcerpc_server.h"
24 #include "librpc/gen_ndr/ndr_wkssvc.h"
25 #include "rpc_server/common/common.h"
26 #include "param/param.h"
27
28 /*
29   wkssvc_NetWkstaGetInfo
30 */
31 static WERROR dcesrv_wkssvc_NetWkstaGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
32                        struct wkssvc_NetWkstaGetInfo *r)
33 {
34         struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx;
35         struct dcerpc_server_info *server_info = lp_dcerpc_server_info(mem_ctx, dce_ctx->lp_ctx);
36
37         ZERO_STRUCT(r->out);
38         r->out.info = talloc_zero(mem_ctx, union wkssvc_NetWkstaInfo);
39         W_ERROR_HAVE_NO_MEMORY(r->out.info);
40
41         /* NOTE: win2k3 ignores r->in.server_name completly so we do --metze */
42
43         switch(r->in.level) {
44         case 100:
45         {
46                 struct wkssvc_NetWkstaInfo100 *info100;
47
48                 info100 = talloc(mem_ctx, struct wkssvc_NetWkstaInfo100);
49                 W_ERROR_HAVE_NO_MEMORY(info100);
50
51                 info100->platform_id    = dcesrv_common_get_platform_id(mem_ctx, dce_ctx);
52                 info100->server_name    = dcesrv_common_get_server_name(mem_ctx, dce_ctx, NULL);
53                 W_ERROR_HAVE_NO_MEMORY(info100->server_name);
54                 info100->domain_name    = talloc_reference(mem_ctx, server_info->domain_name);
55                 W_ERROR_HAVE_NO_MEMORY(info100->domain_name);
56                 info100->version_major  = server_info->version_major;
57                 info100->version_minor  = server_info->version_minor;
58
59                 r->out.info->info100 = info100;
60                 return WERR_OK;
61         }
62         case 101:
63         {
64                 struct wkssvc_NetWkstaInfo101 *info101;
65
66                 info101 = talloc(mem_ctx, struct wkssvc_NetWkstaInfo101);
67                 W_ERROR_HAVE_NO_MEMORY(info101);
68
69                 info101->platform_id    = dcesrv_common_get_platform_id(mem_ctx, dce_ctx);
70                 info101->server_name    = dcesrv_common_get_server_name(mem_ctx, dce_ctx, NULL);
71                 W_ERROR_HAVE_NO_MEMORY(info101->server_name);
72                 info101->domain_name    = talloc_reference(mem_ctx, server_info->domain_name);
73                 W_ERROR_HAVE_NO_MEMORY(info101->domain_name);
74                 info101->version_major  = server_info->version_major;
75                 info101->version_minor  = server_info->version_minor;
76                 info101->lan_root       = dcesrv_common_get_lan_root(mem_ctx, dce_ctx);
77
78                 r->out.info->info101 = info101;
79                 return WERR_OK;
80         }
81         case 102:
82         {
83                 return WERR_ACCESS_DENIED;
84         }
85         case 502:
86         {
87                 return WERR_ACCESS_DENIED;
88         }
89         default:
90                 return WERR_UNKNOWN_LEVEL;
91         }
92
93         return WERR_UNKNOWN_LEVEL;
94 }
95
96
97 /*
98   wkssvc_NetWkstaSetInfo
99 */
100 static WERROR dcesrv_wkssvc_NetWkstaSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
101                        struct wkssvc_NetWkstaSetInfo *r)
102 {
103         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
104 }
105
106
107 /*
108   wkssvc_NetWkstaEnumUsers
109 */
110 static WERROR dcesrv_wkssvc_NetWkstaEnumUsers(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
111                                        struct wkssvc_NetWkstaEnumUsers *r)
112 {
113         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
114 }
115
116
117 /*
118   wkssvc_NetrWkstaUserGetInfo
119 */
120 static WERROR dcesrv_wkssvc_NetrWkstaUserGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
121                        struct wkssvc_NetrWkstaUserGetInfo *r)
122 {
123         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
124 }
125
126
127 /*
128   wkssvc_NetrWkstaUserSetInfo
129 */
130 static WERROR dcesrv_wkssvc_NetrWkstaUserSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
131                        struct wkssvc_NetrWkstaUserSetInfo *r)
132 {
133         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
134 }
135
136
137 /*
138   wkssvc_NetWkstaTransportEnum
139 */
140 static WERROR dcesrv_wkssvc_NetWkstaTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
141                        struct wkssvc_NetWkstaTransportEnum *r)
142 {
143         r->out.total_entries = 0;
144         r->out.resume_handle = NULL;
145
146         switch (r->in.info->level) {
147         case 0:
148                 r->out.info = talloc(mem_ctx, struct wkssvc_NetWkstaTransportInfo);
149                 W_ERROR_HAVE_NO_MEMORY(r->out.info);
150                 r->out.info->level = r->in.info->level;
151                 r->out.info->ctr.ctr0 = talloc(mem_ctx, struct wkssvc_NetWkstaTransportCtr0);
152                 W_ERROR_HAVE_NO_MEMORY(r->out.info->ctr.ctr0);
153
154                 r->out.info->ctr.ctr0->count = 0;
155                 r->out.info->ctr.ctr0->array = NULL;
156
157                 return WERR_NOT_SUPPORTED;
158
159         default:
160                 return WERR_UNKNOWN_LEVEL;
161         }
162
163         return WERR_UNKNOWN_LEVEL;
164 }
165
166
167 /*
168   wkssvc_NetrWkstaTransportAdd
169 */
170 static WERROR dcesrv_wkssvc_NetrWkstaTransportAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
171                        struct wkssvc_NetrWkstaTransportAdd *r)
172 {
173         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
174 }
175
176
177 /*
178   wkssvc_NetrWkstaTransportDel
179 */
180 static WERROR dcesrv_wkssvc_NetrWkstaTransportDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
181                        struct wkssvc_NetrWkstaTransportDel *r)
182 {
183         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
184 }
185
186
187 /*
188   wkssvc_NetrUseAdd
189 */
190 static WERROR dcesrv_wkssvc_NetrUseAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
191                        struct wkssvc_NetrUseAdd *r)
192 {
193         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
194 }
195
196
197 /*
198   wkssvc_NetrUseGetInfo
199 */
200 static WERROR dcesrv_wkssvc_NetrUseGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
201                        struct wkssvc_NetrUseGetInfo *r)
202 {
203         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
204 }
205
206
207 /*
208   wkssvc_NetrUseDel
209 */
210 static WERROR dcesrv_wkssvc_NetrUseDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
211                        struct wkssvc_NetrUseDel *r)
212 {
213         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
214 }
215
216
217 /*
218   wkssvc_NetrUseEnum
219 */
220 static WERROR dcesrv_wkssvc_NetrUseEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
221                        struct wkssvc_NetrUseEnum *r)
222 {
223         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
224 }
225
226
227 /*
228   wkssvc_NetrMessageBufferSend
229 */
230 static WERROR dcesrv_wkssvc_NetrMessageBufferSend(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
231                        struct wkssvc_NetrMessageBufferSend *r)
232 {
233         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
234 }
235
236
237 /*
238   wkssvc_NetrWorkstationStatisticsGet
239 */
240 static WERROR dcesrv_wkssvc_NetrWorkstationStatisticsGet(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
241                        struct wkssvc_NetrWorkstationStatisticsGet *r)
242 {
243         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
244 }
245
246
247 /*
248   wkssvc_NetrLogonDomainNameAdd
249 */
250 static WERROR dcesrv_wkssvc_NetrLogonDomainNameAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
251                        struct wkssvc_NetrLogonDomainNameAdd *r)
252 {
253         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
254 }
255
256
257 /*
258   wkssvc_NetrLogonDomainNameDel
259 */
260 static WERROR dcesrv_wkssvc_NetrLogonDomainNameDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
261                        struct wkssvc_NetrLogonDomainNameDel *r)
262 {
263         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
264 }
265
266
267 /*
268   wkssvc_NetrJoinDomain
269 */
270 static WERROR dcesrv_wkssvc_NetrJoinDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
271                        struct wkssvc_NetrJoinDomain *r)
272 {
273         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
274 }
275
276
277 /*
278   wkssvc_NetrUnjoinDomain
279 */
280 static WERROR dcesrv_wkssvc_NetrUnjoinDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
281                        struct wkssvc_NetrUnjoinDomain *r)
282 {
283         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
284 }
285
286
287 /*
288   wkssvc_NetrRenameMachineInDomain
289 */
290 static WERROR dcesrv_wkssvc_NetrRenameMachineInDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
291                        struct wkssvc_NetrRenameMachineInDomain *r)
292 {
293         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
294 }
295
296
297 /*
298   wkssvc_NetrValidateName
299 */
300 static WERROR dcesrv_wkssvc_NetrValidateName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
301                        struct wkssvc_NetrValidateName *r)
302 {
303         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
304 }
305
306
307 /*
308   wkssvc_NetrGetJoinInformation
309 */
310 static WERROR dcesrv_wkssvc_NetrGetJoinInformation(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
311                        struct wkssvc_NetrGetJoinInformation *r)
312 {
313         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
314 }
315
316
317 /*
318   wkssvc_NetrGetJoinableOus
319 */
320 static WERROR dcesrv_wkssvc_NetrGetJoinableOus(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
321                        struct wkssvc_NetrGetJoinableOus *r)
322 {
323         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
324 }
325
326
327 /*
328   WKSSVC_NETRJOINDOMAIN2
329 */
330 static WERROR dcesrv_wkssvc_NetrJoinDomain2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
331                        struct wkssvc_NetrJoinDomain2 *r)
332 {
333         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
334 }
335
336
337 /*
338   WKSSVC_NETRUNJOINDOMAIN2
339 */
340 static WERROR dcesrv_wkssvc_NetrUnjoinDomain2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
341                        struct wkssvc_NetrUnjoinDomain2 *r)
342 {
343         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
344 }
345
346
347 /*
348   wkssvc_NetrRenameMachineInDomain2
349 */
350 static WERROR dcesrv_wkssvc_NetrRenameMachineInDomain2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
351                        struct wkssvc_NetrRenameMachineInDomain2 *r)
352 {
353         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
354 }
355
356
357 /*
358   wkssvc_NetrValidateName2
359 */
360 static WERROR dcesrv_wkssvc_NetrValidateName2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
361                        struct wkssvc_NetrValidateName2 *r)
362 {
363         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
364 }
365
366
367 /*
368   wkssvc_NetrGetJoinableOus2
369 */
370 static WERROR dcesrv_wkssvc_NetrGetJoinableOus2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
371                        struct wkssvc_NetrGetJoinableOus2 *r)
372 {
373         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
374 }
375
376
377 /*
378   wkssvc_NetrAddAlternateComputername
379 */
380 static WERROR dcesrv_wkssvc_NetrAddAlternateComputerName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
381                        struct wkssvc_NetrAddAlternateComputerName *r)
382 {
383         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
384 }
385
386
387 /*
388   wkssvc_NetrRemoveAlternateComputername
389 */
390 static WERROR dcesrv_wkssvc_NetrRemoveAlternateComputerName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
391                        struct wkssvc_NetrRemoveAlternateComputerName *r)
392 {
393         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
394 }
395
396
397 /*
398   wkssvc_NetrSetPrimaryComputername
399 */
400 static WERROR dcesrv_wkssvc_NetrSetPrimaryComputername(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
401                        struct wkssvc_NetrSetPrimaryComputername *r)
402 {
403         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
404 }
405
406
407 /*
408   wkssvc_NetrEnumerateComputerNames
409 */
410 static WERROR dcesrv_wkssvc_NetrEnumerateComputerNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
411                        struct wkssvc_NetrEnumerateComputerNames *r)
412 {
413         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
414 }
415
416
417 /* include the generated boilerplate */
418 #include "librpc/gen_ndr/ndr_wkssvc_s.c"