summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_aixacl2.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-04-14 18:13:42 +1000
committerAndrew Bartlett <abartlet@samba.org>2013-05-09 06:18:20 +0200
commita65568750be92439de26dd2ecb88c09468264fe7 (patch)
treeb1b5c8fbc8b69d32c72d51603489a6bda477efce /source3/modules/vfs_aixacl2.c
parent67bb7d93ba8fccd030bd8d01536f3222c85134b7 (diff)
downloadsamba-a65568750be92439de26dd2ecb88c09468264fe7.tar.gz
samba-a65568750be92439de26dd2ecb88c09468264fe7.tar.bz2
samba-a65568750be92439de26dd2ecb88c09468264fe7.zip
vfs: Allocate SMB4ACL_T on an explict memory context
This ensures the caller knows exactly what the memory lifetime of this returned object is. This makes the NFSv4 ACL code consistent with the POSIX and NT ACL code, to avoid supprising developers who have worked on those other parts of the ACL code. Most of this patch is adding a memory context to the callers and passing it in. Andrew Bartlett Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules/vfs_aixacl2.c')
-rw-r--r--source3/modules/vfs_aixacl2.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index aca7a652d6..c97cd577f2 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -93,7 +93,7 @@ static AIXJFS2_ACL_T *aixjfs2_getacl_alloc(const char *fname, acl_type_t *type)
return acl;
}
-static bool aixjfs2_get_nfs4_acl(const char *name,
+static bool aixjfs2_get_nfs4_acl(TALLOC_CTX *mem_ctx, const char *name
SMB4ACL_T **ppacl, bool *pretryPosix)
{
int32_t i;
@@ -121,7 +121,7 @@ static bool aixjfs2_get_nfs4_acl(const char *name,
DEBUG(10, ("len: %d, version: %d, nace: %d, type: 0x%x\n",
jfs2_acl->aclLength, jfs2_acl->aclVersion, jfs2_acl->aclEntryN, type.u64));
- *ppacl = smb_create_smb4acl();
+ *ppacl = smb_create_smb4acl(mem_ctx);
if (*ppacl==NULL)
return False;
@@ -158,15 +158,18 @@ static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc)
{
+ NTSTATUS status;
SMB4ACL_T *pacl = NULL;
bool result;
bool retryPosix = False;
+ TALLOC_CTX *frame = talloc_stackframe();
*ppdesc = NULL;
- result = aixjfs2_get_nfs4_acl(fsp->fsp_name->base_name, &pacl,
+ result = aixjfs2_get_nfs4_acl(frame, fsp->fsp_name->base_name, &pacl,
&retryPosix);
if (retryPosix)
{
+ TALLOC_FREE(frame);
DEBUG(10, ("retrying with posix acl...\n"));
return posix_fget_nt_acl(fsp, security_info,
mem_ctx, ppdesc);
@@ -174,8 +177,10 @@ static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
if (result==False)
return NT_STATUS_ACCESS_DENIED;
- return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc,
- mem_ctx, pacl);
+ status = smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc,
+ mem_ctx, pacl);
+ TALLOC_FREE(frame);
+ return status;
}
static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,