s3: Remove some references to smbd_messaging_context()
[Samba/gebeck_regimport.git] / source3 / rpc_server / srv_ntsvcs_nt.c
blobaed9a5319cd3ffc454bf3c91fde14d10cf252f70
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
5 * Copyright (C) Gerald (Jerry) Carter 2005.
6 * Copyright (C) Guenther Deschner 2008,2009.
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.
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.
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/>.
22 #include "includes.h"
23 #include "../librpc/gen_ndr/srv_ntsvcs.h"
24 #include "registry.h"
25 #include "registry/reg_objects.h"
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_RPC_SRV
30 /********************************************************************
31 ********************************************************************/
33 static char* get_device_path(TALLOC_CTX *mem_ctx, const char *device )
35 return talloc_asprintf(mem_ctx, "ROOT\\Legacy_%s\\0000", device);
38 /********************************************************************
39 ********************************************************************/
41 WERROR _PNP_GetVersion(struct pipes_struct *p,
42 struct PNP_GetVersion *r)
44 *r->out.version = 0x0400; /* no idea what this means */
46 return WERR_OK;
49 /********************************************************************
50 ********************************************************************/
52 WERROR _PNP_GetDeviceListSize(struct pipes_struct *p,
53 struct PNP_GetDeviceListSize *r)
55 char *devicepath;
57 if ((r->in.flags & CM_GETIDLIST_FILTER_SERVICE) &&
58 (!r->in.devicename)) {
59 return WERR_CM_INVALID_POINTER;
62 if (!(devicepath = get_device_path(p->mem_ctx, r->in.devicename))) {
63 return WERR_NOMEM;
66 *r->out.size = strlen(devicepath) + 2;
68 TALLOC_FREE(devicepath);
70 return WERR_OK;
73 /****************************************************************
74 _PNP_GetDeviceList
75 ****************************************************************/
77 WERROR _PNP_GetDeviceList(struct pipes_struct *p,
78 struct PNP_GetDeviceList *r)
80 char *devicepath;
81 uint32_t size = 0;
82 const char **multi_sz = NULL;
83 DATA_BLOB blob;
85 if ((r->in.flags & CM_GETIDLIST_FILTER_SERVICE) &&
86 (!r->in.filter)) {
87 return WERR_CM_INVALID_POINTER;
90 if (!(devicepath = get_device_path(p->mem_ctx, r->in.filter))) {
91 return WERR_NOMEM;
94 size = strlen(devicepath) + 2;
96 if (*r->in.length < size) {
97 return WERR_CM_BUFFER_SMALL;
100 multi_sz = talloc_zero_array(p->mem_ctx, const char *, 2);
101 if (!multi_sz) {
102 return WERR_NOMEM;
105 multi_sz[0] = devicepath;
107 if (!push_reg_multi_sz(multi_sz, &blob, multi_sz)) {
108 return WERR_NOMEM;
111 if (*r->in.length < blob.length/2) {
112 return WERR_CM_BUFFER_SMALL;
115 memcpy(r->out.buffer, blob.data, blob.length);
117 return WERR_OK;
120 /********************************************************************
121 _PNP_GetDeviceRegProp
122 ********************************************************************/
124 WERROR _PNP_GetDeviceRegProp(struct pipes_struct *p,
125 struct PNP_GetDeviceRegProp *r)
127 char *ptr;
128 struct regval_ctr *values;
129 struct regval_blob *val;
131 switch( r->in.property ) {
132 case DEV_REGPROP_DESC:
134 /* just parse the service name from the device path and then
135 lookup the display name */
136 if ( !(ptr = strrchr_m( r->in.devicepath, '\\' )) )
137 return WERR_GENERAL_FAILURE;
138 *ptr = '\0';
140 if ( !(ptr = strrchr_m( r->in.devicepath, '_' )) )
141 return WERR_GENERAL_FAILURE;
142 ptr++;
144 if ( !(values = svcctl_fetch_regvalues(
145 ptr, p->server_info->ptok)))
146 return WERR_GENERAL_FAILURE;
148 if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) ) {
149 TALLOC_FREE( values );
150 return WERR_GENERAL_FAILURE;
153 if (*r->in.buffer_size < regval_size(val)) {
154 *r->out.needed = regval_size(val);
155 *r->out.buffer_size = 0;
156 TALLOC_FREE( values );
157 return WERR_CM_BUFFER_SMALL;
160 r->out.buffer = (uint8_t *)talloc_memdup(p->mem_ctx, regval_data_p(val), regval_size(val));
161 TALLOC_FREE(values);
162 if (!r->out.buffer) {
163 return WERR_NOMEM;
166 *r->out.reg_data_type = REG_SZ; /* always 1...tested using a remove device manager connection */
167 *r->out.buffer_size = regval_size(val);
168 *r->out.needed = regval_size(val);
170 break;
172 default:
173 *r->out.reg_data_type = 0x00437c98; /* ??? */
174 return WERR_CM_NO_SUCH_VALUE;
177 return WERR_OK;
180 /********************************************************************
181 ********************************************************************/
183 WERROR _PNP_ValidateDeviceInstance(struct pipes_struct *p,
184 struct PNP_ValidateDeviceInstance *r)
186 /* whatever dude */
187 return WERR_OK;
190 /********************************************************************
191 ********************************************************************/
193 WERROR _PNP_GetHwProfInfo(struct pipes_struct *p,
194 struct PNP_GetHwProfInfo *r)
196 /* steal the incoming buffer */
198 r->out.info = r->in.info;
200 /* Take the 5th Ammentment */
202 return WERR_CM_NO_MORE_HW_PROFILES;
205 /********************************************************************
206 ********************************************************************/
208 WERROR _PNP_HwProfFlags(struct pipes_struct *p,
209 struct PNP_HwProfFlags *r)
211 /* just nod your head */
213 return WERR_OK;
216 /****************************************************************
217 ****************************************************************/
219 WERROR _PNP_Disconnect(struct pipes_struct *p,
220 struct PNP_Disconnect *r)
222 p->rng_fault_state = true;
223 return WERR_NOT_SUPPORTED;
226 /****************************************************************
227 ****************************************************************/
229 WERROR _PNP_Connect(struct pipes_struct *p,
230 struct PNP_Connect *r)
232 p->rng_fault_state = true;
233 return WERR_NOT_SUPPORTED;
236 /****************************************************************
237 ****************************************************************/
239 WERROR _PNP_GetGlobalState(struct pipes_struct *p,
240 struct PNP_GetGlobalState *r)
242 p->rng_fault_state = true;
243 return WERR_NOT_SUPPORTED;
246 /****************************************************************
247 ****************************************************************/
249 WERROR _PNP_InitDetection(struct pipes_struct *p,
250 struct PNP_InitDetection *r)
252 p->rng_fault_state = true;
253 return WERR_NOT_SUPPORTED;
256 /****************************************************************
257 ****************************************************************/
259 WERROR _PNP_ReportLogOn(struct pipes_struct *p,
260 struct PNP_ReportLogOn *r)
262 p->rng_fault_state = true;
263 return WERR_NOT_SUPPORTED;
266 /****************************************************************
267 ****************************************************************/
269 WERROR _PNP_GetRootDeviceInstance(struct pipes_struct *p,
270 struct PNP_GetRootDeviceInstance *r)
272 p->rng_fault_state = true;
273 return WERR_NOT_SUPPORTED;
276 /****************************************************************
277 ****************************************************************/
279 WERROR _PNP_GetRelatedDeviceInstance(struct pipes_struct *p,
280 struct PNP_GetRelatedDeviceInstance *r)
282 p->rng_fault_state = true;
283 return WERR_NOT_SUPPORTED;
286 /****************************************************************
287 ****************************************************************/
289 WERROR _PNP_EnumerateSubKeys(struct pipes_struct *p,
290 struct PNP_EnumerateSubKeys *r)
292 p->rng_fault_state = true;
293 return WERR_NOT_SUPPORTED;
296 /****************************************************************
297 ****************************************************************/
299 WERROR _PNP_GetDepth(struct pipes_struct *p,
300 struct PNP_GetDepth *r)
302 p->rng_fault_state = true;
303 return WERR_NOT_SUPPORTED;
306 /****************************************************************
307 ****************************************************************/
309 WERROR _PNP_SetDeviceRegProp(struct pipes_struct *p,
310 struct PNP_SetDeviceRegProp *r)
312 p->rng_fault_state = true;
313 return WERR_NOT_SUPPORTED;
316 /****************************************************************
317 ****************************************************************/
319 WERROR _PNP_GetClassInstance(struct pipes_struct *p,
320 struct PNP_GetClassInstance *r)
322 p->rng_fault_state = true;
323 return WERR_NOT_SUPPORTED;
326 /****************************************************************
327 ****************************************************************/
329 WERROR _PNP_CreateKey(struct pipes_struct *p,
330 struct PNP_CreateKey *r)
332 p->rng_fault_state = true;
333 return WERR_NOT_SUPPORTED;
336 /****************************************************************
337 ****************************************************************/
339 WERROR _PNP_DeleteRegistryKey(struct pipes_struct *p,
340 struct PNP_DeleteRegistryKey *r)
342 p->rng_fault_state = true;
343 return WERR_NOT_SUPPORTED;
346 /****************************************************************
347 ****************************************************************/
349 WERROR _PNP_GetClassCount(struct pipes_struct *p,
350 struct PNP_GetClassCount *r)
352 p->rng_fault_state = true;
353 return WERR_NOT_SUPPORTED;
356 /****************************************************************
357 ****************************************************************/
359 WERROR _PNP_GetClassName(struct pipes_struct *p,
360 struct PNP_GetClassName *r)
362 p->rng_fault_state = true;
363 return WERR_NOT_SUPPORTED;
366 /****************************************************************
367 ****************************************************************/
369 WERROR _PNP_DeleteClassKey(struct pipes_struct *p,
370 struct PNP_DeleteClassKey *r)
372 p->rng_fault_state = true;
373 return WERR_NOT_SUPPORTED;
376 /****************************************************************
377 ****************************************************************/
379 WERROR _PNP_GetInterfaceDeviceAlias(struct pipes_struct *p,
380 struct PNP_GetInterfaceDeviceAlias *r)
382 p->rng_fault_state = true;
383 return WERR_NOT_SUPPORTED;
386 /****************************************************************
387 ****************************************************************/
389 WERROR _PNP_GetInterfaceDeviceList(struct pipes_struct *p,
390 struct PNP_GetInterfaceDeviceList *r)
392 p->rng_fault_state = true;
393 return WERR_NOT_SUPPORTED;
396 /****************************************************************
397 ****************************************************************/
399 WERROR _PNP_GetInterfaceDeviceListSize(struct pipes_struct *p,
400 struct PNP_GetInterfaceDeviceListSize *r)
402 p->rng_fault_state = true;
403 return WERR_NOT_SUPPORTED;
406 /****************************************************************
407 ****************************************************************/
409 WERROR _PNP_RegisterDeviceClassAssociation(struct pipes_struct *p,
410 struct PNP_RegisterDeviceClassAssociation *r)
412 p->rng_fault_state = true;
413 return WERR_NOT_SUPPORTED;
416 /****************************************************************
417 ****************************************************************/
419 WERROR _PNP_UnregisterDeviceClassAssociation(struct pipes_struct *p,
420 struct PNP_UnregisterDeviceClassAssociation *r)
422 p->rng_fault_state = true;
423 return WERR_NOT_SUPPORTED;
426 /****************************************************************
427 ****************************************************************/
429 WERROR _PNP_GetClassRegProp(struct pipes_struct *p,
430 struct PNP_GetClassRegProp *r)
432 p->rng_fault_state = true;
433 return WERR_NOT_SUPPORTED;
436 /****************************************************************
437 ****************************************************************/
439 WERROR _PNP_SetClassRegProp(struct pipes_struct *p,
440 struct PNP_SetClassRegProp *r)
442 p->rng_fault_state = true;
443 return WERR_NOT_SUPPORTED;
446 /****************************************************************
447 ****************************************************************/
449 WERROR _PNP_CreateDevInst(struct pipes_struct *p,
450 struct PNP_CreateDevInst *r)
452 p->rng_fault_state = true;
453 return WERR_NOT_SUPPORTED;
456 /****************************************************************
457 ****************************************************************/
459 WERROR _PNP_DeviceInstanceAction(struct pipes_struct *p,
460 struct PNP_DeviceInstanceAction *r)
462 p->rng_fault_state = true;
463 return WERR_NOT_SUPPORTED;
466 /****************************************************************
467 ****************************************************************/
469 WERROR _PNP_GetDeviceStatus(struct pipes_struct *p,
470 struct PNP_GetDeviceStatus *r)
472 p->rng_fault_state = true;
473 return WERR_NOT_SUPPORTED;
476 /****************************************************************
477 ****************************************************************/
479 WERROR _PNP_SetDeviceProblem(struct pipes_struct *p,
480 struct PNP_SetDeviceProblem *r)
482 p->rng_fault_state = true;
483 return WERR_NOT_SUPPORTED;
486 /****************************************************************
487 ****************************************************************/
489 WERROR _PNP_DisableDevInst(struct pipes_struct *p,
490 struct PNP_DisableDevInst *r)
492 p->rng_fault_state = true;
493 return WERR_NOT_SUPPORTED;
496 /****************************************************************
497 ****************************************************************/
499 WERROR _PNP_UninstallDevInst(struct pipes_struct *p,
500 struct PNP_UninstallDevInst *r)
502 p->rng_fault_state = true;
503 return WERR_NOT_SUPPORTED;
506 /****************************************************************
507 ****************************************************************/
509 WERROR _PNP_AddID(struct pipes_struct *p,
510 struct PNP_AddID *r)
512 p->rng_fault_state = true;
513 return WERR_NOT_SUPPORTED;
516 /****************************************************************
517 ****************************************************************/
519 WERROR _PNP_RegisterDriver(struct pipes_struct *p,
520 struct PNP_RegisterDriver *r)
522 p->rng_fault_state = true;
523 return WERR_NOT_SUPPORTED;
526 /****************************************************************
527 ****************************************************************/
529 WERROR _PNP_QueryRemove(struct pipes_struct *p,
530 struct PNP_QueryRemove *r)
532 p->rng_fault_state = true;
533 return WERR_NOT_SUPPORTED;
536 /****************************************************************
537 ****************************************************************/
539 WERROR _PNP_RequestDeviceEject(struct pipes_struct *p,
540 struct PNP_RequestDeviceEject *r)
542 p->rng_fault_state = true;
543 return WERR_NOT_SUPPORTED;
546 /****************************************************************
547 ****************************************************************/
549 WERROR _PNP_IsDockStationPresent(struct pipes_struct *p,
550 struct PNP_IsDockStationPresent *r)
552 p->rng_fault_state = true;
553 return WERR_NOT_SUPPORTED;
556 /****************************************************************
557 ****************************************************************/
559 WERROR _PNP_RequestEjectPC(struct pipes_struct *p,
560 struct PNP_RequestEjectPC *r)
562 p->rng_fault_state = true;
563 return WERR_NOT_SUPPORTED;
566 /****************************************************************
567 ****************************************************************/
569 WERROR _PNP_AddEmptyLogConf(struct pipes_struct *p,
570 struct PNP_AddEmptyLogConf *r)
572 p->rng_fault_state = true;
573 return WERR_NOT_SUPPORTED;
576 /****************************************************************
577 ****************************************************************/
579 WERROR _PNP_FreeLogConf(struct pipes_struct *p,
580 struct PNP_FreeLogConf *r)
582 p->rng_fault_state = true;
583 return WERR_NOT_SUPPORTED;
586 /****************************************************************
587 ****************************************************************/
589 WERROR _PNP_GetFirstLogConf(struct pipes_struct *p,
590 struct PNP_GetFirstLogConf *r)
592 p->rng_fault_state = true;
593 return WERR_NOT_SUPPORTED;
596 /****************************************************************
597 ****************************************************************/
599 WERROR _PNP_GetNextLogConf(struct pipes_struct *p,
600 struct PNP_GetNextLogConf *r)
602 p->rng_fault_state = true;
603 return WERR_NOT_SUPPORTED;
606 /****************************************************************
607 ****************************************************************/
609 WERROR _PNP_GetLogConfPriority(struct pipes_struct *p,
610 struct PNP_GetLogConfPriority *r)
612 p->rng_fault_state = true;
613 return WERR_NOT_SUPPORTED;
616 /****************************************************************
617 ****************************************************************/
619 WERROR _PNP_AddResDes(struct pipes_struct *p,
620 struct PNP_AddResDes *r)
622 p->rng_fault_state = true;
623 return WERR_NOT_SUPPORTED;
626 /****************************************************************
627 ****************************************************************/
629 WERROR _PNP_FreeResDes(struct pipes_struct *p,
630 struct PNP_FreeResDes *r)
632 p->rng_fault_state = true;
633 return WERR_NOT_SUPPORTED;
636 /****************************************************************
637 ****************************************************************/
639 WERROR _PNP_GetNextResDes(struct pipes_struct *p,
640 struct PNP_GetNextResDes *r)
642 p->rng_fault_state = true;
643 return WERR_NOT_SUPPORTED;
646 /****************************************************************
647 ****************************************************************/
649 WERROR _PNP_GetResDesData(struct pipes_struct *p,
650 struct PNP_GetResDesData *r)
652 p->rng_fault_state = true;
653 return WERR_NOT_SUPPORTED;
656 /****************************************************************
657 ****************************************************************/
659 WERROR _PNP_GetResDesDataSize(struct pipes_struct *p,
660 struct PNP_GetResDesDataSize *r)
662 p->rng_fault_state = true;
663 return WERR_NOT_SUPPORTED;
666 /****************************************************************
667 ****************************************************************/
669 WERROR _PNP_ModifyResDes(struct pipes_struct *p,
670 struct PNP_ModifyResDes *r)
672 p->rng_fault_state = true;
673 return WERR_NOT_SUPPORTED;
676 /****************************************************************
677 ****************************************************************/
679 WERROR _PNP_DetectResourceLimit(struct pipes_struct *p,
680 struct PNP_DetectResourceLimit *r)
682 p->rng_fault_state = true;
683 return WERR_NOT_SUPPORTED;
686 /****************************************************************
687 ****************************************************************/
689 WERROR _PNP_QueryResConfList(struct pipes_struct *p,
690 struct PNP_QueryResConfList *r)
692 p->rng_fault_state = true;
693 return WERR_NOT_SUPPORTED;
696 /****************************************************************
697 ****************************************************************/
699 WERROR _PNP_SetHwProf(struct pipes_struct *p,
700 struct PNP_SetHwProf *r)
702 p->rng_fault_state = true;
703 return WERR_NOT_SUPPORTED;
706 /****************************************************************
707 ****************************************************************/
709 WERROR _PNP_QueryArbitratorFreeData(struct pipes_struct *p,
710 struct PNP_QueryArbitratorFreeData *r)
712 p->rng_fault_state = true;
713 return WERR_NOT_SUPPORTED;
716 /****************************************************************
717 ****************************************************************/
719 WERROR _PNP_QueryArbitratorFreeSize(struct pipes_struct *p,
720 struct PNP_QueryArbitratorFreeSize *r)
722 p->rng_fault_state = true;
723 return WERR_NOT_SUPPORTED;
726 /****************************************************************
727 ****************************************************************/
729 WERROR _PNP_RunDetection(struct pipes_struct *p,
730 struct PNP_RunDetection *r)
732 p->rng_fault_state = true;
733 return WERR_NOT_SUPPORTED;
736 /****************************************************************
737 ****************************************************************/
739 WERROR _PNP_RegisterNotification(struct pipes_struct *p,
740 struct PNP_RegisterNotification *r)
742 p->rng_fault_state = true;
743 return WERR_NOT_SUPPORTED;
746 /****************************************************************
747 ****************************************************************/
749 WERROR _PNP_UnregisterNotification(struct pipes_struct *p,
750 struct PNP_UnregisterNotification *r)
752 p->rng_fault_state = true;
753 return WERR_NOT_SUPPORTED;
756 /****************************************************************
757 ****************************************************************/
759 WERROR _PNP_GetCustomDevProp(struct pipes_struct *p,
760 struct PNP_GetCustomDevProp *r)
762 p->rng_fault_state = true;
763 return WERR_NOT_SUPPORTED;
766 /****************************************************************
767 ****************************************************************/
769 WERROR _PNP_GetVersionInternal(struct pipes_struct *p,
770 struct PNP_GetVersionInternal *r)
772 p->rng_fault_state = true;
773 return WERR_NOT_SUPPORTED;
776 /****************************************************************
777 ****************************************************************/
779 WERROR _PNP_GetBlockedDriverInfo(struct pipes_struct *p,
780 struct PNP_GetBlockedDriverInfo *r)
782 p->rng_fault_state = true;
783 return WERR_NOT_SUPPORTED;
786 /****************************************************************
787 ****************************************************************/
789 WERROR _PNP_GetServerSideDeviceInstallFlags(struct pipes_struct *p,
790 struct PNP_GetServerSideDeviceInstallFlags *r)
792 p->rng_fault_state = true;
793 return WERR_NOT_SUPPORTED;