summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-15 04:34:53 +0000
committerJeremy Allison <jra@samba.org>2001-03-15 04:34:53 +0000
commita8d396f25ed483371e5085ae14000b194af1e70b (patch)
tree1ff6118305166fc65356f60826155701dbf823f3 /source3/smbd
parentae728ea761e82d6d0bd5c96e7c82f1b1115f2e24 (diff)
downloadsamba-a8d396f25ed483371e5085ae14000b194af1e70b.tar.gz
samba-a8d396f25ed483371e5085ae14000b194af1e70b.tar.bz2
samba-a8d396f25ed483371e5085ae14000b194af1e70b.zip
Tidyup return of zero-permissions (map to ACE_DENIED, GENERIC_ALL, Everyone).
Jeremy. (This used to be commit 0d6c7dedd261c15697a7781678fe6bed877b61f6)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/posix_acls.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 5c0878b9ca..b9d6c7e32f 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -130,7 +130,8 @@ static SEC_ACCESS map_canon_ace_perms(int *pacl_type, DOM_SID *powner_sid, canon
nt_mask = UNIX_ACCESS_NONE;
} else {
/* Not owner, no access. */
- nt_mask = 0;
+ *pacl_type = SEC_ACE_TYPE_ACCESS_DENIED;
+ nt_mask = GENERIC_ALL_ACCESS;
}
} else {
nt_mask |= ((ace->perms & S_IRUSR) ? UNIX_ACCESS_R : 0 );
@@ -941,13 +942,13 @@ static canon_ace *unix_canonicalise_acl(files_struct *fsp, SMB_STRUCT_STAT *psbu
group_ace->type = SMB_ACL_GROUP_OBJ;
group_ace->sid = *pgroup;
- owner_ace->unix_ug.gid = psbuf->st_gid;
- owner_ace->owner_type = GID_ACE;
+ group_ace->unix_ug.gid = psbuf->st_gid;
+ group_ace->owner_type = GID_ACE;
other_ace->type = SMB_ACL_OTHER;
other_ace->sid = global_sid_World;
- owner_ace->unix_ug.world = -1;
- owner_ace->owner_type = WORLD_ACE;
+ other_ace->unix_ug.world = -1;
+ other_ace->owner_type = WORLD_ACE;
if (!fsp->is_directory) {
owner_ace->perms = unix_perms_to_acl_perms(psbuf->st_mode, S_IRUSR, S_IWUSR, S_IXUSR);
@@ -974,6 +975,23 @@ static canon_ace *unix_canonicalise_acl(files_struct *fsp, SMB_STRUCT_STAT *psbu
} else
safe_free(owner_ace);
+ if (list_head == NULL) {
+ /*
+ * Return an "Everyone" NO ACCESS ace.
+ */
+
+ if ((other_ace = (canon_ace *)malloc(sizeof(canon_ace))) == NULL)
+ goto fail;
+
+ other_ace->type = SMB_ACL_OTHER;
+ other_ace->sid = global_sid_World;
+ other_ace->unix_ug.world = -1;
+ other_ace->owner_type = WORLD_ACE;
+ other_ace->perms = (mode_t)0;
+
+ DLIST_ADD(list_head, other_ace);
+ }
+
return list_head;
fail:
@@ -1304,7 +1322,7 @@ static BOOL set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, BOOL defau
size_t get_nt_acl(files_struct *fsp, SEC_DESC **ppdesc)
{
SMB_STRUCT_STAT sbuf;
- SEC_ACE *nt_ace_list;
+ SEC_ACE *nt_ace_list = NULL;
DOM_SID owner_sid;
DOM_SID group_sid;
size_t sd_size = 0;
@@ -1379,13 +1397,15 @@ size_t get_nt_acl(files_struct *fsp, SEC_DESC **ppdesc)
num_dir_acls = count_canon_ace_list(dir_ace);
}
- /* Allocate the ace list. */
- if ((nt_ace_list = (SEC_ACE *)malloc((num_acls + num_dir_acls)* sizeof(SEC_ACE))) == NULL) {
- DEBUG(0,("get_nt_acl: Unable to malloc space for nt_ace_list.\n"));
- goto done;
- }
+ if ((num_acls + num_dir_acls) != 0) {
+ /* Allocate the ace list. */
+ if ((nt_ace_list = (SEC_ACE *)malloc((num_acls + num_dir_acls)* sizeof(SEC_ACE))) == NULL) {
+ DEBUG(0,("get_nt_acl: Unable to malloc space for nt_ace_list.\n"));
+ goto done;
+ }
- memset(nt_ace_list, '\0', (num_acls + num_dir_acls) * sizeof(SEC_ACE) );
+ memset(nt_ace_list, '\0', (num_acls + num_dir_acls) * sizeof(SEC_ACE) );
+ }
/*
* Create the NT ACE list from the canonical ace lists.