summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-12-04 02:01:57 +0000
committerAndrew Tridgell <tridge@samba.org>2000-12-04 02:01:57 +0000
commit6399b62175bed1bade82a8d9f3a40fd5c7693073 (patch)
tree03bf28c638f02fe931e118596c2da3fd9b315e08 /source3/utils
parentaf4649bdf3c605fb79fa71080c2327ec3dc7f9a2 (diff)
downloadsamba-6399b62175bed1bade82a8d9f3a40fd5c7693073.tar.gz
samba-6399b62175bed1bade82a8d9f3a40fd5c7693073.tar.bz2
samba-6399b62175bed1bade82a8d9f3a40fd5c7693073.zip
fixed acls set bug
(This used to be commit 44524958ed3a0d56b0504b044bf640ceffebb704)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbcacls.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 776ff19715..7f2ab8cf53 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -97,18 +97,19 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
{
char *p;
unsigned atype, aflags, amask;
+ DOM_SID sid;
+ SEC_ACCESS mask;
ZERO_STRUCTP(ace);
p = strchr(str,':');
if (!p) return False;
*p = 0;
if (sscanf(p+1, "%x/%x/%08x",
&atype, &aflags, &amask) != 3 ||
- !StringToSid(&ace->sid, str)) {
+ !StringToSid(&sid, str)) {
return False;
}
- ace->type = atype;
- ace->flags = aflags;
- ace->info.mask = amask;
+ mask.mask = amask;
+ init_sec_ace(ace, &sid, atype, mask, aflags);
return True;
}
@@ -117,16 +118,20 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
/* add an ACE to a list of ACEs in a SEC_ACL */
static BOOL add_ace(SEC_ACL **acl, SEC_ACE *ace)
{
+ SEC_ACL *new;
+ SEC_ACE *aces;
if (! *acl) {
- *acl = (SEC_ACL *)calloc(1, sizeof(*acl));
- if (! *acl) return False;
- (*acl)->revision = 3;
+ (*acl) = make_sec_acl(3, 1, ace);
+ return True;
}
- (*acl)->ace = Realloc((*acl)->ace,(1+((*acl)->num_aces))*sizeof(SEC_ACE));
- if (!(*acl)->ace) return False;
- memcpy(&((*acl)->ace[(*acl)->num_aces]), ace, sizeof(SEC_ACE));
- (*acl)->num_aces++;
+ aces = calloc(1+(*acl)->num_aces,sizeof(SEC_ACE));
+ memcpy(aces, (*acl)->ace, (*acl)->num_aces * sizeof(SEC_ACE));
+ memcpy(aces+(*acl)->num_aces, ace, sizeof(SEC_ACE));
+ new = make_sec_acl((*acl)->revision,1+(*acl)->num_aces, aces);
+ free_sec_acl(acl);
+ free(aces);
+ (*acl) = new;
return True;
}
@@ -189,7 +194,7 @@ static SEC_DESC *sec_desc_parse(char *str)
}
}
- ret = make_sec_desc(revision, type, owner_sid, grp_sid,
+ ret = make_sec_desc(revision, owner_sid, grp_sid,
sacl, dacl, &sd_size);
free_sec_acl(&sacl);
@@ -376,7 +381,7 @@ static void cacl_set(struct cli_state *cli, char *filename,
free_sec_desc(&sd);
}
- sd = make_sec_desc(old->revision, old->type, old->owner_sid, old->grp_sid,
+ sd = make_sec_desc(old->revision, old->owner_sid, old->grp_sid,
old->sacl, old->dacl, &sd_size);
if (!cli_set_secdesc(cli, fnum, sd)) {