diff options
author | Luke Leighton <lkcl@samba.org> | 1999-08-03 20:30:25 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-08-03 20:30:25 +0000 |
commit | 8598bf2a7f0f71ae7a023aac054c4df42b969ce6 (patch) | |
tree | 53352e656e5d01de5a2711b62ac1239979f6d53f /source3/rpcclient | |
parent | 9c593512155a4e1d9eb01ac63d4458df59b7357d (diff) | |
download | samba-8598bf2a7f0f71ae7a023aac054c4df42b969ce6.tar.gz samba-8598bf2a7f0f71ae7a023aac054c4df42b969ce6.tar.bz2 samba-8598bf2a7f0f71ae7a023aac054c4df42b969ce6.zip |
reverted jeremy's c++-like security descriptor modifications as the
simplest method to get rpcclient's reggetsec command working. the
buffers passed as arguments in do_reg_get_key_sec() do need to be
locally allocated not dynamically allocated, as two calls to
reg_get_key_sec() are needed. on the first, the server fills in the
size of the security descriptor buffer needed. on the second, the
server fills in the security descriptor buffer.
(This used to be commit b2d9cbef6f65bb696df8d8f49aa0c240e0bb1f50)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 50 | ||||
-rw-r--r-- | source3/rpcclient/display.c | 6 |
2 files changed, 32 insertions, 24 deletions
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index ed337a59f5..d5b032be90 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -739,7 +739,7 @@ void cmd_reg_test_key_sec(struct client_info *info) */ uint32 sec_buf_size; - SEC_DESC_BUF *psdb; + SEC_DESC_BUF sec_buf; DEBUG(5, ("cmd_reg_get_key_sec: smb_cli->fd:%d\n", smb_cli->fd)); @@ -771,28 +771,32 @@ void cmd_reg_test_key_sec(struct client_info *info) res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; - /* Get the size. */ + /* query key sec info. first call sets sec_buf_size. */ sec_buf_size = 0; + ZERO_STRUCT(sec_buf); res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, - &sec_buf_size, &psdb) : False; + &sec_buf_size, &sec_buf) : False; - free_sec_desc_buf(&psdb); + if (res4) + { + free_sec_desc_buf(&sec_buf); + } res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, - &sec_buf_size, &psdb) : False; + &sec_buf_size, &sec_buf) : False; - if (res4 && psdb->len > 0 && psdb->sec != NULL) + if (res4 && sec_buf.len > 0 && sec_buf.sec != NULL) { - display_sec_desc(out_hnd, ACTION_HEADER , psdb->sec); - display_sec_desc(out_hnd, ACTION_ENUMERATE, psdb->sec); - display_sec_desc(out_hnd, ACTION_FOOTER , psdb->sec); + display_sec_desc(out_hnd, ACTION_HEADER , sec_buf.sec); + display_sec_desc(out_hnd, ACTION_ENUMERATE, sec_buf.sec); + display_sec_desc(out_hnd, ACTION_FOOTER , sec_buf.sec); res4 = res4 ? do_reg_set_key_sec(smb_cli, fnum, &key_pol, - psdb) : False; + sec_buf_size, sec_buf.sec) : False; + free_sec_desc_buf(&sec_buf); } - free_sec_desc_buf(&psdb); /* close the key handle */ if ((*key_name) != 0) @@ -836,7 +840,7 @@ void cmd_reg_get_key_sec(struct client_info *info) */ uint32 sec_buf_size; - SEC_DESC_BUF *psdb; + SEC_DESC_BUF sec_buf; DEBUG(5, ("cmd_reg_get_key_sec: smb_cli->fd:%d\n", smb_cli->fd)); @@ -868,25 +872,29 @@ void cmd_reg_get_key_sec(struct client_info *info) res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; - /* Get the size. */ + /* query key sec info. first call sets sec_buf_size. */ sec_buf_size = 0; + ZERO_STRUCT(sec_buf); res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, - &sec_buf_size, &psdb) : False; + &sec_buf_size, &sec_buf) : False; - free_sec_desc_buf(&psdb); + if (res4) + { + free_sec_desc_buf(&sec_buf); + } res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, - &sec_buf_size, &psdb) : False; + &sec_buf_size, &sec_buf) : False; - if (res4 && psdb->len > 0 && psdb->sec != NULL) + if (res4 && sec_buf.len > 0 && sec_buf.sec != NULL) { - display_sec_desc(out_hnd, ACTION_HEADER , psdb->sec); - display_sec_desc(out_hnd, ACTION_ENUMERATE, psdb->sec); - display_sec_desc(out_hnd, ACTION_FOOTER , psdb->sec); + display_sec_desc(out_hnd, ACTION_HEADER , sec_buf.sec); + display_sec_desc(out_hnd, ACTION_ENUMERATE, sec_buf.sec); + display_sec_desc(out_hnd, ACTION_FOOTER , sec_buf.sec); + free(sec_buf.sec); } - free_sec_desc_buf(&psdb); /* close the key handle */ if ((*key_name) != 0) diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c index 545258b36a..fd876c5432 100644 --- a/source3/rpcclient/display.c +++ b/source3/rpcclient/display.c @@ -1355,9 +1355,9 @@ void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *sec_acl) int i; for (i = 0; i < sec_acl->num_aces; i++) { - display_sec_ace(out_hnd, ACTION_HEADER , &sec_acl->ace_list[i]); - display_sec_ace(out_hnd, ACTION_ENUMERATE, &sec_acl->ace_list[i]); - display_sec_ace(out_hnd, ACTION_FOOTER , &sec_acl->ace_list[i]); + display_sec_ace(out_hnd, ACTION_HEADER , &sec_acl->ace[i]); + display_sec_ace(out_hnd, ACTION_ENUMERATE, &sec_acl->ace[i]); + display_sec_ace(out_hnd, ACTION_FOOTER , &sec_acl->ace[i]); } } |