diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-09-20 22:23:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:00:54 -0500 |
commit | 4db7642caa99c1b054322a8971c4b673556487ce (patch) | |
tree | 4ca6f040d613bc8127f43cd30a2bc12d3192471b /source3/utils | |
parent | 3ef4b8cf2f4a52c08b71fa8cac1ce4e8409c160b (diff) | |
download | samba-4db7642caa99c1b054322a8971c4b673556487ce.tar.gz samba-4db7642caa99c1b054322a8971c4b673556487ce.tar.bz2 samba-4db7642caa99c1b054322a8971c4b673556487ce.zip |
r18745: Use the Samba4 data structures for security descriptors and security descriptor
buffers.
Make security access masks simply a uint32 rather than a structure
with a uint32 in it.
(This used to be commit b41c52b9db5fc4a553b20a7a5a051a4afced9366)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_usershare.c | 8 | ||||
-rw-r--r-- | source3/utils/profiles.c | 8 | ||||
-rw-r--r-- | source3/utils/sharesec.c | 16 | ||||
-rw-r--r-- | source3/utils/smbcacls.c | 52 |
4 files changed, 42 insertions, 42 deletions
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index 6a306a9983..a41f9ec562 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -372,7 +372,7 @@ static int info_fn(struct file_list *fl, void *priv) const char *name; NTSTATUS ntstatus; - ntstatus = net_lookup_name_from_sid(ctx, &psd->dacl->ace[num_aces].trustee, &domain, &name); + ntstatus = net_lookup_name_from_sid(ctx, &psd->dacl->aces[num_aces].trustee, &domain, &name); if (NT_STATUS_IS_OK(ntstatus)) { if (domain && *domain) { @@ -382,15 +382,15 @@ static int info_fn(struct file_list *fl, void *priv) pstrcat(acl_str,name); } else { fstring sidstr; - sid_to_string(sidstr, &psd->dacl->ace[num_aces].trustee); + sid_to_string(sidstr, &psd->dacl->aces[num_aces].trustee); pstrcat(acl_str,sidstr); } pstrcat(acl_str, ":"); - if (psd->dacl->ace[num_aces].type == SEC_ACE_TYPE_ACCESS_DENIED) { + if (psd->dacl->aces[num_aces].type == SEC_ACE_TYPE_ACCESS_DENIED) { pstrcat(acl_str, "D,"); } else { - if (psd->dacl->ace[num_aces].info.mask & GENERIC_ALL_ACCESS) { + if (psd->dacl->aces[num_aces].access_mask & GENERIC_ALL_ACCESS) { pstrcat(acl_str, "F,"); } else { pstrcat(acl_str, "R,"); diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c index d40a2deea3..d5b14fdfb0 100644 --- a/source3/utils/profiles.c +++ b/source3/utils/profiles.c @@ -43,14 +43,14 @@ static BOOL swap_sid_in_acl( SEC_DESC *sd, DOM_SID *s1, DOM_SID *s2 ) update = True; } - if ( sid_equal( sd->grp_sid, s1 ) ) { - sid_copy( sd->grp_sid, s2 ); + if ( sid_equal( sd->group_sid, s1 ) ) { + sid_copy( sd->group_sid, s2 ); update = True; } for ( i=0; i<acl->num_aces; i++ ) { - if ( sid_equal( &acl->ace[i].trustee, s1 ) ) { - sid_copy( &acl->ace[i].trustee, s2 ); + if ( sid_equal( &acl->aces[i].trustee, s1 ) ) { + sid_copy( &acl->aces[i].trustee, s2 ); update = True; } } diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c index 3f66d4da6e..5749cf2f55 100644 --- a/source3/utils/sharesec.c +++ b/source3/utils/sharesec.c @@ -75,7 +75,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) if (numeric) { fprintf(f, "%d/%d/0x%08x", - ace->type, ace->flags, ace->info.mask); + ace->type, ace->flags, ace->access_mask); return; } @@ -96,7 +96,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) /* Standard permissions */ for (v = standard_values; v->perm; v++) { - if (ace->info.mask == v->mask) { + if (ace->access_mask == v->mask) { fprintf(f, "%s", v->perm); return; } @@ -105,11 +105,11 @@ static void print_ace(FILE *f, SEC_ACE *ace) /* Special permissions. Print out a hex value if we have leftover bits in the mask. */ - got_mask = ace->info.mask; + got_mask = ace->access_mask; again: for (v = special_values; v->perm; v++) { - if ((ace->info.mask & v->mask) == v->mask) { + if ((ace->access_mask & v->mask) == v->mask) { if (do_print) { fprintf(f, "%s", v->perm); } @@ -119,7 +119,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) if (!do_print) { if (got_mask != 0) { - fprintf(f, "0x%08x", ace->info.mask); + fprintf(f, "0x%08x", ace->access_mask); } else { do_print = 1; goto again; @@ -148,8 +148,8 @@ static void sec_desc_print(FILE *f, SEC_DESC *sd) fprintf(f, "OWNER:%s\n", sidstr); - if (sd->grp_sid) { - sid_to_string(sidstr, sd->grp_sid); + if (sd->group_sid) { + sid_to_string(sidstr, sd->group_sid); } else { fstrcpy(sidstr, ""); } @@ -158,7 +158,7 @@ static void sec_desc_print(FILE *f, SEC_DESC *sd) /* Print aces */ for (i = 0; sd->dacl && i < sd->dacl->num_aces; i++) { - SEC_ACE *ace = &sd->dacl->ace[i]; + SEC_ACE *ace = &sd->dacl->aces[i]; fprintf(f, "ACL:"); print_ace(f, ace); fprintf(f, "\n"); diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 85c59db5ec..67de8c7335 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -172,7 +172,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) if (numeric) { fprintf(f, "%d/%d/0x%08x", - ace->type, ace->flags, ace->info.mask); + ace->type, ace->flags, ace->access_mask); return; } @@ -193,7 +193,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) /* Standard permissions */ for (v = standard_values; v->perm; v++) { - if (ace->info.mask == v->mask) { + if (ace->access_mask == v->mask) { fprintf(f, "%s", v->perm); return; } @@ -202,11 +202,11 @@ static void print_ace(FILE *f, SEC_ACE *ace) /* Special permissions. Print out a hex value if we have leftover bits in the mask. */ - got_mask = ace->info.mask; + got_mask = ace->access_mask; again: for (v = special_values; v->perm; v++) { - if ((ace->info.mask & v->mask) == v->mask) { + if ((ace->access_mask & v->mask) == v->mask) { if (do_print) { fprintf(f, "%s", v->perm); } @@ -216,7 +216,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) if (!do_print) { if (got_mask != 0) { - fprintf(f, "0x%08x", ace->info.mask); + fprintf(f, "0x%08x", ace->access_mask); } else { do_print = 1; goto again; @@ -348,7 +348,7 @@ static BOOL parse_ace(SEC_ACE *ace, const char *orig_str) } done: - mask.mask = amask; + mask = amask; init_sec_ace(ace, &sid, atype, mask, aflags); SAFE_FREE(str); return True; @@ -366,7 +366,7 @@ static BOOL add_ace(SEC_ACL **the_acl, SEC_ACE *ace) if (!(aces = SMB_CALLOC_ARRAY(SEC_ACE, 1+(*the_acl)->num_aces))) { return False; } - memcpy(aces, (*the_acl)->ace, (*the_acl)->num_aces * sizeof(SEC_ACE)); + memcpy(aces, (*the_acl)->aces, (*the_acl)->num_aces * sizeof(SEC_ACE)); memcpy(aces+(*the_acl)->num_aces, ace, sizeof(SEC_ACE)); new_ace = make_sec_acl(ctx,(*the_acl)->revision,1+(*the_acl)->num_aces, aces); SAFE_FREE(aces); @@ -465,8 +465,8 @@ static void sec_desc_print(FILE *f, SEC_DESC *sd) fprintf(f, "OWNER:%s\n", sidstr); - if (sd->grp_sid) { - SidToString(sidstr, sd->grp_sid); + if (sd->group_sid) { + SidToString(sidstr, sd->group_sid); } else { fstrcpy(sidstr, ""); } @@ -475,7 +475,7 @@ static void sec_desc_print(FILE *f, SEC_DESC *sd) /* Print aces */ for (i = 0; sd->dacl && i < sd->dacl->num_aces; i++) { - SEC_ACE *ace = &sd->dacl->ace[i]; + SEC_ACE *ace = &sd->dacl->aces[i]; fprintf(f, "ACL:"); print_ace(f, ace); fprintf(f, "\n"); @@ -593,8 +593,8 @@ static int ace_compare(SEC_ACE *ace1, SEC_ACE *ace2) if (ace1->flags != ace2->flags) return ace1->flags - ace2->flags; - if (ace1->info.mask != ace2->info.mask) - return ace1->info.mask - ace2->info.mask; + if (ace1->access_mask != ace2->access_mask) + return ace1->access_mask - ace2->access_mask; if (ace1->size != ace2->size) return ace1->size - ace2->size; @@ -607,13 +607,13 @@ static void sort_acl(SEC_ACL *the_acl) uint32 i; if (!the_acl) return; - qsort(the_acl->ace, the_acl->num_aces, sizeof(the_acl->ace[0]), QSORT_CAST ace_compare); + qsort(the_acl->aces, the_acl->num_aces, sizeof(the_acl->aces[0]), QSORT_CAST ace_compare); for (i=1;i<the_acl->num_aces;) { - if (sec_ace_equal(&the_acl->ace[i-1], &the_acl->ace[i])) { + if (sec_ace_equal(&the_acl->aces[i-1], &the_acl->aces[i])) { int j; for (j=i; j<the_acl->num_aces-1; j++) { - the_acl->ace[j] = the_acl->ace[j+1]; + the_acl->aces[j] = the_acl->aces[j+1]; } the_acl->num_aces--; } else { @@ -665,11 +665,11 @@ static int cacl_set(struct cli_state *cli, char *filename, BOOL found = False; for (j=0;old->dacl && j<old->dacl->num_aces;j++) { - if (sec_ace_equal(&sd->dacl->ace[i], - &old->dacl->ace[j])) { + if (sec_ace_equal(&sd->dacl->aces[i], + &old->dacl->aces[j])) { uint32 k; for (k=j; k<old->dacl->num_aces-1;k++) { - old->dacl->ace[k] = old->dacl->ace[k+1]; + old->dacl->aces[k] = old->dacl->aces[k+1]; } old->dacl->num_aces--; found = True; @@ -679,7 +679,7 @@ static int cacl_set(struct cli_state *cli, char *filename, if (!found) { printf("ACL for ACE:"); - print_ace(stdout, &sd->dacl->ace[i]); + print_ace(stdout, &sd->dacl->aces[i]); printf(" not found\n"); } } @@ -690,9 +690,9 @@ static int cacl_set(struct cli_state *cli, char *filename, BOOL found = False; for (j=0;old->dacl && j<old->dacl->num_aces;j++) { - if (sid_equal(&sd->dacl->ace[i].trustee, - &old->dacl->ace[j].trustee)) { - old->dacl->ace[j] = sd->dacl->ace[i]; + if (sid_equal(&sd->dacl->aces[i].trustee, + &old->dacl->aces[j].trustee)) { + old->dacl->aces[j] = sd->dacl->aces[i]; found = True; } } @@ -700,7 +700,7 @@ static int cacl_set(struct cli_state *cli, char *filename, if (!found) { fstring str; - SidToString(str, &sd->dacl->ace[i].trustee); + SidToString(str, &sd->dacl->aces[i].trustee); printf("ACL for SID %s not found\n", str); } } @@ -709,15 +709,15 @@ static int cacl_set(struct cli_state *cli, char *filename, old->owner_sid = sd->owner_sid; } - if (sd->grp_sid) { - old->grp_sid = sd->grp_sid; + if (sd->group_sid) { + old->group_sid = sd->group_sid; } break; case SMB_ACL_ADD: for (i=0;sd->dacl && i<sd->dacl->num_aces;i++) { - add_ace(&old->dacl, &sd->dacl->ace[i]); + add_ace(&old->dacl, &sd->dacl->aces[i]); } break; |