diff options
author | Luke Leighton <lkcl@samba.org> | 1999-02-23 22:39:54 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-02-23 22:39:54 +0000 |
commit | 1e71ecdcb21f24e70ee5edbbc05de0284fa588f4 (patch) | |
tree | 4c00ca048f4400e768c3611a35d77200a5ab1605 /source3/rpc_client | |
parent | 5c5f5445384bf1c55ad28ee7c24b2cce14744a80 (diff) | |
download | samba-1e71ecdcb21f24e70ee5edbbc05de0284fa588f4.tar.gz samba-1e71ecdcb21f24e70ee5edbbc05de0284fa588f4.tar.bz2 samba-1e71ecdcb21f24e70ee5edbbc05de0284fa588f4.zip |
added jeremy's new c++-like code for parsing of security descriptors.
(This used to be commit ec1b7000fd88c5a08e438c7033f60e49b9ec44a8)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_reg.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index fc7f6a5b53..04b1fdc650 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -442,7 +442,7 @@ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, do a REG Set Key Security ****************************************************************************/ BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, - uint32 sec_buf_size, SEC_DESC *sec_buf) + SEC_DESC_BUF *sec_buf) { prs_struct rbuf; prs_struct buf; @@ -458,7 +458,7 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, DEBUG(4,("REG Set Key security.\n")); - make_reg_q_set_key_sec(&q_o, hnd, sec_buf_size, sec_buf); + make_reg_q_set_key_sec(&q_o, hnd, sec_buf); /* turn parameters into data stream */ reg_io_q_set_key_sec("", &q_o, &buf, 0); @@ -486,11 +486,13 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, return valid_query; } + /**************************************************************************** do a REG Query Key Security ****************************************************************************/ BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, - uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf) + uint32 *sec_buf_size, + SEC_DESC_BUF **ppsec_desc_buf) { prs_struct rbuf; prs_struct buf; @@ -506,7 +508,7 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, DEBUG(4,("REG query key security. buf_size: %d\n", *sec_buf_size)); - make_reg_q_get_key_sec(&q_o, hnd, *sec_buf_size, sec_buf); + make_reg_q_get_key_sec(&q_o, hnd, *sec_buf_size, NULL); /* turn parameters into data stream */ reg_io_q_get_key_sec("", &q_o, &buf, 0); @@ -519,11 +521,6 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, ZERO_STRUCT(r_o); - r_o.data = sec_buf; - if (*sec_buf_size != 0) - { - sec_buf->sec = (SEC_DESC*)malloc(*sec_buf_size); - } reg_io_r_get_key_sec("", &r_o, &rbuf, 0); p = rbuf.offset != 0; @@ -546,6 +543,7 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, { valid_query = True; (*sec_buf_size) = r_o.data->len; + *ppsec_desc_buf = r_o.data; } } @@ -675,9 +673,9 @@ BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, prs_struct buf; REG_Q_CREATE_KEY q_o; BOOL valid_create = False; - SEC_DESC sec; - SEC_DESC_BUF sec_buf; - int sec_len; + SEC_DESC *sec; + SEC_DESC_BUF *sec_buf; + size_t sec_len; ZERO_STRUCT(sec); ZERO_STRUCT(sec_buf); @@ -693,13 +691,27 @@ BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, DEBUG(4,("REG Create Key: %s %s 0x%08x\n", key_name, key_class, sam_access != NULL ? sam_access->mask : 0)); - sec_len = make_sec_desc(&sec, 1, SEC_DESC_SELF_RELATIVE, - NULL, NULL, NULL, NULL); + sec = make_sec_desc(1, SEC_DESC_SELF_RELATIVE, + NULL, NULL, NULL, NULL, &sec_len); + if (sec == NULL) + { + DEBUG(0,("make_sec_desc : malloc fail.\n")); + return False; + } DEBUG(10,("make_sec_desc: len = %d\n", sec_len)); + sec_buf = make_sec_desc_buf( (int)sec_len, sec); + if (sec_buf == NULL) + { + DEBUG(0,("make_sec_desc : malloc fail (1)\n")); + free_sec_desc(&sec); + return False; + } + free_sec_desc(&sec); + make_reg_q_create_key(&q_o, hnd, key_name, key_class, sam_access, - &sec_buf, sec_len, &sec); + sec_buf); /* turn parameters into data stream */ reg_io_q_create_key("", &q_o, &buf, 0); @@ -729,7 +741,7 @@ BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, } } - free_sec_desc(&sec); + free_sec_desc_buf(&sec_buf); prs_mem_free(&rbuf); prs_mem_free(&buf ); |