fb1a046fa81d06dc05e68f842d4462bb72966406
[nivanova/samba-autobuild/.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 2 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, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "rpc_server/dcerpc_server.h"
25 #include "librpc/gen_ndr/ndr_wkssvc.h"
26 #include "rpc_server/common/common.h"
27
28 /* 
29   wkssvc_NetWkstaGetInfo 
30 */
31 static WERROR 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
36         ZERO_STRUCT(r->out);
37         r->out.info = talloc_zero(mem_ctx, union wkssvc_NetWkstaInfo);
38         W_ERROR_HAVE_NO_MEMORY(r->out.info);
39
40         /* NOTE: win2k3 ignores r->in.server_name completly so we do --metze */
41
42         switch(r->in.level) {
43         case 100:
44         {
45                 struct wkssvc_NetWkstaInfo100 *info100;
46                 
47                 info100 = talloc(mem_ctx, struct wkssvc_NetWkstaInfo100);
48                 W_ERROR_HAVE_NO_MEMORY(info100);
49
50                 info100->platform_id    = dcesrv_common_get_platform_id(mem_ctx, dce_ctx);
51                 info100->server_name    = dcesrv_common_get_server_name(mem_ctx, dce_ctx, NULL);
52                 W_ERROR_HAVE_NO_MEMORY(info100->server_name);
53                 info100->domain_name    = dcesrv_common_get_domain_name(mem_ctx, dce_ctx);
54                 W_ERROR_HAVE_NO_MEMORY(info100->domain_name);
55                 info100->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
56                 info100->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
57
58                 r->out.info->info100 = info100;
59                 return WERR_OK;
60         }
61         case 101:
62         {
63                 struct wkssvc_NetWkstaInfo101 *info101;
64
65                 info101 = talloc(mem_ctx, struct wkssvc_NetWkstaInfo101);
66                 W_ERROR_HAVE_NO_MEMORY(info101);
67
68                 info101->platform_id    = dcesrv_common_get_platform_id(mem_ctx, dce_ctx);
69                 info101->server_name    = dcesrv_common_get_server_name(mem_ctx, dce_ctx, NULL);
70                 W_ERROR_HAVE_NO_MEMORY(info101->server_name);
71                 info101->domain_name    = dcesrv_common_get_domain_name(mem_ctx, dce_ctx);
72                 W_ERROR_HAVE_NO_MEMORY(info101->domain_name);
73                 info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
74                 info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
75                 info101->lan_root       = dcesrv_common_get_lan_root(mem_ctx, dce_ctx);
76
77                 r->out.info->info101 = info101;
78                 return WERR_OK;
79         }
80         case 102:
81         {
82                 return WERR_ACCESS_DENIED;
83         }
84         case 502:
85         {
86                 return WERR_ACCESS_DENIED;
87         }
88         default:
89                 return WERR_UNKNOWN_LEVEL;
90         }
91
92         return WERR_UNKNOWN_LEVEL;
93 }
94
95
96 /* 
97   wkssvc_NetWkstaSetInfo 
98 */
99 static WERROR wkssvc_NetWkstaSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
100                        struct wkssvc_NetWkstaSetInfo *r)
101 {
102         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
103 }
104
105
106 /* 
107   wkssvc_NetWkstaEnumUsers
108 */
109 static WERROR wkssvc_NetWkstaEnumUsers(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
110                                        struct wkssvc_NetWkstaEnumUsers *r)
111 {
112         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
113 }
114
115
116 /* 
117   WKSSVC_NETRWKSTAUSERGETINFO 
118 */
119 static WERROR WKSSVC_NETRWKSTAUSERGETINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
120                        struct WKSSVC_NETRWKSTAUSERGETINFO *r)
121 {
122         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
123 }
124
125
126 /* 
127   WKSSVC_NETRWKSTAUSERSETINFO 
128 */
129 static WERROR WKSSVC_NETRWKSTAUSERSETINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
130                        struct WKSSVC_NETRWKSTAUSERSETINFO *r)
131 {
132         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
133 }
134
135
136 /* 
137   wkssvc_NetWkstaTransportEnum 
138 */
139 static WERROR wkssvc_NetWkstaTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
140                        struct wkssvc_NetWkstaTransportEnum *r)
141 {
142         r->out.level = r->in.level;
143         r->out.totalentries = 0;
144         r->out.resume_handle = NULL;
145
146         switch (r->in.level) {
147         case 0:
148                 r->out.ctr = talloc(mem_ctx, union wkssvc_NetWkstaTransportCtr);
149                 W_ERROR_HAVE_NO_MEMORY(r->out.ctr);
150                 r->out.ctr->ctr0 = talloc(mem_ctx, struct wkssvc_NetWkstaTransportCtr0);
151                 W_ERROR_HAVE_NO_MEMORY(r->out.ctr->ctr0);
152
153                 r->out.ctr->ctr0->count = 0;
154                 r->out.ctr->ctr0->array = NULL;
155
156                 return WERR_NOT_SUPPORTED;
157
158         default:
159                 return WERR_UNKNOWN_LEVEL;
160         }
161
162         return WERR_UNKNOWN_LEVEL;
163 }
164
165
166 /* 
167   WKSSVC_NETRWKSTATRANSPORTADD 
168 */
169 static WERROR WKSSVC_NETRWKSTATRANSPORTADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
170                        struct WKSSVC_NETRWKSTATRANSPORTADD *r)
171 {
172         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
173 }
174
175
176 /* 
177   WKSSVC_NETRWKSTATRANSPORTDEL 
178 */
179 static WERROR WKSSVC_NETRWKSTATRANSPORTDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
180                        struct WKSSVC_NETRWKSTATRANSPORTDEL *r)
181 {
182         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
183 }
184
185
186 /* 
187   WKSSVC_NETRUSEADD 
188 */
189 static WERROR WKSSVC_NETRUSEADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
190                        struct WKSSVC_NETRUSEADD *r)
191 {
192         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
193 }
194
195
196 /* 
197   WKSSVC_NETRUSEGETINFO 
198 */
199 static WERROR WKSSVC_NETRUSEGETINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
200                        struct WKSSVC_NETRUSEGETINFO *r)
201 {
202         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
203 }
204
205
206 /* 
207   WKSSVC_NETRUSEDEL 
208 */
209 static WERROR WKSSVC_NETRUSEDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
210                        struct WKSSVC_NETRUSEDEL *r)
211 {
212         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
213 }
214
215
216 /* 
217   WKSSVC_NETRUSEENUM 
218 */
219 static WERROR WKSSVC_NETRUSEENUM(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
220                        struct WKSSVC_NETRUSEENUM *r)
221 {
222         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
223 }
224
225
226 /* 
227   WKSSVC_NETRMESSAGEBUFFERSEND 
228 */
229 static WERROR WKSSVC_NETRMESSAGEBUFFERSEND(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
230                        struct WKSSVC_NETRMESSAGEBUFFERSEND *r)
231 {
232         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
233 }
234
235
236 /* 
237   WKSSVC_NETRWORKSTATIONSTATISTICSGET 
238 */
239 static WERROR WKSSVC_NETRWORKSTATIONSTATISTICSGET(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
240                        struct WKSSVC_NETRWORKSTATIONSTATISTICSGET *r)
241 {
242         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
243 }
244
245
246 /* 
247   WKSSVC_NETRLOGONDOMAINNAMEADD 
248 */
249 static WERROR WKSSVC_NETRLOGONDOMAINNAMEADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
250                        struct WKSSVC_NETRLOGONDOMAINNAMEADD *r)
251 {
252         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
253 }
254
255
256 /* 
257   WKSSVC_NETRLOGONDOMAINNAMEDEL 
258 */
259 static WERROR WKSSVC_NETRLOGONDOMAINNAMEDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
260                        struct WKSSVC_NETRLOGONDOMAINNAMEDEL *r)
261 {
262         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
263 }
264
265
266 /* 
267   WKSSVC_NETRJOINDOMAIN 
268 */
269 static WERROR WKSSVC_NETRJOINDOMAIN(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
270                        struct WKSSVC_NETRJOINDOMAIN *r)
271 {
272         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
273 }
274
275
276 /* 
277   WKSSVC_NETRUNJOINDOMAIN 
278 */
279 static WERROR WKSSVC_NETRUNJOINDOMAIN(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
280                        struct WKSSVC_NETRUNJOINDOMAIN *r)
281 {
282         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
283 }
284
285
286 /* 
287   WKSSVC_NETRRENAMEMACHINEINDOMAIN 
288 */
289 static WERROR WKSSVC_NETRRENAMEMACHINEINDOMAIN(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
290                        struct WKSSVC_NETRRENAMEMACHINEINDOMAIN *r)
291 {
292         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
293 }
294
295
296 /* 
297   WKSSVC_NETRVALIDATENAME 
298 */
299 static WERROR WKSSVC_NETRVALIDATENAME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
300                        struct WKSSVC_NETRVALIDATENAME *r)
301 {
302         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
303 }
304
305
306 /* 
307   WKSSVC_NETRGETJOININFORMATION 
308 */
309 static WERROR WKSSVC_NETRGETJOININFORMATION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
310                        struct WKSSVC_NETRGETJOININFORMATION *r)
311 {
312         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
313 }
314
315
316 /* 
317   WKSSVC_NETRGETJOINABLEOUS 
318 */
319 static WERROR WKSSVC_NETRGETJOINABLEOUS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
320                        struct WKSSVC_NETRGETJOINABLEOUS *r)
321 {
322         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
323 }
324
325
326 /* 
327   WKSSVC_NETRJOINDOMAIN2 
328 */
329 static WERROR wkssvc_NetrJoinDomain2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
330                        struct wkssvc_NetrJoinDomain2 *r)
331 {
332         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
333 }
334
335
336 /* 
337   WKSSVC_NETRUNJOINDOMAIN2 
338 */
339 static WERROR wkssvc_NetrUnjoinDomain2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
340                        struct wkssvc_NetrUnjoinDomain2 *r)
341 {
342         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
343 }
344
345
346 /* 
347   WKSSVC_NETRRENAMEMACHINEINDOMAIN2 
348 */
349 static WERROR wkssvc_NetrRenameMachineInDomain2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
350                        struct wkssvc_NetrRenameMachineInDomain2 *r)
351 {
352         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
353 }
354
355
356 /* 
357   WKSSVC_NETRVALIDATENAME2 
358 */
359 static WERROR WKSSVC_NETRVALIDATENAME2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
360                        struct WKSSVC_NETRVALIDATENAME2 *r)
361 {
362         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
363 }
364
365
366 /* 
367   WKSSVC_NETRGETJOINABLEOUS2 
368 */
369 static WERROR WKSSVC_NETRGETJOINABLEOUS2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
370                        struct WKSSVC_NETRGETJOINABLEOUS2 *r)
371 {
372         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
373 }
374
375
376 /* 
377   WKSSVC_NETRADDALTERNATECOMPUTERNAME 
378 */
379 static WERROR wkssvc_NetrAddAlternateComputerName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
380                        struct wkssvc_NetrAddAlternateComputerName *r)
381 {
382         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
383 }
384
385
386 /* 
387   WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME 
388 */
389 static WERROR wkssvc_NetrRemoveAlternateComputerName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
390                        struct wkssvc_NetrRemoveAlternateComputerName *r)
391 {
392         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
393 }
394
395
396 /* 
397   WKSSVC_NETRSETPRIMARYCOMPUTERNAME 
398 */
399 static WERROR WKSSVC_NETRSETPRIMARYCOMPUTERNAME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
400                        struct WKSSVC_NETRSETPRIMARYCOMPUTERNAME *r)
401 {
402         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
403 }
404
405
406 /* 
407   WKSSVC_NETRENUMERATECOMPUTERNAMES 
408 */
409 static WERROR WKSSVC_NETRENUMERATECOMPUTERNAMES(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
410                        struct WKSSVC_NETRENUMERATECOMPUTERNAMES *r)
411 {
412         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
413 }
414
415
416 /* include the generated boilerplate */
417 #include "librpc/gen_ndr/ndr_wkssvc_s.c"