summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@plainjoe.org>2009-08-03 16:18:10 -0500
committerVolker Lendecke <vl@samba.org>2009-08-04 19:17:00 +0200
commit25a65d604676b25f97ca427b805d151c1a40a07e (patch)
tree53b8c0bfdec63755bb1918c70d8922399c0f6ace /source3
parent38ff5906b3073276cfe4a7d6d4fbf83a2a2e5fb8 (diff)
downloadsamba-25a65d604676b25f97ca427b805d151c1a40a07e.tar.gz
samba-25a65d604676b25f97ca427b805d151c1a40a07e.tar.bz2
samba-25a65d604676b25f97ca427b805d151c1a40a07e.zip
idmap_adex: Fix usage of talloc_stackframe().
Pass an explicit TALLOC_CTX* to build_id_filter() and build_alias_filter() rather than relying upon the talloc_stackframe() behavior that allows a caller access to stackframe ctx for called functions.
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/idmap_adex/provider_unified.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/source3/winbindd/idmap_adex/provider_unified.c b/source3/winbindd/idmap_adex/provider_unified.c
index d48989f45f..b6652f4e49 100644
--- a/source3/winbindd/idmap_adex/provider_unified.c
+++ b/source3/winbindd/idmap_adex/provider_unified.c
@@ -47,7 +47,8 @@ struct lwcell_filter
/********************************************************************
*******************************************************************/
-static char* build_id_filter(uint32_t id,
+static char* build_id_filter(TALLOC_CTX *mem_ctx,
+ uint32_t id,
enum id_type type,
uint32_t search_flags)
{
@@ -99,19 +100,19 @@ static char* build_id_filter(uint32_t id,
/* Use "keywords=%s" for non-schema cells */
if (use2307) {
- filter = talloc_asprintf(frame, "(&(%s)(%s))",
- oc_filter, attr_filter);
+ filter = talloc_asprintf(mem_ctx,
+ "(&(%s)(%s))",
+ oc_filter,
+ attr_filter);
} else {
- filter = talloc_asprintf(frame, "(&(keywords=%s)(keywords=%s))",
- oc_filter, attr_filter);
+ filter = talloc_asprintf(mem_ctx,
+ "(&(keywords=%s)(keywords=%s))",
+ oc_filter,
+ attr_filter);
}
- talloc_destroy(oc_filter);
- talloc_destroy(attr_filter);
-
done:
- /* Don't destroy the stackframe CTX since we are returning
- memory from it */
+ talloc_destroy(frame);
return filter;
}
@@ -119,7 +120,9 @@ done:
/********************************************************************
*******************************************************************/
-static char* build_alias_filter(const char *alias, uint32_t search_flags)
+static char* build_alias_filter(TALLOC_CTX *mem_ctx,
+ const char *alias,
+ uint32_t search_flags)
{
char *filter = NULL;
char *user_attr_filter, *group_attr_filter;
@@ -142,25 +145,21 @@ static char* build_alias_filter(const char *alias, uint32_t search_flags)
/* Use "keywords=%s" for non-schema cells */
if (use2307) {
- filter = talloc_asprintf(frame,
+ filter = talloc_asprintf(mem_ctx,
"(|(&(%s)(objectclass=%s))(&(%s)(objectclass=%s)))",
user_attr_filter,
search_forest ? AD_USER : ADEX_OC_POSIX_USER,
group_attr_filter,
search_forest ? AD_GROUP : ADEX_OC_POSIX_GROUP);
} else {
- filter = talloc_asprintf(frame,
+ filter = talloc_asprintf(mem_ctx,
"(|(keywords=%s)(keywords=%s))",
user_attr_filter,
group_attr_filter);
}
- talloc_destroy(user_attr_filter);
- talloc_destroy(group_attr_filter);
-
done:
- /* Don't destroy the stackframe CTX since we are returning
- memory from it */
+ talloc_destroy(frame);
return filter;
}
@@ -193,12 +192,14 @@ static NTSTATUS search_cell(struct likewise_cell *c,
sid_str);
break;
case IdFilter:
- filter = build_id_filter(fdata->filter.id.id,
+ filter = build_id_filter(frame,
+ fdata->filter.id.id,
fdata->filter.id.type,
cell_flags(c));
break;
case AliasFilter:
- filter = build_alias_filter(fdata->filter.alias,
+ filter = build_alias_filter(frame,
+ fdata->filter.alias,
cell_flags(c));
break;
default:
@@ -490,11 +491,14 @@ static NTSTATUS search_forest(struct likewise_cell *forest_cell,
TALLOC_FREE(sid_binstr);
break;
case IdFilter:
- filter = build_id_filter(fdata->filter.id.id,
+ filter = build_id_filter(frame,
+ fdata->filter.id.id,
fdata->filter.id.type, flags);
break;
case AliasFilter:
- filter = build_alias_filter(fdata->filter.alias, flags);
+ filter = build_alias_filter(frame,
+ fdata->filter.alias,
+ flags);
break;
}