summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-11-12 23:35:05 +0000
committerLuke Leighton <lkcl@samba.org>1998-11-12 23:35:05 +0000
commit2c7f6da1fa95ff77d6c60fcd109205847519434f (patch)
treed52fbd3a92e235ce15a1670efa30f8c0bea21a02 /source3/rpcclient
parentc1bf51bd2c993c09c67ff003c6fba4edd5b350bd (diff)
downloadsamba-2c7f6da1fa95ff77d6c60fcd109205847519434f.tar.gz
samba-2c7f6da1fa95ff77d6c60fcd109205847519434f.tar.bz2
samba-2c7f6da1fa95ff77d6c60fcd109205847519434f.zip
security descriptors.
kanji const char* warnings. (This used to be commit 06abdfd68e1d7fa8741afc3f56ec7a13b5fa4ccc)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_reg.c21
-rw-r--r--source3/rpcclient/display.c30
2 files changed, 34 insertions, 17 deletions
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c
index ada125e448..53936a3cf3 100644
--- a/source3/rpcclient/cmd_reg.c
+++ b/source3/rpcclient/cmd_reg.c
@@ -637,7 +637,7 @@ void cmd_reg_create_key(struct client_info *info)
fstring parent_name;
fstring key_name;
fstring key_class;
- SEC_INFO sam_access;
+ SEC_ACCESS sam_access;
DEBUG(5, ("cmd_reg_create_key: smb_cli->fd:%d\n", smb_cli->fd));
@@ -661,7 +661,7 @@ void cmd_reg_create_key(struct client_info *info)
}
/* set access permissions */
- sam_access.perms = SEC_RIGHTS_READ;
+ sam_access.mask = SEC_RIGHTS_READ;
/* open WINREG session. */
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
@@ -766,11 +766,16 @@ void cmd_reg_test_key_sec(struct client_info *info)
/* query key sec info. first call sets sec_buf_size. */
sec_buf_size = 0;
- sec_buf.sec = NULL;
+ ZERO_STRUCT(sec_buf);
res4 = res3 ? do_reg_get_key_sec(smb_cli, &key_pol,
&sec_buf_size, &sec_buf) : False;
+ if (res4)
+ {
+ free_sec_desc_buf(&sec_buf);
+ }
+
res4 = res4 ? do_reg_get_key_sec(smb_cli, &key_pol,
&sec_buf_size, &sec_buf) : False;
@@ -783,7 +788,7 @@ void cmd_reg_test_key_sec(struct client_info *info)
res4 = res4 ? do_reg_set_key_sec(smb_cli, &key_pol,
sec_buf_size, sec_buf.sec) : False;
- free(sec_buf.sec);
+ free_sec_desc_buf(&sec_buf);
}
/* close the key handle */
@@ -861,11 +866,16 @@ void cmd_reg_get_key_sec(struct client_info *info)
/* query key sec info. first call sets sec_buf_size. */
sec_buf_size = 0;
- sec_buf.sec = NULL;
+ ZERO_STRUCT(sec_buf);
res4 = res3 ? do_reg_get_key_sec(smb_cli, &key_pol,
&sec_buf_size, &sec_buf) : False;
+ if (res4)
+ {
+ free_sec_desc_buf(&sec_buf);
+ }
+
res4 = res4 ? do_reg_get_key_sec(smb_cli, &key_pol,
&sec_buf_size, &sec_buf) : False;
@@ -874,6 +884,7 @@ void cmd_reg_get_key_sec(struct client_info *info)
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);
}
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index d3c2f84d21..f3bde7e58d 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -1015,7 +1015,7 @@ void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_I
/****************************************************************************
convert a security permissions into a string
****************************************************************************/
-char *get_sec_perms_str(uint32 type)
+char *get_sec_mask_str(uint32 type)
{
static fstring typestr;
int i;
@@ -1077,9 +1077,9 @@ char *get_sec_perms_str(uint32 type)
}
/****************************************************************************
- display sec_info structure
+ display sec_access structure
****************************************************************************/
-void display_sec_info(FILE *out_hnd, enum action_type action, SEC_INFO *info)
+void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *info)
{
switch (action)
{
@@ -1090,7 +1090,7 @@ void display_sec_info(FILE *out_hnd, enum action_type action, SEC_INFO *info)
case ACTION_ENUMERATE:
{
fprintf(out_hnd, "\t\tPermissions: %s\n",
- get_sec_perms_str(info->perms));
+ get_sec_mask_str(info->mask));
}
case ACTION_FOOTER:
{
@@ -1115,9 +1115,9 @@ void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *ace)
{
fstring sid_str;
- display_sec_info(out_hnd, ACTION_HEADER , &ace->info);
- display_sec_info(out_hnd, ACTION_ENUMERATE, &ace->info);
- display_sec_info(out_hnd, ACTION_FOOTER , &ace->info);
+ display_sec_access(out_hnd, ACTION_HEADER , &ace->info);
+ display_sec_access(out_hnd, ACTION_ENUMERATE, &ace->info);
+ display_sec_access(out_hnd, ACTION_FOOTER , &ace->info);
sid_to_string(sid_str, &ace->sid);
fprintf(out_hnd, "\t\tSID: %s\n", sid_str);
@@ -1186,20 +1186,26 @@ void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *sec)
{
fstring sid_str;
+ if (sec->off_sacl != 0)
+ {
+ display_sec_acl(out_hnd, ACTION_HEADER , sec->sacl);
+ display_sec_acl(out_hnd, ACTION_ENUMERATE, sec->sacl);
+ display_sec_acl(out_hnd, ACTION_FOOTER , sec->sacl);
+ }
if (sec->off_dacl != 0)
{
- display_sec_acl(out_hnd, ACTION_HEADER , &sec->dacl);
- display_sec_acl(out_hnd, ACTION_ENUMERATE, &sec->dacl);
- display_sec_acl(out_hnd, ACTION_FOOTER , &sec->dacl);
+ display_sec_acl(out_hnd, ACTION_HEADER , sec->dacl);
+ display_sec_acl(out_hnd, ACTION_ENUMERATE, sec->dacl);
+ display_sec_acl(out_hnd, ACTION_FOOTER , sec->dacl);
}
if (sec->off_owner_sid != 0)
{
- sid_to_string(sid_str, &sec->owner_sid);
+ sid_to_string(sid_str, sec->owner_sid);
fprintf(out_hnd, "\tOwner SID:\t%s\n", sid_str);
}
if (sec->off_grp_sid != 0)
{
- sid_to_string(sid_str, &sec->grp_sid);
+ sid_to_string(sid_str, sec->grp_sid);
fprintf(out_hnd, "\tParent SID:\t%s\n", sid_str);
}