summaryrefslogtreecommitdiff
path: root/source3/smbd/pysmbd.c
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/smbd/pysmbd.c
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/smbd/pysmbd.c')
-rw-r--r--source3/smbd/pysmbd.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index 4012e6e3c7..66aba21fa8 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -154,98 +154,99 @@ static NTSTATUS set_nt_acl_no_snum(const char *fname,
static SMB_ACL_T make_simple_acl(gid_t gid, mode_t chmod_mode)
{
+ TALLOC_CTX *frame = talloc_stackframe();
+
mode_t mode = SMB_ACL_READ|SMB_ACL_WRITE;
mode_t mode_user = (chmod_mode & 0700) >> 16;
mode_t mode_group = (chmod_mode & 070) >> 8;
mode_t mode_other = chmod_mode & 07;
-
SMB_ACL_ENTRY_T entry;
- SMB_ACL_T acl = sys_acl_init();
+ SMB_ACL_T acl = sys_acl_init(frame);
if (!acl) {
return NULL;
}
if (sys_acl_create_entry(&acl, &entry) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_tag_type(entry, SMB_ACL_USER_OBJ) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_permset(entry, &mode_user) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_create_entry(&acl, &entry) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_tag_type(entry, SMB_ACL_GROUP_OBJ) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_permset(entry, &mode_group) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_create_entry(&acl, &entry) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_tag_type(entry, SMB_ACL_OTHER) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_permset(entry, &mode_other) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (gid != -1) {
if (sys_acl_create_entry(&acl, &entry) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_tag_type(entry, SMB_ACL_GROUP) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_qualifier(entry, &gid) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_permset(entry, &mode_group) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
}
if (sys_acl_create_entry(&acl, &entry) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_tag_type(entry, SMB_ACL_MASK) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
if (sys_acl_set_permset(entry, &mode) != 0) {
- TALLOC_FREE(acl);
+ TALLOC_FREE(frame);
return NULL;
}
return acl;
@@ -455,7 +456,7 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args)
smbd_vfs_init(conn);
- acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, acl_type);
+ acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, acl_type, frame);
if (!acl) {
TALLOC_FREE(frame);
status = map_nt_error_from_unix_common(errno);
@@ -463,7 +464,6 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args)
PyErr_NTSTATUS_IS_ERR_RAISE(status);
}
- talloc_steal(frame, acl);
conn_free(conn);
py_acl = py_return_ndr_struct("samba.dcerpc.smb_acl", "t", acl, acl);