Bug 6488: acl_group_override() call in posix acls references an uninitialized variable.
[Samba.git] / source / rpc_server / srv_ntsvcs_nt.c
blob268da5289643d214f5d89e19ca51e9412a0ec4d9
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
5 * Copyright (C) Gerald (Jerry) Carter 2005.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
23 #undef DBGC_CLASS
24 #define DBGC_CLASS DBGC_RPC_SRV
26 /********************************************************************
27 ********************************************************************/
29 static char* get_device_path(TALLOC_CTX *mem_ctx, const char *device )
31 return talloc_asprintf(mem_ctx, "ROOT\\Legacy_%s\\0000", device);
34 /********************************************************************
35 ********************************************************************/
37 WERROR _PNP_GetVersion(pipes_struct *p,
38 struct PNP_GetVersion *r)
40 *r->out.version = 0x0400; /* no idea what this means */
42 return WERR_OK;
45 /********************************************************************
46 ********************************************************************/
48 WERROR _PNP_GetDeviceListSize(pipes_struct *p,
49 struct PNP_GetDeviceListSize *r)
51 char *devicepath;
53 if (!r->in.devicename) {
54 return WERR_ACCESS_DENIED;
57 if (!(devicepath = get_device_path(p->mem_ctx, r->in.devicename))) {
58 return WERR_NOMEM;
61 *r->out.size = strlen(devicepath) + 2;
63 TALLOC_FREE(devicepath);
65 return WERR_OK;
69 /********************************************************************
70 ********************************************************************/
72 WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u )
74 fstring device;
75 char *devicepath;
77 if ( !q_u->devicename )
78 return WERR_ACCESS_DENIED;
80 rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
82 if (!(devicepath = get_device_path(p->mem_ctx, device))) {
83 return WERR_NOMEM;
86 /* This has to be DOUBLE NULL terminated */
88 init_unistr2( &r_u->devicepath, devicepath, UNI_STR_DBLTERMINATE );
89 TALLOC_FREE(devicepath);
90 r_u->needed = r_u->devicepath.uni_str_len;
92 return WERR_OK;
95 /********************************************************************
96 ********************************************************************/
98 WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u )
100 fstring devicepath;
101 char *ptr;
102 REGVAL_CTR *values;
103 REGISTRY_VALUE *val;
105 rpcstr_pull(devicepath, q_u->devicepath.buffer, sizeof(devicepath), q_u->devicepath.uni_str_len*2, 0);
107 switch( q_u->property ) {
108 case DEV_REGPROP_DESC:
109 /* just parse the service name from the device path and then
110 lookup the display name */
111 if ( !(ptr = strrchr_m( devicepath, '\\' )) )
112 return WERR_GENERAL_FAILURE;
113 *ptr = '\0';
115 if ( !(ptr = strrchr_m( devicepath, '_' )) )
116 return WERR_GENERAL_FAILURE;
117 ptr++;
119 if ( !(values = svcctl_fetch_regvalues( ptr, p->pipe_user.nt_user_token )) )
120 return WERR_GENERAL_FAILURE;
122 if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) ) {
123 TALLOC_FREE( values );
124 return WERR_GENERAL_FAILURE;
127 r_u->unknown1 = 0x1; /* always 1...tested using a remove device manager connection */
128 r_u->size = reg_init_regval_buffer( &r_u->value, val );
129 r_u->needed = r_u->size;
131 TALLOC_FREE(values);
133 break;
135 default:
136 r_u->unknown1 = 0x00437c98;
137 return WERR_CM_NO_SUCH_VALUE;
140 return WERR_OK;
143 /********************************************************************
144 ********************************************************************/
146 WERROR _PNP_ValidateDeviceInstance(pipes_struct *p,
147 struct PNP_ValidateDeviceInstance *r)
149 /* whatever dude */
150 return WERR_OK;
153 /********************************************************************
154 ********************************************************************/
156 WERROR _PNP_GetHwProfInfo(pipes_struct *p,
157 struct PNP_GetHwProfInfo *r)
159 /* steal the incoming buffer */
161 r->out.info = r->in.info;
163 /* Take the 5th Ammentment */
165 return WERR_CM_NO_MORE_HW_PROFILES;
168 /********************************************************************
169 ********************************************************************/
171 WERROR _PNP_HwProfFlags(pipes_struct *p,
172 struct PNP_HwProfFlags *r)
174 /* just nod your head */
176 return WERR_OK;
179 /****************************************************************
180 ****************************************************************/
182 WERROR _PNP_Disconnect(pipes_struct *p,
183 struct PNP_Disconnect *r)
185 p->rng_fault_state = true;
186 return WERR_NOT_SUPPORTED;
189 /****************************************************************
190 ****************************************************************/
192 WERROR _PNP_Connect(pipes_struct *p,
193 struct PNP_Connect *r)
195 p->rng_fault_state = true;
196 return WERR_NOT_SUPPORTED;
199 /****************************************************************
200 ****************************************************************/
202 WERROR _PNP_GetGlobalState(pipes_struct *p,
203 struct PNP_GetGlobalState *r)
205 p->rng_fault_state = true;
206 return WERR_NOT_SUPPORTED;
209 /****************************************************************
210 ****************************************************************/
212 WERROR _PNP_InitDetection(pipes_struct *p,
213 struct PNP_InitDetection *r)
215 p->rng_fault_state = true;
216 return WERR_NOT_SUPPORTED;
219 /****************************************************************
220 ****************************************************************/
222 WERROR _PNP_ReportLogOn(pipes_struct *p,
223 struct PNP_ReportLogOn *r)
225 p->rng_fault_state = true;
226 return WERR_NOT_SUPPORTED;
229 /****************************************************************
230 ****************************************************************/
232 WERROR _PNP_GetRootDeviceInstance(pipes_struct *p,
233 struct PNP_GetRootDeviceInstance *r)
235 p->rng_fault_state = true;
236 return WERR_NOT_SUPPORTED;
239 /****************************************************************
240 ****************************************************************/
242 WERROR _PNP_GetRelatedDeviceInstance(pipes_struct *p,
243 struct PNP_GetRelatedDeviceInstance *r)
245 p->rng_fault_state = true;
246 return WERR_NOT_SUPPORTED;
249 /****************************************************************
250 ****************************************************************/
252 WERROR _PNP_EnumerateSubKeys(pipes_struct *p,
253 struct PNP_EnumerateSubKeys *r)
255 p->rng_fault_state = true;
256 return WERR_NOT_SUPPORTED;
259 /****************************************************************
260 ****************************************************************/
262 WERROR _PNP_GetDeviceList(pipes_struct *p,
263 struct PNP_GetDeviceList *r)
265 p->rng_fault_state = true;
266 return WERR_NOT_SUPPORTED;
269 /****************************************************************
270 ****************************************************************/
272 WERROR _PNP_GetDepth(pipes_struct *p,
273 struct PNP_GetDepth *r)
275 p->rng_fault_state = true;
276 return WERR_NOT_SUPPORTED;
279 /****************************************************************
280 ****************************************************************/
282 WERROR _PNP_GetDeviceRegProp(pipes_struct *p,
283 struct PNP_GetDeviceRegProp *r)
285 p->rng_fault_state = true;
286 return WERR_NOT_SUPPORTED;
289 /****************************************************************
290 ****************************************************************/
292 WERROR _PNP_SetDeviceRegProp(pipes_struct *p,
293 struct PNP_SetDeviceRegProp *r)
295 p->rng_fault_state = true;
296 return WERR_NOT_SUPPORTED;
299 /****************************************************************
300 ****************************************************************/
302 WERROR _PNP_GetClassInstance(pipes_struct *p,
303 struct PNP_GetClassInstance *r)
305 p->rng_fault_state = true;
306 return WERR_NOT_SUPPORTED;
309 /****************************************************************
310 ****************************************************************/
312 WERROR _PNP_CreateKey(pipes_struct *p,
313 struct PNP_CreateKey *r)
315 p->rng_fault_state = true;
316 return WERR_NOT_SUPPORTED;
319 /****************************************************************
320 ****************************************************************/
322 WERROR _PNP_DeleteRegistryKey(pipes_struct *p,
323 struct PNP_DeleteRegistryKey *r)
325 p->rng_fault_state = true;
326 return WERR_NOT_SUPPORTED;
329 /****************************************************************
330 ****************************************************************/
332 WERROR _PNP_GetClassCount(pipes_struct *p,
333 struct PNP_GetClassCount *r)
335 p->rng_fault_state = true;
336 return WERR_NOT_SUPPORTED;
339 /****************************************************************
340 ****************************************************************/
342 WERROR _PNP_GetClassName(pipes_struct *p,
343 struct PNP_GetClassName *r)
345 p->rng_fault_state = true;
346 return WERR_NOT_SUPPORTED;
349 /****************************************************************
350 ****************************************************************/
352 WERROR _PNP_DeleteClassKey(pipes_struct *p,
353 struct PNP_DeleteClassKey *r)
355 p->rng_fault_state = true;
356 return WERR_NOT_SUPPORTED;
359 /****************************************************************
360 ****************************************************************/
362 WERROR _PNP_GetInterfaceDeviceAlias(pipes_struct *p,
363 struct PNP_GetInterfaceDeviceAlias *r)
365 p->rng_fault_state = true;
366 return WERR_NOT_SUPPORTED;
369 /****************************************************************
370 ****************************************************************/
372 WERROR _PNP_GetInterfaceDeviceList(pipes_struct *p,
373 struct PNP_GetInterfaceDeviceList *r)
375 p->rng_fault_state = true;
376 return WERR_NOT_SUPPORTED;
379 /****************************************************************
380 ****************************************************************/
382 WERROR _PNP_GetInterfaceDeviceListSize(pipes_struct *p,
383 struct PNP_GetInterfaceDeviceListSize *r)
385 p->rng_fault_state = true;
386 return WERR_NOT_SUPPORTED;
389 /****************************************************************
390 ****************************************************************/
392 WERROR _PNP_RegisterDeviceClassAssociation(pipes_struct *p,
393 struct PNP_RegisterDeviceClassAssociation *r)
395 p->rng_fault_state = true;
396 return WERR_NOT_SUPPORTED;
399 /****************************************************************
400 ****************************************************************/
402 WERROR _PNP_UnregisterDeviceClassAssociation(pipes_struct *p,
403 struct PNP_UnregisterDeviceClassAssociation *r)
405 p->rng_fault_state = true;
406 return WERR_NOT_SUPPORTED;
409 /****************************************************************
410 ****************************************************************/
412 WERROR _PNP_GetClassRegProp(pipes_struct *p,
413 struct PNP_GetClassRegProp *r)
415 p->rng_fault_state = true;
416 return WERR_NOT_SUPPORTED;
419 /****************************************************************
420 ****************************************************************/
422 WERROR _PNP_SetClassRegProp(pipes_struct *p,
423 struct PNP_SetClassRegProp *r)
425 p->rng_fault_state = true;
426 return WERR_NOT_SUPPORTED;
429 /****************************************************************
430 ****************************************************************/
432 WERROR _PNP_CreateDevInst(pipes_struct *p,
433 struct PNP_CreateDevInst *r)
435 p->rng_fault_state = true;
436 return WERR_NOT_SUPPORTED;
439 /****************************************************************
440 ****************************************************************/
442 WERROR _PNP_DeviceInstanceAction(pipes_struct *p,
443 struct PNP_DeviceInstanceAction *r)
445 p->rng_fault_state = true;
446 return WERR_NOT_SUPPORTED;
449 /****************************************************************
450 ****************************************************************/
452 WERROR _PNP_GetDeviceStatus(pipes_struct *p,
453 struct PNP_GetDeviceStatus *r)
455 p->rng_fault_state = true;
456 return WERR_NOT_SUPPORTED;
459 /****************************************************************
460 ****************************************************************/
462 WERROR _PNP_SetDeviceProblem(pipes_struct *p,
463 struct PNP_SetDeviceProblem *r)
465 p->rng_fault_state = true;
466 return WERR_NOT_SUPPORTED;
469 /****************************************************************
470 ****************************************************************/
472 WERROR _PNP_DisableDevInst(pipes_struct *p,
473 struct PNP_DisableDevInst *r)
475 p->rng_fault_state = true;
476 return WERR_NOT_SUPPORTED;
479 /****************************************************************
480 ****************************************************************/
482 WERROR _PNP_UninstallDevInst(pipes_struct *p,
483 struct PNP_UninstallDevInst *r)
485 p->rng_fault_state = true;
486 return WERR_NOT_SUPPORTED;
489 /****************************************************************
490 ****************************************************************/
492 WERROR _PNP_AddID(pipes_struct *p,
493 struct PNP_AddID *r)
495 p->rng_fault_state = true;
496 return WERR_NOT_SUPPORTED;
499 /****************************************************************
500 ****************************************************************/
502 WERROR _PNP_RegisterDriver(pipes_struct *p,
503 struct PNP_RegisterDriver *r)
505 p->rng_fault_state = true;
506 return WERR_NOT_SUPPORTED;
509 /****************************************************************
510 ****************************************************************/
512 WERROR _PNP_QueryRemove(pipes_struct *p,
513 struct PNP_QueryRemove *r)
515 p->rng_fault_state = true;
516 return WERR_NOT_SUPPORTED;
519 /****************************************************************
520 ****************************************************************/
522 WERROR _PNP_RequestDeviceEject(pipes_struct *p,
523 struct PNP_RequestDeviceEject *r)
525 p->rng_fault_state = true;
526 return WERR_NOT_SUPPORTED;
529 /****************************************************************
530 ****************************************************************/
532 WERROR _PNP_IsDockStationPresent(pipes_struct *p,
533 struct PNP_IsDockStationPresent *r)
535 p->rng_fault_state = true;
536 return WERR_NOT_SUPPORTED;
539 /****************************************************************
540 ****************************************************************/
542 WERROR _PNP_RequestEjectPC(pipes_struct *p,
543 struct PNP_RequestEjectPC *r)
545 p->rng_fault_state = true;
546 return WERR_NOT_SUPPORTED;
549 /****************************************************************
550 ****************************************************************/
552 WERROR _PNP_AddEmptyLogConf(pipes_struct *p,
553 struct PNP_AddEmptyLogConf *r)
555 p->rng_fault_state = true;
556 return WERR_NOT_SUPPORTED;
559 /****************************************************************
560 ****************************************************************/
562 WERROR _PNP_FreeLogConf(pipes_struct *p,
563 struct PNP_FreeLogConf *r)
565 p->rng_fault_state = true;
566 return WERR_NOT_SUPPORTED;
569 /****************************************************************
570 ****************************************************************/
572 WERROR _PNP_GetFirstLogConf(pipes_struct *p,
573 struct PNP_GetFirstLogConf *r)
575 p->rng_fault_state = true;
576 return WERR_NOT_SUPPORTED;
579 /****************************************************************
580 ****************************************************************/
582 WERROR _PNP_GetNextLogConf(pipes_struct *p,
583 struct PNP_GetNextLogConf *r)
585 p->rng_fault_state = true;
586 return WERR_NOT_SUPPORTED;
589 /****************************************************************
590 ****************************************************************/
592 WERROR _PNP_GetLogConfPriority(pipes_struct *p,
593 struct PNP_GetLogConfPriority *r)
595 p->rng_fault_state = true;
596 return WERR_NOT_SUPPORTED;
599 /****************************************************************
600 ****************************************************************/
602 WERROR _PNP_AddResDes(pipes_struct *p,
603 struct PNP_AddResDes *r)
605 p->rng_fault_state = true;
606 return WERR_NOT_SUPPORTED;
609 /****************************************************************
610 ****************************************************************/
612 WERROR _PNP_FreeResDes(pipes_struct *p,
613 struct PNP_FreeResDes *r)
615 p->rng_fault_state = true;
616 return WERR_NOT_SUPPORTED;
619 /****************************************************************
620 ****************************************************************/
622 WERROR _PNP_GetNextResDes(pipes_struct *p,
623 struct PNP_GetNextResDes *r)
625 p->rng_fault_state = true;
626 return WERR_NOT_SUPPORTED;
629 /****************************************************************
630 ****************************************************************/
632 WERROR _PNP_GetResDesData(pipes_struct *p,
633 struct PNP_GetResDesData *r)
635 p->rng_fault_state = true;
636 return WERR_NOT_SUPPORTED;
639 /****************************************************************
640 ****************************************************************/
642 WERROR _PNP_GetResDesDataSize(pipes_struct *p,
643 struct PNP_GetResDesDataSize *r)
645 p->rng_fault_state = true;
646 return WERR_NOT_SUPPORTED;
649 /****************************************************************
650 ****************************************************************/
652 WERROR _PNP_ModifyResDes(pipes_struct *p,
653 struct PNP_ModifyResDes *r)
655 p->rng_fault_state = true;
656 return WERR_NOT_SUPPORTED;
659 /****************************************************************
660 ****************************************************************/
662 WERROR _PNP_DetectResourceLimit(pipes_struct *p,
663 struct PNP_DetectResourceLimit *r)
665 p->rng_fault_state = true;
666 return WERR_NOT_SUPPORTED;
669 /****************************************************************
670 ****************************************************************/
672 WERROR _PNP_QueryResConfList(pipes_struct *p,
673 struct PNP_QueryResConfList *r)
675 p->rng_fault_state = true;
676 return WERR_NOT_SUPPORTED;
679 /****************************************************************
680 ****************************************************************/
682 WERROR _PNP_SetHwProf(pipes_struct *p,
683 struct PNP_SetHwProf *r)
685 p->rng_fault_state = true;
686 return WERR_NOT_SUPPORTED;
689 /****************************************************************
690 ****************************************************************/
692 WERROR _PNP_QueryArbitratorFreeData(pipes_struct *p,
693 struct PNP_QueryArbitratorFreeData *r)
695 p->rng_fault_state = true;
696 return WERR_NOT_SUPPORTED;
699 /****************************************************************
700 ****************************************************************/
702 WERROR _PNP_QueryArbitratorFreeSize(pipes_struct *p,
703 struct PNP_QueryArbitratorFreeSize *r)
705 p->rng_fault_state = true;
706 return WERR_NOT_SUPPORTED;
709 /****************************************************************
710 ****************************************************************/
712 WERROR _PNP_RunDetection(pipes_struct *p,
713 struct PNP_RunDetection *r)
715 p->rng_fault_state = true;
716 return WERR_NOT_SUPPORTED;
719 /****************************************************************
720 ****************************************************************/
722 WERROR _PNP_RegisterNotification(pipes_struct *p,
723 struct PNP_RegisterNotification *r)
725 p->rng_fault_state = true;
726 return WERR_NOT_SUPPORTED;
729 /****************************************************************
730 ****************************************************************/
732 WERROR _PNP_UnregisterNotification(pipes_struct *p,
733 struct PNP_UnregisterNotification *r)
735 p->rng_fault_state = true;
736 return WERR_NOT_SUPPORTED;
739 /****************************************************************
740 ****************************************************************/
742 WERROR _PNP_GetCustomDevProp(pipes_struct *p,
743 struct PNP_GetCustomDevProp *r)
745 p->rng_fault_state = true;
746 return WERR_NOT_SUPPORTED;
749 /****************************************************************
750 ****************************************************************/
752 WERROR _PNP_GetVersionInternal(pipes_struct *p,
753 struct PNP_GetVersionInternal *r)
755 p->rng_fault_state = true;
756 return WERR_NOT_SUPPORTED;
759 /****************************************************************
760 ****************************************************************/
762 WERROR _PNP_GetBlockedDriverInfo(pipes_struct *p,
763 struct PNP_GetBlockedDriverInfo *r)
765 p->rng_fault_state = true;
766 return WERR_NOT_SUPPORTED;
769 /****************************************************************
770 ****************************************************************/
772 WERROR _PNP_GetServerSideDeviceInstallFlags(pipes_struct *p,
773 struct PNP_GetServerSideDeviceInstallFlags *r)
775 p->rng_fault_state = true;
776 return WERR_NOT_SUPPORTED;