3 * Unix SMB/Netbios implementation.
5 * RPC Pipe client / server routines
6 * Copyright (C) Andrew Tridgell 1992-1998,
7 * Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
8 * Copyright (C) Paul Ashton 1997-1998.
9 * Copyright (C) Jeremy Allison 1999.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 extern int DEBUGLEVEL
;
35 /****************************************************************************
37 ****************************************************************************/
38 BOOL
do_reg_connect(struct cli_state
*cli
, char *full_keyname
, char *key_name
,
44 if (full_keyname
== NULL
)
47 ZERO_STRUCTP(reg_hnd
);
50 * open registry receive a policy handle
53 if (!reg_split_key(full_keyname
, ®_type
, key_name
)) {
54 DEBUG(0,("do_reg_connect: unrecognised key name %s\n", full_keyname
));
59 case HKEY_LOCAL_MACHINE
:
60 res
= res
? do_reg_open_hklm(cli
, 0x84E0, 0x02000000, reg_hnd
) : False
;
64 res
= res
? do_reg_open_hku(cli
, 0x84E0, 0x02000000, reg_hnd
) : False
;
68 DEBUG(0,("do_reg_connect: unrecognised hive key\n"));
75 /****************************************************************************
77 ****************************************************************************/
78 BOOL
do_reg_open_hklm(struct cli_state
*cli
, uint16 unknown_0
, uint32 level
,
89 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
90 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
92 /* create and send a MSRPC command with api REG_OPEN_HKLM */
94 DEBUG(4,("REG Open HKLM\n"));
96 init_reg_q_open_hklm(&q_o
, unknown_0
, level
);
98 /* turn parameters into data stream */
99 if(!reg_io_q_open_hklm("", &q_o
, &buf
, 0)) {
105 /* send the data on \PIPE\ */
106 if (!rpc_api_pipe_req(cli
, REG_OPEN_HKLM
, &buf
, &rbuf
)) {
116 if(!reg_io_r_open_hklm("", &r_o
, &rbuf
, 0)) {
121 if (r_o
.status
!= 0) {
122 /* report error code */
123 DEBUG(0,("REG_OPEN_HKLM: %s\n", get_nt_error_msg(r_o
.status
)));
128 /* ok, at last: we're happy. return the policy handle */
129 memcpy(hnd
, r_o
.pol
.data
, sizeof(hnd
->data
));
136 /****************************************************************************
138 ****************************************************************************/
139 BOOL
do_reg_open_hku(struct cli_state
*cli
, uint16 unknown_0
, uint32 level
,
150 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
151 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
153 /* create and send a MSRPC command with api REG_OPEN_HKU */
155 DEBUG(4,("REG Open HKU\n"));
157 init_reg_q_open_hku(&q_o
, unknown_0
, level
);
159 /* turn parameters into data stream */
160 if(!reg_io_q_open_hku("", &q_o
, &buf
, 0)) {
166 /* send the data on \PIPE\ */
167 if (rpc_api_pipe_req(cli
, REG_OPEN_HKU
, &buf
, &rbuf
)) {
177 if(!reg_io_r_open_hku("", &r_o
, &rbuf
, 0)) {
182 if (r_o
.status
!= 0) {
183 /* report error code */
184 DEBUG(0,("REG_OPEN_HKU: %s\n", get_nt_error_msg(r_o
.status
)));
189 /* ok, at last: we're happy. return the policy handle */
190 memcpy(hnd
, r_o
.pol
.data
, sizeof(hnd
->data
));
197 /****************************************************************************
198 do a REG Unknown 0xB command. sent after a create key or create value.
199 this might be some sort of "sync" or "refresh" command, sent after
200 modification of the registry...
201 ****************************************************************************/
202 BOOL
do_reg_flush_key(struct cli_state
*cli
, POLICY_HND
*hnd
)
212 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
213 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
215 /* create and send a MSRPC command with api REG_FLUSH_KEY */
217 DEBUG(4,("REG Unknown 0xB\n"));
219 init_reg_q_flush_key(&q_o
, hnd
);
221 /* turn parameters into data stream */
222 if(!reg_io_q_flush_key("", &q_o
, &buf
, 0)) {
228 /* send the data on \PIPE\ */
229 if (!rpc_api_pipe_req(cli
, REG_FLUSH_KEY
, &buf
, &rbuf
)) {
239 if(!reg_io_r_flush_key("", &r_o
, &rbuf
, 0)) {
244 if (r_o
.status
!= 0) {
245 /* report error code */
246 DEBUG(0,("REG_FLUSH_KEY: %s\n", get_nt_error_msg(r_o
.status
)));
256 /****************************************************************************
258 ****************************************************************************/
259 BOOL
do_reg_query_key(struct cli_state
*cli
, POLICY_HND
*hnd
,
260 char *class, uint32
*class_len
,
261 uint32
*num_subkeys
, uint32
*max_subkeylen
,
262 uint32
*max_subkeysize
, uint32
*num_values
,
263 uint32
*max_valnamelen
, uint32
*max_valbufsize
,
264 uint32
*sec_desc
, NTTIME
*mod_time
)
274 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
275 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
277 /* create and send a MSRPC command with api REG_QUERY_KEY */
279 DEBUG(4,("REG Query Key\n"));
281 init_reg_q_query_key(&q_o
, hnd
, *class_len
);
283 /* turn parameters into data stream */
284 if(!reg_io_q_query_key("", &q_o
, &buf
, 0)) {
290 /* send the data on \PIPE\ */
291 if (!rpc_api_pipe_req(cli
, REG_QUERY_KEY
, &buf
, &rbuf
)) {
301 if(!reg_io_r_query_key("", &r_o
, &rbuf
, 0)) {
306 if (r_o
.status
!= 0) {
307 /* report error code */
308 DEBUG(0,("REG_QUERY_KEY: %s\n", get_nt_error_msg(r_o
.status
)));
313 *class_len
= r_o
.hdr_class
.uni_max_len
;
314 fstrcpy(class, dos_unistr2_to_str(&r_o
.uni_class
));
315 *num_subkeys
= r_o
.num_subkeys
;
316 *max_subkeylen
= r_o
.max_subkeylen
;
317 *max_subkeysize
= r_o
.max_subkeysize
;
318 *num_values
= r_o
.num_values
;
319 *max_valnamelen
= r_o
.max_valnamelen
;
320 *max_valbufsize
= r_o
.max_valbufsize
;
321 *sec_desc
= r_o
.sec_desc
;
322 *mod_time
= r_o
.mod_time
;
329 /****************************************************************************
331 ****************************************************************************/
332 BOOL
do_reg_unknown_1a(struct cli_state
*cli
, POLICY_HND
*hnd
, uint32
*unk
)
342 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
343 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
345 /* create and send a MSRPC command with api REG_UNKNOWN_1A */
347 DEBUG(4,("REG Unknown 1a\n"));
349 init_reg_q_unk_1a(&q_o
, hnd
);
351 /* turn parameters into data stream */
352 if(!reg_io_q_unk_1a("", &q_o
, &buf
, 0)) {
358 /* send the data on \PIPE\ */
359 if (rpc_api_pipe_req(cli
, REG_UNK_1A
, &buf
, &rbuf
)) {
369 if(!reg_io_r_unk_1a("", &r_o
, &rbuf
, 0)) {
374 if (r_o
.status
!= 0) {
375 /* report error code */
376 DEBUG(0,("REG_UNK_1A: %s\n", get_nt_error_msg(r_o
.status
)));
381 (*unk
) = r_o
.unknown
;
388 /****************************************************************************
390 ****************************************************************************/
391 BOOL
do_reg_query_info(struct cli_state
*cli
, POLICY_HND
*hnd
,
392 char *key_value
, uint32
* key_type
)
402 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
403 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
405 /* create and send a MSRPC command with api REG_INFO */
407 DEBUG(4,("REG Query Info\n"));
409 init_reg_q_info(&q_o
, hnd
, "ProductType");
411 /* turn parameters into data stream */
412 if(!reg_io_q_info("", &q_o
, &buf
, 0)) {
418 /* send the data on \PIPE\ */
419 if (!rpc_api_pipe_req(cli
, REG_INFO
, &buf
, &rbuf
)) {
429 if(!reg_io_r_info("", &r_o
, &rbuf
, 0)) {
434 if ( r_o
.status
!= 0) {
435 /* report error code */
436 DEBUG(0,("REG_INFO: %s\n", get_nt_error_msg(r_o
.status
)));
441 fstrcpy(key_value
, dos_buffer2_to_str(r_o
.uni_val
));
442 *key_type
= r_o
.type
;
449 /****************************************************************************
450 do a REG Set Key Security
451 ****************************************************************************/
452 BOOL
do_reg_set_key_sec(struct cli_state
*cli
, POLICY_HND
*hnd
, SEC_DESC_BUF
*sec_desc_buf
)
456 REG_Q_SET_KEY_SEC q_o
;
457 REG_R_SET_KEY_SEC r_o
;
462 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
463 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
465 /* create and send a MSRPC command with api REG_SET_KEY_SEC */
467 DEBUG(4,("REG Set Key security.\n"));
469 init_reg_q_set_key_sec(&q_o
, hnd
, sec_desc_buf
);
471 /* turn parameters into data stream */
472 if(!reg_io_q_set_key_sec("", &q_o
, &buf
, 0)) {
478 /* send the data on \PIPE\ */
479 if (!rpc_api_pipe_req(cli
, REG_SET_KEY_SEC
, &buf
, &rbuf
)) {
489 if(!reg_io_r_set_key_sec("", &r_o
, &rbuf
, 0)) {
494 if (r_o
.status
!= 0) {
504 /****************************************************************************
505 do a REG Query Key Security
506 ****************************************************************************/
508 BOOL
do_reg_get_key_sec(struct cli_state
*cli
, POLICY_HND
*hnd
, uint32
*sec_buf_size
, SEC_DESC_BUF
**ppsec_desc_buf
)
512 REG_Q_GET_KEY_SEC q_o
;
513 REG_R_GET_KEY_SEC r_o
;
518 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
519 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
521 /* create and send a MSRPC command with api REG_GET_KEY_SEC */
523 DEBUG(4,("REG query key security. buf_size: %d\n", *sec_buf_size
));
525 init_reg_q_get_key_sec(&q_o
, hnd
, *sec_buf_size
, NULL
);
527 /* turn parameters into data stream */
528 if(!reg_io_q_get_key_sec("", &q_o
, &buf
, 0)) {
534 /* send the data on \PIPE\ */
535 if (!rpc_api_pipe_req(cli
, REG_GET_KEY_SEC
, &buf
, &rbuf
)) {
545 if(!reg_io_r_get_key_sec("", &r_o
, &rbuf
, 0)) {
550 if (r_o
.status
== 0x0000007a) {
552 * get the maximum buffer size: it was too small
554 (*sec_buf_size
) = r_o
.hdr_sec
.buf_max_len
;
555 DEBUG(5,("sec_buf_size too small. use %d\n", *sec_buf_size
));
556 } else if (r_o
.status
!= 0) {
557 /* report error code */
558 DEBUG(0,("REG_GET_KEY_SEC: %s\n", get_nt_error_msg(r_o
.status
)));
562 (*sec_buf_size
) = r_o
.data
->len
;
563 *ppsec_desc_buf
= r_o
.data
;
571 /****************************************************************************
572 do a REG Delete Value
573 ****************************************************************************/
574 BOOL
do_reg_delete_val(struct cli_state
*cli
, POLICY_HND
*hnd
, char *val_name
)
578 REG_Q_DELETE_VALUE q_o
;
579 REG_R_DELETE_VALUE r_o
;
584 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
585 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
587 /* create and send a MSRPC command with api REG_DELETE_VALUE */
589 DEBUG(4,("REG Delete Value: %s\n", val_name
));
591 init_reg_q_delete_val(&q_o
, hnd
, val_name
);
593 /* turn parameters into data stream */
594 if(!reg_io_q_delete_val("", &q_o
, &buf
, 0)) {
600 /* send the data on \PIPE\ */
601 if (rpc_api_pipe_req(cli
, REG_DELETE_VALUE
, &buf
, &rbuf
)) {
611 if(!reg_io_r_delete_val("", &r_o
, &rbuf
, 0)) {
616 if (r_o
.status
!= 0) {
617 /* report error code */
618 DEBUG(0,("REG_DELETE_VALUE: %s\n", get_nt_error_msg(r_o
.status
)));
628 /****************************************************************************
630 ****************************************************************************/
631 BOOL
do_reg_delete_key(struct cli_state
*cli
, POLICY_HND
*hnd
, char *key_name
)
635 REG_Q_DELETE_KEY q_o
;
636 REG_R_DELETE_KEY r_o
;
641 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
642 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
644 /* create and send a MSRPC command with api REG_DELETE_KEY */
646 DEBUG(4,("REG Delete Key: %s\n", key_name
));
648 init_reg_q_delete_key(&q_o
, hnd
, key_name
);
650 /* turn parameters into data stream */
651 if(!reg_io_q_delete_key("", &q_o
, &buf
, 0)) {
657 /* send the data on \PIPE\ */
658 if (!rpc_api_pipe_req(cli
, REG_DELETE_KEY
, &buf
, &rbuf
)) {
668 if(!reg_io_r_delete_key("", &r_o
, &rbuf
, 0)) {
673 if (r_o
.status
!= 0) {
674 /* report error code */
675 DEBUG(0,("REG_DELETE_KEY: %s\n", get_nt_error_msg(r_o
.status
)));
685 /****************************************************************************
687 ****************************************************************************/
688 BOOL
do_reg_create_key(struct cli_state
*cli
, POLICY_HND
*hnd
,
689 char *key_name
, char *key_class
,
690 SEC_ACCESS
*sam_access
,
695 REG_Q_CREATE_KEY q_o
;
696 REG_R_CREATE_KEY r_o
;
697 SEC_DESC
*sec
= NULL
;
698 SEC_DESC_BUF
*sec_buf
= NULL
;
706 /* create and send a MSRPC command with api REG_CREATE_KEY */
708 DEBUG(4,("REG Create Key: %s %s 0x%08x\n", key_name
, key_class
,
709 sam_access
!= NULL
? sam_access
->mask
: 0));
711 if((sec
= make_sec_desc( cli
->mem_ctx
, 1, NULL
, NULL
, NULL
, NULL
, &sec_len
)) == NULL
) {
712 DEBUG(0,("make_sec_desc : malloc fail.\n"));
716 DEBUG(10,("make_sec_desc: len = %d\n", (int)sec_len
));
718 if((sec_buf
= make_sec_desc_buf( cli
->mem_ctx
, (int)sec_len
, sec
)) == NULL
) {
719 DEBUG(0,("make_sec_desc : malloc fail (1)\n"));
723 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
724 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
726 init_reg_q_create_key(&q_o
, hnd
, key_name
, key_class
, sam_access
, sec_buf
);
728 /* turn parameters into data stream */
729 if(!reg_io_q_create_key("", &q_o
, &buf
, 0)) {
735 /* send the data on \PIPE\ */
736 if (rpc_api_pipe_req(cli
, REG_CREATE_KEY
, &buf
, &rbuf
)) {
746 if(!reg_io_r_create_key("", &r_o
, &rbuf
, 0)) {
751 if (r_o
.status
!= 0) {
752 /* report error code */
753 DEBUG(0,("REG_CREATE_KEY: %s\n", get_nt_error_msg(r_o
.status
)));
758 memcpy(key
, r_o
.key_pol
.data
, sizeof(key
->data
));
765 /****************************************************************************
767 ****************************************************************************/
768 BOOL
do_reg_enum_key(struct cli_state
*cli
, POLICY_HND
*hnd
,
769 int key_index
, char *key_name
,
770 uint32
*unk_1
, uint32
*unk_2
,
781 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
782 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
784 /* create and send a MSRPC command with api REG_ENUM_KEY */
786 DEBUG(4,("REG Enum Key\n"));
788 init_reg_q_enum_key(&q_o
, hnd
, key_index
);
790 /* turn parameters into data stream */
791 if(!reg_io_q_enum_key("", &q_o
, &buf
, 0)) {
797 /* send the data on \PIPE\ */
798 if (!rpc_api_pipe_req(cli
, REG_ENUM_KEY
, &buf
, &rbuf
)) {
808 if(!reg_io_r_enum_key("", &r_o
, &rbuf
, 0)) {
813 if (r_o
.status
!= 0) {
814 /* report error code */
815 DEBUG(0,("REG_ENUM_KEY: %s\n", get_nt_error_msg(r_o
.status
)));
820 (*unk_1
) = r_o
.unknown_1
;
821 (*unk_2
) = r_o
.unknown_2
;
822 fstrcpy(key_name
, dos_unistr2(r_o
.key_name
.str
.buffer
));
823 (*mod_time
) = nt_time_to_unix(&r_o
.time
);
830 /****************************************************************************
831 do a REG Create Value
832 ****************************************************************************/
833 BOOL
do_reg_create_val(struct cli_state
*cli
, POLICY_HND
*hnd
,
834 char *val_name
, uint32 type
, BUFFER3
*data
)
838 REG_Q_CREATE_VALUE q_o
;
839 REG_R_CREATE_VALUE r_o
;
844 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
845 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
847 /* create and send a MSRPC command with api REG_CREATE_VALUE */
849 DEBUG(4,("REG Create Value: %s\n", val_name
));
851 init_reg_q_create_val(&q_o
, hnd
, val_name
, type
, data
);
853 /* turn parameters into data stream */
854 if(!reg_io_q_create_val("", &q_o
, &buf
, 0)) {
860 /* send the data on \PIPE\ */
861 if (!rpc_api_pipe_req(cli
, REG_CREATE_VALUE
, &buf
, &rbuf
)) {
871 if(!reg_io_r_create_val("", &r_o
, &rbuf
, 0)) {
876 if (r_o
.status
!= 0) {
877 /* report error code */
878 DEBUG(0,("REG_CREATE_VALUE: %s\n", get_nt_error_msg(r_o
.status
)));
888 /****************************************************************************
890 ****************************************************************************/
891 BOOL
do_reg_enum_val(struct cli_state
*cli
, POLICY_HND
*hnd
,
892 int val_index
, int max_valnamelen
, int max_valbufsize
,
894 uint32
*val_type
, BUFFER2
*value
)
898 REG_Q_ENUM_VALUE q_o
;
899 REG_R_ENUM_VALUE r_o
;
904 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
905 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
907 /* create and send a MSRPC command with api REG_ENUM_VALUE */
909 DEBUG(4,("REG Enum Value\n"));
911 init_reg_q_enum_val(&q_o
, hnd
, val_index
, max_valnamelen
, max_valbufsize
);
913 /* turn parameters into data stream */
914 if(!reg_io_q_enum_val("", &q_o
, &buf
, 0)) {
920 /* send the data on \PIPE\ */
921 if (!rpc_api_pipe_req(cli
, REG_ENUM_VALUE
, &buf
, &rbuf
)) {
930 r_o
.buf_value
= value
;
932 if(!reg_io_r_enum_val("", &r_o
, &rbuf
, 0)) {
937 if (r_o
.status
!= 0) {
938 /* report error code */
939 DEBUG(0,("REG_ENUM_VALUE: %s\n", get_nt_error_msg(r_o
.status
)));
944 (*val_type
) = r_o
.type
;
945 fstrcpy(val_name
, dos_unistr2_to_str(&r_o
.uni_name
));
952 /****************************************************************************
954 ****************************************************************************/
955 BOOL
do_reg_open_entry(struct cli_state
*cli
, POLICY_HND
*hnd
,
956 char *key_name
, uint32 unk_0
,
961 REG_Q_OPEN_ENTRY q_o
;
962 REG_R_OPEN_ENTRY r_o
;
967 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
968 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
970 /* create and send a MSRPC command with api REG_OPEN_ENTRY */
972 DEBUG(4,("REG Open Entry\n"));
974 init_reg_q_open_entry(&q_o
, hnd
, key_name
, unk_0
);
976 /* turn parameters into data stream */
977 if(!reg_io_q_open_entry("", &q_o
, &buf
, 0)) {
983 /* send the data on \PIPE\ */
984 if (!rpc_api_pipe_req(cli
, REG_OPEN_ENTRY
, &buf
, &rbuf
)) {
994 if(!reg_io_r_open_entry("", &r_o
, &rbuf
, 0)) {
999 if (r_o
.status
!= 0) {
1000 /* report error code */
1001 DEBUG(0,("REG_OPEN_ENTRY: %s\n", get_nt_error_msg(r_o
.status
)));
1002 prs_mem_free(&rbuf
);
1006 memcpy(key_hnd
, r_o
.pol
.data
, sizeof(key_hnd
->data
));
1008 prs_mem_free(&rbuf
);
1013 /****************************************************************************
1015 ****************************************************************************/
1016 BOOL
do_reg_close(struct cli_state
*cli
, POLICY_HND
*hnd
)
1027 /* create and send a MSRPC command with api REG_CLOSE */
1029 prs_init(&buf
, MAX_PDU_FRAG_LEN
, 4, cli
->mem_ctx
, MARSHALL
);
1030 prs_init(&rbuf
, 0, 4, cli
->mem_ctx
, UNMARSHALL
);
1032 DEBUG(4,("REG Close\n"));
1034 /* store the parameters */
1035 init_reg_q_close(&q_c
, hnd
);
1037 /* turn parameters into data stream */
1038 if(!reg_io_q_close("", &q_c
, &buf
, 0)) {
1040 prs_mem_free(&rbuf
);
1044 /* send the data on \PIPE\ */
1045 if (!rpc_api_pipe_req(cli
, REG_CLOSE
, &buf
, &rbuf
)) {
1047 prs_mem_free(&rbuf
);
1055 if(!reg_io_r_close("", &r_c
, &rbuf
, 0)) {
1056 prs_mem_free(&rbuf
);
1060 if (r_c
.status
!= 0) {
1061 /* report error code */
1062 DEBUG(0,("REG_CLOSE: %s\n", get_nt_error_msg(r_c
.status
)));
1063 prs_mem_free(&rbuf
);
1067 /* check that the returned policy handle is all zeros */
1069 for (i
= 0; i
< sizeof(r_c
.pol
.data
); i
++) {
1070 if (r_c
.pol
.data
[i
] != 0) {
1071 prs_mem_free(&rbuf
);
1072 DEBUG(0,("REG_CLOSE: non-zero handle returned\n"));
1077 prs_mem_free(&rbuf
);