diff options
author | Jeremy Allison <jra@samba.org> | 2001-02-28 00:51:02 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-02-28 00:51:02 +0000 |
commit | 0f2799aaf1e33aa474a12b9389728d57af926cb3 (patch) | |
tree | e2cf9efcc996a3b8f08184e204e8af0810e7b8c9 /source3/lib | |
parent | 545649a05f4d634bb93471bd946a92b1c5644684 (diff) | |
download | samba-0f2799aaf1e33aa474a12b9389728d57af926cb3.tar.gz samba-0f2799aaf1e33aa474a12b9389728d57af926cb3.tar.bz2 samba-0f2799aaf1e33aa474a12b9389728d57af926cb3.zip |
Move to talloc control of SPOOL_XXX structs. Move to talloc control of
security descriptors and pointers. Syncup with 2.2 tree.
Jeremy.
(This used to be commit 14d5997dc841e78a619e865288486d50c245896d)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/talloc.c | 13 | ||||
-rw-r--r-- | source3/lib/util_seaccess.c | 15 |
2 files changed, 18 insertions, 10 deletions
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c index 854a230a0e..54a3d8ed76 100644 --- a/source3/lib/talloc.c +++ b/source3/lib/talloc.c @@ -139,3 +139,16 @@ void *talloc_zero(TALLOC_CTX *t, size_t size) return p; } + +/* memdup with a talloc. */ +void *talloc_memdup(TALLOC_CTX *t, void *p, size_t size) +{ + void *newp = talloc(t,size); + + if (!newp) + return 0; + + memcpy(newp, p, size); + + return newp; +} diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c index 6cfcd065aa..e1b18460e2 100644 --- a/source3/lib/util_seaccess.c +++ b/source3/lib/util_seaccess.c @@ -305,7 +305,7 @@ BOOL se_access_check(SEC_DESC *sd, struct current_user *user, the parent container. This child object can either be a container or non-container object. */ -SEC_DESC_BUF *se_create_child_secdesc(SEC_DESC *parent_ctr, +SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, BOOL child_container) { SEC_DESC_BUF *sdb; @@ -321,7 +321,7 @@ SEC_DESC_BUF *se_create_child_secdesc(SEC_DESC *parent_ctr, acl = parent_ctr->dacl; - if (!(new_ace_list = malloc(sizeof(SEC_ACE) * acl->num_aces))) + if (!(new_ace_list = talloc(ctx, sizeof(SEC_ACE) * acl->num_aces))) return NULL; for (i = 0; acl && i < acl->num_aces; i++) { @@ -398,24 +398,19 @@ SEC_DESC_BUF *se_create_child_secdesc(SEC_DESC *parent_ctr, /* Create child security descriptor to return */ - new_dacl = make_sec_acl(ACL_REVISION, new_ace_list_ndx, new_ace_list); - safe_free(new_ace_list); + new_dacl = make_sec_acl(ctx, ACL_REVISION, new_ace_list_ndx, new_ace_list); /* Use the existing user and group sids. I don't think this is correct. Perhaps the user and group should be passed in as parameters by the caller? */ - sd = make_sec_desc(SEC_DESC_REVISION, + sd = make_sec_desc(ctx, SEC_DESC_REVISION, parent_ctr->owner_sid, parent_ctr->grp_sid, parent_ctr->sacl, new_dacl, &size); - free_sec_acl(&new_dacl); - - sdb = make_sec_desc_buf(size, sd); - - free_sec_desc(&sd); + sdb = make_sec_desc_buf(ctx, size, sd); return sdb; } |