summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-05-07 14:20:15 +0200
committerVolker Lendecke <vl@samba.org>2008-05-07 14:47:29 +0200
commit193b63f326d31907bdc4486fadec4a7f4dcb0bac (patch)
tree3dea08906823e94fd348c2065d3cf19f2a68f36c
parentae80b0055cc1533637d5a66881e3a1fbf6849458 (diff)
downloadsamba-193b63f326d31907bdc4486fadec4a7f4dcb0bac.tar.gz
samba-193b63f326d31907bdc4486fadec4a7f4dcb0bac.tar.bz2
samba-193b63f326d31907bdc4486fadec4a7f4dcb0bac.zip
Use talloc_stackframe() in find_forced_group
(This used to be commit 27a9bbc645416265eebdfc866925855021bd407c)
-rw-r--r--source3/smbd/service.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index ff69fc4029..d57156762f 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -561,7 +561,7 @@ static NTSTATUS find_forced_group(bool force_user,
gid_t *pgid)
{
NTSTATUS result = NT_STATUS_NO_SUCH_GROUP;
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *frame = talloc_stackframe();
DOM_SID group_sid;
enum lsa_SidType type;
char *groupname;
@@ -571,13 +571,7 @@ static NTSTATUS find_forced_group(bool force_user,
ZERO_STRUCTP(pgroup_sid);
*pgid = (gid_t)-1;
- mem_ctx = talloc_new(NULL);
- if (mem_ctx == NULL) {
- DEBUG(0, ("talloc_new failed\n"));
- return NT_STATUS_NO_MEMORY;
- }
-
- groupname = talloc_strdup(mem_ctx, lp_force_group(snum));
+ groupname = talloc_strdup(talloc_tos(), lp_force_group(snum));
if (groupname == NULL) {
DEBUG(1, ("talloc_strdup failed\n"));
result = NT_STATUS_NO_MEMORY;
@@ -589,10 +583,10 @@ static NTSTATUS find_forced_group(bool force_user,
groupname += 1;
}
- groupname = talloc_string_sub(mem_ctx, groupname,
+ groupname = talloc_string_sub(talloc_tos(), groupname,
"%S", lp_servicename(snum));
- if (!lookup_name_smbconf(mem_ctx, groupname,
+ if (!lookup_name_smbconf(talloc_tos(), groupname,
LOOKUP_NAME_ALL|LOOKUP_NAME_GROUP,
NULL, NULL, &group_sid, &type)) {
DEBUG(10, ("lookup_name_smbconf(%s) failed\n",
@@ -641,7 +635,7 @@ static NTSTATUS find_forced_group(bool force_user,
result = NT_STATUS_OK;
done:
- TALLOC_FREE(mem_ctx);
+ TALLOC_FREE(frame);
return result;
}