summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_reg.c50
-rw-r--r--source3/rpcclient/display.c6
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]);
}
}