summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-10-10 10:18:32 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-10-11 12:25:11 +1100
commit9158974540d0e311021f04789ed75ebda466c5b3 (patch)
tree5cdc75d2c7527e94df2bb9292d276cbf8e36499a /source3/modules
parenta4d1f2223abdb0db2a15742ebd59a611cc157443 (diff)
downloadsamba-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')
-rw-r--r--source3/modules/vfs_aixacl2.c9
-rw-r--r--source3/modules/vfs_aixacl_util.c4
-rw-r--r--source3/modules/vfs_aixacl_util.h2
-rw-r--r--source3/modules/vfs_cap.c6
-rw-r--r--source3/modules/vfs_catia.c5
-rw-r--r--source3/modules/vfs_default.c13
-rw-r--r--source3/modules/vfs_fake_acls.c18
-rw-r--r--source3/modules/vfs_full_audit.c9
-rw-r--r--source3/modules/vfs_gpfs.c24
-rw-r--r--source3/modules/vfs_hpuxacl.c17
-rw-r--r--source3/modules/vfs_media_harmony.c9
-rw-r--r--source3/modules/vfs_posixacl.c15
-rw-r--r--source3/modules/vfs_posixacl.h6
-rw-r--r--source3/modules/vfs_solarisacl.c12
-rw-r--r--source3/modules/vfs_time_audit.c10
-rw-r--r--source3/modules/vfs_tru64acl.c18
16 files changed, 104 insertions, 73 deletions
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index dd705ea319..0d754d7b43 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -200,7 +200,7 @@ static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,
pacl);
}
-static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type)
+static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type, TALLOC_CTX *mem_ctx)
{
aixc_acl_t *pacl;
AIXJFS2_ACL_T *acl;
@@ -222,7 +222,7 @@ static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type)
DEBUG(10, ("len: %d, mode: %d\n",
pacl->acl_len, pacl->acl_mode));
- result = aixacl_to_smbacl(pacl);
+ result = aixacl_to_smbacl(pacl, mem_ctx);
if (result == NULL) {
goto done;
}
@@ -236,7 +236,8 @@ static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type)
SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
acl_type_t aixjfs2_type;
@@ -252,7 +253,7 @@ SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
smb_panic("exiting");
}
- return aixjfs2_get_posix_acl(path_p, aixjfs2_type);
+ return aixjfs2_get_posix_acl(path_p, aixjfs2_type, mem_ctx);
}
SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_aixacl_util.c b/source3/modules/vfs_aixacl_util.c
index 82e8bd1580..1194d27df2 100644
--- a/source3/modules/vfs_aixacl_util.c
+++ b/source3/modules/vfs_aixacl_util.c
@@ -22,12 +22,12 @@
#include "smbd/smbd.h"
#include "vfs_aixacl_util.h"
-SMB_ACL_T aixacl_to_smbacl(struct acl *file_acl)
+SMB_ACL_T aixacl_to_smbacl(struct acl *file_acl, TALLOC_CTX *mem_ctx)
{
struct acl_entry *acl_entry;
struct ace_id *idp;
- struct smb_acl_t *result = sys_acl_init();
+ struct smb_acl_t *result = sys_acl_init(mem_ctx);
struct smb_acl_entry *ace;
int i;
diff --git a/source3/modules/vfs_aixacl_util.h b/source3/modules/vfs_aixacl_util.h
index 2447252eba..e283a3d1d4 100644
--- a/source3/modules/vfs_aixacl_util.h
+++ b/source3/modules/vfs_aixacl_util.h
@@ -17,6 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-SMB_ACL_T aixacl_to_smbacl( struct acl *file_acl);
+SMB_ACL_T aixacl_to_smbacl( struct acl *file_acl, TALLOC_CTX *mem_ctx);
struct acl *aixacl_smb_to_aixacl(SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 2454e12b6f..f2f8d7174f 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -409,7 +409,9 @@ static int cap_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mod
return SMB_VFS_NEXT_CHMOD_ACL(handle, cappath, mode);
}
-static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type)
+static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle,
+ const char *path, SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
char *cappath = capencode(talloc_tos(), path);
@@ -417,7 +419,7 @@ static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, const char *pat
errno = ENOMEM;
return (SMB_ACL_T)NULL;
}
- return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath, type);
+ return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath, type, mem_ctx);
}
static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 821a755e06..a2bef44370 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -745,7 +745,8 @@ catia_chmod_acl(vfs_handle_struct *handle,
static SMB_ACL_T
catia_sys_acl_get_file(vfs_handle_struct *handle,
const char *path,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
char *mapped_name = NULL;
NTSTATUS status;
@@ -758,7 +759,7 @@ catia_sys_acl_get_file(vfs_handle_struct *handle,
return NULL;
}
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_name, type);
+ ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_name, type, mem_ctx);
TALLOC_FREE(mapped_name);
return ret;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 8392feb8c4..aa91a48a2e 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2111,14 +2111,19 @@ static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode
#endif
}
-static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
+static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle,
+ const char *path_p,
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
- return sys_acl_get_file(handle, path_p, type);
+ return sys_acl_get_file(handle, path_p, type, mem_ctx);
}
-static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
+static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle,
+ files_struct *fsp,
+ TALLOC_CTX *mem_ctx)
{
- return sys_acl_get_fd(handle, fsp);
+ return sys_acl_get_fd(handle, fsp, mem_ctx);
}
static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
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;
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 6050c55027..e56c4a82a0 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1803,11 +1803,12 @@ static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fs
static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
- result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
+ result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
"%s", path_p);
@@ -1816,11 +1817,11 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
}
static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp, TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
- result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
+ result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
"%s", fsp_str_do_log(fsp));
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 8959fe6056..412c48c440 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -549,12 +549,12 @@ static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp
return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
}
-static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl)
+static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl, TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
gpfs_aclCount_t i;
- result = sys_acl_init();
+ result = sys_acl_init(mem_ctx);
if (result == NULL) {
errno = ENOMEM;
return NULL;
@@ -614,7 +614,8 @@ static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl)
return result;
}
-static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type)
+static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type,
+ TALLOC_CTX *mem_ctx)
{
struct gpfs_acl *pacl;
SMB_ACL_T result = NULL;
@@ -641,7 +642,7 @@ static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type)
pacl->acl_len, pacl->acl_level, pacl->acl_version,
pacl->acl_nace));
- result = gpfs2smb_acl(pacl);
+ result = gpfs2smb_acl(pacl, mem_ctx);
if (result != NULL) {
errno = 0;
}
@@ -656,7 +657,8 @@ static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type)
static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
gpfs_aclType_t gpfs_type;
struct gpfs_config_data *config;
@@ -666,7 +668,8 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
return NULL);
if (!config->acl) {
- return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
+ return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p,
+ type, mem_ctx);
}
switch(type) {
@@ -681,11 +684,12 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
smb_panic("exiting");
}
- return gpfsacl_get_posix_acl(path_p, gpfs_type);
+ return gpfsacl_get_posix_acl(path_p, gpfs_type, mem_ctx);
}
static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp,
+ TALLOC_CTX *mem_ctx)
{
struct gpfs_config_data *config;
@@ -694,11 +698,11 @@ static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
return NULL);
if (!config->acl) {
- return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
+ return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
}
return gpfsacl_get_posix_acl(fsp->fsp_name->base_name,
- GPFS_ACL_TYPE_ACCESS);
+ GPFS_ACL_TYPE_ACCESS, mem_ctx);
}
static struct gpfs_acl *smb2gpfs_acl(const SMB_ACL_T pacl,
diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c
index 884cc5c6f6..6a0fb9b618 100644
--- a/source3/modules/vfs_hpuxacl.c
+++ b/source3/modules/vfs_hpuxacl.c
@@ -112,7 +112,7 @@ static bool smb_acl_to_hpux_acl(SMB_ACL_T smb_acl,
HPUX_ACL_T *solariacl, int *count,
SMB_ACL_TYPE_T type);
static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpuxacl, int count,
- SMB_ACL_TYPE_T type);
+ SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx);
static HPUX_ACL_TAG_T smb_tag_to_hpux_tag(SMB_ACL_TAG_T smb_tag);
static SMB_ACL_TAG_T hpux_tag_to_smb_tag(HPUX_ACL_TAG_T hpux_tag);
static bool hpux_add_to_acl(HPUX_ACL_T *hpux_acl, int *count,
@@ -140,7 +140,8 @@ static bool hpux_aclsort_call_present(void);
SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result = NULL;
int count;
@@ -168,7 +169,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
if (!hpux_acl_get_file(path_p, &hpux_acl, &count)) {
goto done;
}
- result = hpux_acl_to_smb_acl(hpux_acl, count, type);
+ result = hpux_acl_to_smb_acl(hpux_acl, count, type, mem_ctx);
if (result == NULL) {
DEBUG(10, ("conversion hpux_acl -> smb_acl failed (%s).\n",
strerror(errno)));
@@ -186,7 +187,8 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
* get the access ACL of a file referred to by a fd
*/
SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp,
+ TALLOC_CTX *mem_ctx)
{
/*
* HPUX doesn't have the facl call. Fake it using the path.... JRA.
@@ -200,7 +202,8 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
return hpuxacl_sys_acl_get_file(handle,
fsp->fsp_name->base_name,
- SMB_ACL_TYPE_ACCESS);
+ SMB_ACL_TYPE_ACCESS,
+ mem_ctx);
}
@@ -490,12 +493,12 @@ static bool smb_acl_to_hpux_acl(SMB_ACL_T smb_acl,
* soaris acl to the SMB_ACL format.
*/
static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpux_acl, int count,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
int i;
- if ((result = sys_acl_init()) == NULL) {
+ if ((result = sys_acl_init(mem_ctx)) == NULL) {
DEBUG(10, ("error allocating memory for SMB_ACL\n"));
goto fail;
}
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 647db7c161..a10eb5e5d3 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -2085,8 +2085,9 @@ out:
* Failure: set errno, return NULL
*/
static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
- const char *path_p,
- SMB_ACL_TYPE_T type)
+ const char *path_p,
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
SMB_ACL_T ret;
char *clientPath;
@@ -2095,7 +2096,7 @@ static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_get_file\n"));
if (!is_in_media_files(path_p))
{
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
+ ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
goto out;
}
@@ -2110,7 +2111,7 @@ static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
goto err;
}
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientPath, type);
+ ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientPath, type, mem_ctx);
err:
TALLOC_FREE(clientPath);
out:
diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c
index 50487ff4de..1714b137d6 100644
--- a/source3/modules/vfs_posixacl.c
+++ b/source3/modules/vfs_posixacl.c
@@ -26,7 +26,7 @@
static bool smb_ace_to_internal(acl_entry_t posix_ace,
struct smb_acl_entry *ace);
-static struct smb_acl_t *smb_acl_to_internal(acl_t acl);
+static struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx);
static int smb_acl_set_mode(acl_entry_t entry, SMB_ACL_PERM_T perm);
static acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
@@ -35,7 +35,8 @@ static acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
acl_type_t acl_type;
@@ -59,13 +60,13 @@ SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
return NULL;
}
- result = smb_acl_to_internal(acl);
+ result = smb_acl_to_internal(acl, mem_ctx);
acl_free(acl);
return result;
}
SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp, TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
acl_t acl = acl_get_fd(fsp->fh->fd);
@@ -74,7 +75,7 @@ SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
return NULL;
}
- result = smb_acl_to_internal(acl);
+ result = smb_acl_to_internal(acl, mem_ctx);
acl_free(acl);
return result;
}
@@ -212,9 +213,9 @@ static bool smb_ace_to_internal(acl_entry_t posix_ace,
return True;
}
-static struct smb_acl_t *smb_acl_to_internal(acl_t acl)
+static struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx)
{
- struct smb_acl_t *result = sys_acl_init();
+ struct smb_acl_t *result = sys_acl_init(mem_ctx);
int entry_id = ACL_FIRST_ENTRY;
acl_entry_t e;
if (result == NULL) {
diff --git a/source3/modules/vfs_posixacl.h b/source3/modules/vfs_posixacl.h
index 9ef3f86620..b0fe841e1b 100644
--- a/source3/modules/vfs_posixacl.h
+++ b/source3/modules/vfs_posixacl.h
@@ -23,10 +23,12 @@
SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type);
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx);
SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp);
+ files_struct *fsp,
+ TALLOC_CTX *mem_ctx);
int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
const char *name,
diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c
index 10b6f707d7..ad25e88f62 100644
--- a/source3/modules/vfs_solarisacl.c
+++ b/source3/modules/vfs_solarisacl.c
@@ -45,7 +45,7 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
SOLARIS_ACL_T *solariacl, int *count,
SMB_ACL_TYPE_T type);
static SMB_ACL_T solaris_acl_to_smb_acl(SOLARIS_ACL_T solarisacl, int count,
- SMB_ACL_TYPE_T type);
+ SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx);
static SOLARIS_ACL_TAG_T smb_tag_to_solaris_tag(SMB_ACL_TAG_T smb_tag);
static SMB_ACL_TAG_T solaris_tag_to_smb_tag(SOLARIS_ACL_TAG_T solaris_tag);
static bool solaris_add_to_acl(SOLARIS_ACL_T *solaris_acl, int *count,
@@ -64,7 +64,7 @@ static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count);
SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result = NULL;
int count;
@@ -85,7 +85,7 @@ SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
if (!solaris_acl_get_file(path_p, &solaris_acl, &count)) {
goto done;
}
- result = solaris_acl_to_smb_acl(solaris_acl, count, type);
+ result = solaris_acl_to_smb_acl(solaris_acl, count, type, mem_ctx);
if (result == NULL) {
DEBUG(10, ("conversion solaris_acl -> smb_acl failed (%s).\n",
strerror(errno)));
@@ -103,7 +103,7 @@ SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
* get the access ACL of a file referred to by a fd
*/
SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp, TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result = NULL;
int count;
@@ -424,12 +424,12 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
* soaris acl to the SMB_ACL format.
*/
static SMB_ACL_T solaris_acl_to_smb_acl(SOLARIS_ACL_T solaris_acl, int count,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
int i;
- if ((result = sys_acl_init()) == NULL) {
+ if ((result = sys_acl_init(mem_ctx)) == NULL) {
DEBUG(10, ("error allocating memory for SMB_ACL\n"));
goto fail;
}
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 7571b2f340..b7d399b263 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1772,14 +1772,15 @@ static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
+ result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
@@ -1791,14 +1792,15 @@ static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
}
static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp,
+ TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
+ result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
diff --git a/source3/modules/vfs_tru64acl.c b/source3/modules/vfs_tru64acl.c
index 918f7c6d00..6eadee613c 100644
--- a/source3/modules/vfs_tru64acl.c
+++ b/source3/modules/vfs_tru64acl.c
@@ -24,7 +24,8 @@
/* prototypes for private functions first - for clarity */
-static struct smb_acl_t *tru64_acl_to_smb_acl(const struct acl *tru64_acl);
+static struct smb_acl_t *tru64_acl_to_smb_acl(const struct acl *tru64_acl,
+ TALLOC_CTX *mem_ctx);
static bool tru64_ace_to_smb_ace(acl_entry_t tru64_ace,
struct smb_acl_entry *smb_ace);
static acl_t smb_acl_to_tru64_acl(const SMB_ACL_T smb_acl);
@@ -38,7 +39,8 @@ static SMB_ACL_PERM_T tru64_permset_to_smb(const acl_perm_t tru64_permset);
SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
const char *path_p,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
acl_type_t the_acl_type;
@@ -64,13 +66,14 @@ SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
return NULL;
}
- result = tru64_acl_to_smb_acl(tru64_acl);
+ result = tru64_acl_to_smb_acl(tru64_acl, mem_ctx);
acl_free(tru64_acl);
return result;
}
SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp)
+ files_struct *fsp,
+ TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
acl_t tru64_acl = acl_get_fd(fsp->fh->fd, ACL_TYPE_ACCESS);
@@ -79,7 +82,7 @@ SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
return NULL;
}
- result = tru64_acl_to_smb_acl(tru64_acl);
+ result = tru64_acl_to_smb_acl(tru64_acl, mem_ctx);
acl_free(tru64_acl);
return result;
}
@@ -153,14 +156,15 @@ int tru64acl_sys_acl_delete_def_file(vfs_handle_struct *handle,
/* private functions */
-static struct smb_acl_t *tru64_acl_to_smb_acl(const struct acl *tru64_acl)
+static struct smb_acl_t *tru64_acl_to_smb_acl(const struct acl *tru64_acl,
+ TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
acl_entry_t entry;
DEBUG(10, ("Hi! This is tru64_acl_to_smb_acl.\n"));
- if ((result = sys_acl_init()) == NULL) {
+ if ((result = sys_acl_init(mem_ctx)) == NULL) {
DEBUG(0, ("sys_acl_init() failed in tru64_acl_to_smb_acl\n"));
errno = ENOMEM;
goto fail;