PEP8: fix E305: expected 2 blank lines after class or function definition, found 1
[Samba.git] / source3 / rpc_server / spoolss / srv_spoolss_util.c
blobbe3c8fcddd7225b7694f0fb7033a7b8e93db5b36
1 /*
2 * Unix SMB/CIFS implementation.
4 * SPOOLSS RPC Pipe server / winreg client routines
6 * Copyright (c) 2010 Andreas Schneider <asn@samba.org>
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 "rpc_server/rpc_ncacn_np.h"
24 #include "../lib/tsocket/tsocket.h"
25 #include "../librpc/gen_ndr/ndr_spoolss.h"
26 #include "../librpc/gen_ndr/ndr_winreg.h"
27 #include "srv_spoolss_util.h"
28 #include "rpc_client/cli_winreg_spoolss.h"
30 WERROR winreg_printer_binding_handle(TALLOC_CTX *mem_ctx,
31 const struct auth_session_info *session_info,
32 struct messaging_context *msg_ctx,
33 struct dcerpc_binding_handle **winreg_binding_handle)
35 struct tsocket_address *local;
36 NTSTATUS status;
37 int rc;
39 rc = tsocket_address_inet_from_strings(mem_ctx,
40 "ip",
41 "127.0.0.1",
43 &local);
44 if (rc < 0) {
45 return WERR_NOT_ENOUGH_MEMORY;
48 status = rpcint_binding_handle(mem_ctx,
49 &ndr_table_winreg,
50 local,
51 NULL,
52 session_info,
53 msg_ctx,
54 winreg_binding_handle);
55 talloc_free(local);
56 if (!NT_STATUS_IS_OK(status)) {
57 DEBUG(0, ("winreg_printer_binding_handle: Could not connect to winreg pipe: %s\n",
58 nt_errstr(status)));
59 return ntstatus_to_werror(status);
62 return WERR_OK;
65 WERROR winreg_delete_printer_key_internal(TALLOC_CTX *mem_ctx,
66 const struct auth_session_info *session_info,
67 struct messaging_context *msg_ctx,
68 const char *printer,
69 const char *key)
71 WERROR result;
72 struct dcerpc_binding_handle *b;
73 TALLOC_CTX *tmp_ctx;
75 tmp_ctx = talloc_stackframe();
76 if (tmp_ctx == NULL) {
77 return WERR_NOT_ENOUGH_MEMORY;
80 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
81 if (!W_ERROR_IS_OK(result)) {
82 talloc_free(tmp_ctx);
83 return result;
86 result = winreg_delete_printer_key(tmp_ctx,
88 printer,
89 key);
91 talloc_free(tmp_ctx);
92 return result;
95 WERROR winreg_printer_update_changeid_internal(TALLOC_CTX *mem_ctx,
96 const struct auth_session_info *session_info,
97 struct messaging_context *msg_ctx,
98 const char *printer)
100 WERROR result;
101 struct dcerpc_binding_handle *b;
102 TALLOC_CTX *tmp_ctx;
104 tmp_ctx = talloc_stackframe();
105 if (tmp_ctx == NULL) {
106 return WERR_NOT_ENOUGH_MEMORY;
109 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
110 if (!W_ERROR_IS_OK(result)) {
111 talloc_free(tmp_ctx);
112 return result;
115 result = winreg_printer_update_changeid(mem_ctx,
117 printer);
119 talloc_free(tmp_ctx);
120 return result;
123 WERROR winreg_printer_get_changeid_internal(TALLOC_CTX *mem_ctx,
124 const struct auth_session_info *session_info,
125 struct messaging_context *msg_ctx,
126 const char *printer,
127 uint32_t *pchangeid)
129 WERROR result;
130 struct dcerpc_binding_handle *b;
131 TALLOC_CTX *tmp_ctx;
133 tmp_ctx = talloc_stackframe();
134 if (tmp_ctx == NULL) {
135 return WERR_NOT_ENOUGH_MEMORY;
138 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
139 if (!W_ERROR_IS_OK(result)) {
140 talloc_free(tmp_ctx);
141 return result;
144 result = winreg_printer_get_changeid(mem_ctx,
146 printer,
147 pchangeid);
149 talloc_free(tmp_ctx);
150 return result;
153 WERROR winreg_get_printer_internal(TALLOC_CTX *mem_ctx,
154 const struct auth_session_info *session_info,
155 struct messaging_context *msg_ctx,
156 const char *printer,
157 struct spoolss_PrinterInfo2 **pinfo2)
159 WERROR result;
160 struct dcerpc_binding_handle *b;
161 TALLOC_CTX *tmp_ctx;
163 tmp_ctx = talloc_stackframe();
164 if (tmp_ctx == NULL) {
165 return WERR_NOT_ENOUGH_MEMORY;
168 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
169 if (!W_ERROR_IS_OK(result)) {
170 talloc_free(tmp_ctx);
171 return result;
174 result = winreg_get_printer(mem_ctx,
176 printer,
177 pinfo2);
179 talloc_free(tmp_ctx);
180 return result;
183 WERROR winreg_create_printer_internal(TALLOC_CTX *mem_ctx,
184 const struct auth_session_info *session_info,
185 struct messaging_context *msg_ctx,
186 const char *sharename)
188 WERROR result;
189 struct dcerpc_binding_handle *b;
190 TALLOC_CTX *tmp_ctx;
192 tmp_ctx = talloc_stackframe();
193 if (tmp_ctx == NULL) {
194 return WERR_NOT_ENOUGH_MEMORY;
197 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
198 if (!W_ERROR_IS_OK(result)) {
199 talloc_free(tmp_ctx);
200 return result;
203 result = winreg_create_printer(mem_ctx,
205 sharename);
207 talloc_free(tmp_ctx);
208 return result;
211 WERROR winreg_update_printer_internal(TALLOC_CTX *mem_ctx,
212 const struct auth_session_info *session_info,
213 struct messaging_context *msg_ctx,
214 const char *sharename,
215 uint32_t info2_mask,
216 struct spoolss_SetPrinterInfo2 *info2,
217 struct spoolss_DeviceMode *devmode,
218 struct security_descriptor *secdesc)
220 WERROR result;
221 struct dcerpc_binding_handle *b;
222 TALLOC_CTX *tmp_ctx;
224 tmp_ctx = talloc_stackframe();
225 if (tmp_ctx == NULL) {
226 return WERR_NOT_ENOUGH_MEMORY;
229 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
230 if (!W_ERROR_IS_OK(result)) {
231 talloc_free(tmp_ctx);
232 return result;
235 result = winreg_update_printer(mem_ctx,
237 sharename,
238 info2_mask,
239 info2,
240 devmode,
241 secdesc);
243 talloc_free(tmp_ctx);
244 return result;
247 WERROR winreg_set_printer_dataex_internal(TALLOC_CTX *mem_ctx,
248 const struct auth_session_info *session_info,
249 struct messaging_context *msg_ctx,
250 const char *printer,
251 const char *key,
252 const char *value,
253 enum winreg_Type type,
254 uint8_t *data,
255 uint32_t data_size)
257 WERROR result;
258 struct dcerpc_binding_handle *b;
259 TALLOC_CTX *tmp_ctx;
261 tmp_ctx = talloc_stackframe();
262 if (tmp_ctx == NULL) {
263 return WERR_NOT_ENOUGH_MEMORY;
266 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
267 if (!W_ERROR_IS_OK(result)) {
268 talloc_free(tmp_ctx);
269 return result;
272 result = winreg_set_printer_dataex(mem_ctx,
274 printer,
275 key,
276 value,
277 type,
278 data,
279 data_size);
281 talloc_free(tmp_ctx);
282 return result;
285 WERROR winreg_enum_printer_dataex_internal(TALLOC_CTX *mem_ctx,
286 const struct auth_session_info *session_info,
287 struct messaging_context *msg_ctx,
288 const char *printer,
289 const char *key,
290 uint32_t *pnum_values,
291 struct spoolss_PrinterEnumValues **penum_values)
293 WERROR result;
294 struct dcerpc_binding_handle *b;
295 TALLOC_CTX *tmp_ctx;
297 tmp_ctx = talloc_stackframe();
298 if (tmp_ctx == NULL) {
299 return WERR_NOT_ENOUGH_MEMORY;
302 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
303 if (!W_ERROR_IS_OK(result)) {
304 talloc_free(tmp_ctx);
305 return result;
308 result = winreg_enum_printer_dataex(mem_ctx,
310 printer,
311 key,
312 pnum_values,
313 penum_values);
315 talloc_free(tmp_ctx);
316 return result;
319 WERROR winreg_get_printer_dataex_internal(TALLOC_CTX *mem_ctx,
320 const struct auth_session_info *session_info,
321 struct messaging_context *msg_ctx,
322 const char *printer,
323 const char *key,
324 const char *value,
325 enum winreg_Type *type,
326 uint8_t **data,
327 uint32_t *data_size)
329 WERROR result;
330 struct dcerpc_binding_handle *b;
331 TALLOC_CTX *tmp_ctx;
333 tmp_ctx = talloc_stackframe();
334 if (tmp_ctx == NULL) {
335 return WERR_NOT_ENOUGH_MEMORY;
338 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
339 if (!W_ERROR_IS_OK(result)) {
340 talloc_free(tmp_ctx);
341 return result;
344 result = winreg_get_printer_dataex(mem_ctx,
346 printer,
347 key,
348 value,
349 type,
350 data,
351 data_size);
353 talloc_free(tmp_ctx);
354 return result;
357 WERROR winreg_delete_printer_dataex_internal(TALLOC_CTX *mem_ctx,
358 const struct auth_session_info *session_info,
359 struct messaging_context *msg_ctx,
360 const char *printer,
361 const char *key,
362 const char *value)
364 WERROR result;
365 struct dcerpc_binding_handle *b;
366 TALLOC_CTX *tmp_ctx;
368 tmp_ctx = talloc_stackframe();
369 if (tmp_ctx == NULL) {
370 return WERR_NOT_ENOUGH_MEMORY;
373 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
374 if (!W_ERROR_IS_OK(result)) {
375 talloc_free(tmp_ctx);
376 return result;
379 result = winreg_delete_printer_dataex(mem_ctx,
381 printer,
382 key,
383 value);
385 talloc_free(tmp_ctx);
386 return result;
389 WERROR winreg_get_driver_internal(TALLOC_CTX *mem_ctx,
390 const struct auth_session_info *session_info,
391 struct messaging_context *msg_ctx,
392 const char *architecture,
393 const char *driver_name,
394 uint32_t driver_version,
395 struct spoolss_DriverInfo8 **_info8)
397 WERROR result;
398 struct dcerpc_binding_handle *b;
399 TALLOC_CTX *tmp_ctx;
401 tmp_ctx = talloc_stackframe();
402 if (tmp_ctx == NULL) {
403 return WERR_NOT_ENOUGH_MEMORY;
406 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
407 if (!W_ERROR_IS_OK(result)) {
408 talloc_free(tmp_ctx);
409 return result;
412 result = winreg_get_driver(mem_ctx,
414 architecture,
415 driver_name,
416 driver_version,
417 _info8);
419 talloc_free(tmp_ctx);
420 return result;
423 WERROR winreg_get_driver_list_internal(TALLOC_CTX *mem_ctx,
424 const struct auth_session_info *session_info,
425 struct messaging_context *msg_ctx,
426 const char *architecture,
427 uint32_t version,
428 uint32_t *num_drivers,
429 const char ***drivers_p)
431 WERROR result;
432 struct dcerpc_binding_handle *b;
433 TALLOC_CTX *tmp_ctx;
435 tmp_ctx = talloc_stackframe();
436 if (tmp_ctx == NULL) {
437 return WERR_NOT_ENOUGH_MEMORY;
440 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
441 if (!W_ERROR_IS_OK(result)) {
442 talloc_free(tmp_ctx);
443 return result;
446 result = winreg_get_driver_list(mem_ctx,
448 architecture,
449 version,
450 num_drivers,
451 drivers_p);
453 talloc_free(tmp_ctx);
454 return result;
457 WERROR winreg_del_driver_internal(TALLOC_CTX *mem_ctx,
458 const struct auth_session_info *session_info,
459 struct messaging_context *msg_ctx,
460 struct spoolss_DriverInfo8 *info8,
461 uint32_t version)
463 WERROR result;
464 struct dcerpc_binding_handle *b;
465 TALLOC_CTX *tmp_ctx;
467 tmp_ctx = talloc_stackframe();
468 if (tmp_ctx == NULL) {
469 return WERR_NOT_ENOUGH_MEMORY;
472 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
473 if (!W_ERROR_IS_OK(result)) {
474 talloc_free(tmp_ctx);
475 return result;
478 result = winreg_del_driver(mem_ctx,
480 info8,
481 version);
483 talloc_free(tmp_ctx);
484 return result;
487 WERROR winreg_add_driver_internal(TALLOC_CTX *mem_ctx,
488 const struct auth_session_info *session_info,
489 struct messaging_context *msg_ctx,
490 struct spoolss_AddDriverInfoCtr *r,
491 const char **driver_name,
492 uint32_t *driver_version)
494 WERROR result;
495 struct dcerpc_binding_handle *b;
496 TALLOC_CTX *tmp_ctx;
498 tmp_ctx = talloc_stackframe();
499 if (tmp_ctx == NULL) {
500 return WERR_NOT_ENOUGH_MEMORY;
503 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
504 if (!W_ERROR_IS_OK(result)) {
505 talloc_free(tmp_ctx);
506 return result;
509 result = winreg_add_driver(mem_ctx,
512 driver_name,
513 driver_version);
515 talloc_free(tmp_ctx);
516 return result;
519 WERROR winreg_get_core_driver_internal(TALLOC_CTX *mem_ctx,
520 const struct auth_session_info *session_info,
521 struct messaging_context *msg_ctx,
522 const char *architecture,
523 const struct GUID *core_driver_guid,
524 struct spoolss_CorePrinterDriver **core_printer_driver)
526 WERROR result;
527 struct dcerpc_binding_handle *b;
528 TALLOC_CTX *tmp_ctx;
530 tmp_ctx = talloc_stackframe();
531 if (tmp_ctx == NULL) {
532 return WERR_NOT_ENOUGH_MEMORY;
535 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
536 if (!W_ERROR_IS_OK(result)) {
537 talloc_free(tmp_ctx);
538 return result;
541 result = winreg_get_core_driver(mem_ctx,
543 architecture,
544 core_driver_guid,
545 core_printer_driver);
547 talloc_free(tmp_ctx);
548 return result;
551 WERROR winreg_add_core_driver_internal(TALLOC_CTX *mem_ctx,
552 const struct auth_session_info *session_info,
553 struct messaging_context *msg_ctx,
554 const char *architecture,
555 const struct spoolss_CorePrinterDriver *core_printer_driver)
557 WERROR result;
558 struct dcerpc_binding_handle *b;
559 TALLOC_CTX *tmp_ctx;
561 tmp_ctx = talloc_stackframe();
562 if (tmp_ctx == NULL) {
563 return WERR_NOT_ENOUGH_MEMORY;
566 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
567 if (!W_ERROR_IS_OK(result)) {
568 talloc_free(tmp_ctx);
569 return result;
572 result = winreg_add_core_driver(mem_ctx,
574 architecture,
575 core_printer_driver);
577 talloc_free(tmp_ctx);
578 return result;
581 WERROR winreg_add_driver_package_internal(TALLOC_CTX *mem_ctx,
582 const struct auth_session_info *session_info,
583 struct messaging_context *msg_ctx,
584 const char *package_id,
585 const char *architecture,
586 const char *driver_store_path,
587 const char *cab_path)
589 WERROR result;
590 struct dcerpc_binding_handle *b;
591 TALLOC_CTX *tmp_ctx;
593 tmp_ctx = talloc_stackframe();
594 if (tmp_ctx == NULL) {
595 return WERR_NOT_ENOUGH_MEMORY;
598 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
599 if (!W_ERROR_IS_OK(result)) {
600 talloc_free(tmp_ctx);
601 return result;
604 result = winreg_add_driver_package(mem_ctx,
606 package_id,
607 architecture,
608 driver_store_path,
609 cab_path);
611 talloc_free(tmp_ctx);
612 return result;
615 WERROR winreg_get_driver_package_internal(TALLOC_CTX *mem_ctx,
616 const struct auth_session_info *session_info,
617 struct messaging_context *msg_ctx,
618 const char *package_id,
619 const char *architecture,
620 const char **driver_store_path,
621 const char **cab_path)
623 WERROR result;
624 struct dcerpc_binding_handle *b;
625 TALLOC_CTX *tmp_ctx;
627 tmp_ctx = talloc_stackframe();
628 if (tmp_ctx == NULL) {
629 return WERR_NOT_ENOUGH_MEMORY;
632 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
633 if (!W_ERROR_IS_OK(result)) {
634 talloc_free(tmp_ctx);
635 return result;
638 result = winreg_get_driver_package(mem_ctx,
640 package_id,
641 architecture,
642 driver_store_path,
643 cab_path);
645 talloc_free(tmp_ctx);
646 return result;
649 WERROR winreg_del_driver_package_internal(TALLOC_CTX *mem_ctx,
650 const struct auth_session_info *session_info,
651 struct messaging_context *msg_ctx,
652 const char *package_id,
653 const char *architecture)
655 WERROR result;
656 struct dcerpc_binding_handle *b;
657 TALLOC_CTX *tmp_ctx;
659 tmp_ctx = talloc_stackframe();
660 if (tmp_ctx == NULL) {
661 return WERR_NOT_ENOUGH_MEMORY;
664 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
665 if (!W_ERROR_IS_OK(result)) {
666 talloc_free(tmp_ctx);
667 return result;
670 result = winreg_del_driver_package(mem_ctx,
672 package_id,
673 architecture);
675 talloc_free(tmp_ctx);
676 return result;
679 WERROR winreg_get_printer_secdesc_internal(TALLOC_CTX *mem_ctx,
680 const struct auth_session_info *session_info,
681 struct messaging_context *msg_ctx,
682 const char *sharename,
683 struct spoolss_security_descriptor **psecdesc)
685 WERROR result;
686 struct dcerpc_binding_handle *b;
687 TALLOC_CTX *tmp_ctx;
689 tmp_ctx = talloc_stackframe();
690 if (tmp_ctx == NULL) {
691 return WERR_NOT_ENOUGH_MEMORY;
694 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
695 if (!W_ERROR_IS_OK(result)) {
696 talloc_free(tmp_ctx);
697 return result;
700 result = winreg_get_printer_secdesc(mem_ctx,
702 sharename,
703 psecdesc);
705 talloc_free(tmp_ctx);
706 return result;
709 WERROR winreg_set_printer_secdesc_internal(TALLOC_CTX *mem_ctx,
710 const struct auth_session_info *session_info,
711 struct messaging_context *msg_ctx,
712 const char *sharename,
713 const struct spoolss_security_descriptor *secdesc)
715 WERROR result;
716 struct dcerpc_binding_handle *b;
717 TALLOC_CTX *tmp_ctx;
719 tmp_ctx = talloc_stackframe();
720 if (tmp_ctx == NULL) {
721 return WERR_NOT_ENOUGH_MEMORY;
724 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
725 if (!W_ERROR_IS_OK(result)) {
726 talloc_free(tmp_ctx);
727 return result;
730 result = winreg_set_printer_secdesc(mem_ctx,
732 sharename,
733 secdesc);
735 talloc_free(tmp_ctx);
736 return result;
739 WERROR winreg_printer_enumforms1_internal(TALLOC_CTX *mem_ctx,
740 const struct auth_session_info *session_info,
741 struct messaging_context *msg_ctx,
742 uint32_t *pnum_info,
743 union spoolss_FormInfo **pinfo)
745 WERROR result;
746 struct dcerpc_binding_handle *b;
747 TALLOC_CTX *tmp_ctx;
749 tmp_ctx = talloc_stackframe();
750 if (tmp_ctx == NULL) {
751 return WERR_NOT_ENOUGH_MEMORY;
754 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
755 if (!W_ERROR_IS_OK(result)) {
756 talloc_free(tmp_ctx);
757 return result;
760 result = winreg_printer_enumforms1(mem_ctx,
762 pnum_info,
763 pinfo);
765 talloc_free(tmp_ctx);
766 return result;
769 WERROR winreg_printer_getform1_internal(TALLOC_CTX *mem_ctx,
770 const struct auth_session_info *session_info,
771 struct messaging_context *msg_ctx,
772 const char *form_name,
773 struct spoolss_FormInfo1 *r)
775 WERROR result;
776 struct dcerpc_binding_handle *b;
777 TALLOC_CTX *tmp_ctx;
779 tmp_ctx = talloc_stackframe();
780 if (tmp_ctx == NULL) {
781 return WERR_NOT_ENOUGH_MEMORY;
784 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
785 if (!W_ERROR_IS_OK(result)) {
786 talloc_free(tmp_ctx);
787 return result;
790 result = winreg_printer_getform1(mem_ctx,
792 form_name,
795 talloc_free(tmp_ctx);
796 return result;
799 WERROR winreg_printer_addform1_internal(TALLOC_CTX *mem_ctx,
800 const struct auth_session_info *session_info,
801 struct messaging_context *msg_ctx,
802 struct spoolss_AddFormInfo1 *form)
804 WERROR result;
805 struct dcerpc_binding_handle *b;
806 TALLOC_CTX *tmp_ctx;
808 tmp_ctx = talloc_stackframe();
809 if (tmp_ctx == NULL) {
810 return WERR_NOT_ENOUGH_MEMORY;
813 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
814 if (!W_ERROR_IS_OK(result)) {
815 talloc_free(tmp_ctx);
816 return result;
819 result = winreg_printer_addform1(mem_ctx,
821 form);
823 talloc_free(tmp_ctx);
824 return result;
827 WERROR winreg_printer_setform1_internal(TALLOC_CTX *mem_ctx,
828 const struct auth_session_info *session_info,
829 struct messaging_context *msg_ctx,
830 const char *form_name,
831 struct spoolss_AddFormInfo1 *form)
833 WERROR result;
834 struct dcerpc_binding_handle *b;
835 TALLOC_CTX *tmp_ctx;
837 tmp_ctx = talloc_stackframe();
838 if (tmp_ctx == NULL) {
839 return WERR_NOT_ENOUGH_MEMORY;
842 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
843 if (!W_ERROR_IS_OK(result)) {
844 talloc_free(tmp_ctx);
845 return result;
848 result = winreg_printer_setform1(mem_ctx,
850 form_name,
851 form);
853 talloc_free(tmp_ctx);
854 return result;
857 WERROR winreg_printer_deleteform1_internal(TALLOC_CTX *mem_ctx,
858 const struct auth_session_info *session_info,
859 struct messaging_context *msg_ctx,
860 const char *form_name)
862 WERROR result;
863 struct dcerpc_binding_handle *b;
864 TALLOC_CTX *tmp_ctx;
866 tmp_ctx = talloc_stackframe();
867 if (tmp_ctx == NULL) {
868 return WERR_NOT_ENOUGH_MEMORY;
871 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
872 if (!W_ERROR_IS_OK(result)) {
873 talloc_free(tmp_ctx);
874 return result;
877 result = winreg_printer_deleteform1(mem_ctx,
879 form_name);
881 talloc_free(tmp_ctx);
882 return result;
885 WERROR winreg_enum_printer_key_internal(TALLOC_CTX *mem_ctx,
886 const struct auth_session_info *session_info,
887 struct messaging_context *msg_ctx,
888 const char *printer,
889 const char *key,
890 uint32_t *pnum_subkeys,
891 const char ***psubkeys)
893 WERROR result;
894 struct dcerpc_binding_handle *b;
895 TALLOC_CTX *tmp_ctx;
897 tmp_ctx = talloc_stackframe();
898 if (tmp_ctx == NULL) {
899 return WERR_NOT_ENOUGH_MEMORY;
902 result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
903 if (!W_ERROR_IS_OK(result)) {
904 talloc_free(tmp_ctx);
905 return result;
908 result = winreg_enum_printer_key(mem_ctx,
910 printer,
911 key,
912 pnum_subkeys,
913 psubkeys);
915 talloc_free(tmp_ctx);
916 return result;