diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-10-10 10:18:32 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-10-11 12:25:11 +1100 |
commit | 9158974540d0e311021f04789ed75ebda466c5b3 (patch) | |
tree | 5cdc75d2c7527e94df2bb9292d276cbf8e36499a /source3/modules/vfs_fake_acls.c | |
parent | a4d1f2223abdb0db2a15742ebd59a611cc157443 (diff) | |
download | samba-9158974540d0e311021f04789ed75ebda466c5b3.tar.gz samba-9158974540d0e311021f04789ed75ebda466c5b3.tar.bz2 samba-9158974540d0e311021f04789ed75ebda466c5b3.zip |
smbd: Add mem_ctx to sys_acl_init() and all callers
This changes from allocation on NULL to allocation on the supplied
memory context.
Currently that supplied context is talloc_tos() at the the final consumer of
the ACL.
Andrew Bartlett
Diffstat (limited to 'source3/modules/vfs_fake_acls.c')
-rw-r--r-- | source3/modules/vfs_fake_acls.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c index 6390b67395..a6e01b061e 100644 --- a/source3/modules/vfs_fake_acls.c +++ b/source3/modules/vfs_fake_acls.c @@ -189,11 +189,10 @@ static int fake_acls_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STR return ret; } -static SMB_ACL_T fake_acls_blob2acl(DATA_BLOB *blob) +static SMB_ACL_T fake_acls_blob2acl(DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { enum ndr_err_code ndr_err; - /* For now, ACLs are allocated on NULL */ - struct smb_acl_t *acl = talloc(NULL, struct smb_acl_t); + struct smb_acl_t *acl = talloc(mem_ctx, struct smb_acl_t); if (!acl) { errno = ENOMEM; return NULL; @@ -226,7 +225,10 @@ static DATA_BLOB fake_acls_acl2blob(TALLOC_CTX *mem_ctx, SMB_ACL_T acl) return blob; } -static SMB_ACL_T fake_acls_sys_acl_get_file(struct vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type) +static SMB_ACL_T fake_acls_sys_acl_get_file(struct vfs_handle_struct *handle, + const char *path, + SMB_ACL_TYPE_T type, + TALLOC_CTX *mem_ctx) { DATA_BLOB blob = data_blob_null; ssize_t length; @@ -258,13 +260,15 @@ static SMB_ACL_T fake_acls_sys_acl_get_file(struct vfs_handle_struct *handle, co return NULL; } if (length != -1) { - acl = fake_acls_blob2acl(&blob); + acl = fake_acls_blob2acl(&blob, mem_ctx); } TALLOC_FREE(frame); return acl; } -static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle, files_struct *fsp) +static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle, + files_struct *fsp, + TALLOC_CTX *mem_ctx) { DATA_BLOB blob = data_blob_null; ssize_t length; @@ -288,7 +292,7 @@ static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle, file return NULL; } if (length != -1) { - acl = fake_acls_blob2acl(&blob); + acl = fake_acls_blob2acl(&blob, mem_ctx); } TALLOC_FREE(frame); return acl; |