summaryrefslogtreecommitdiff
path: root/source4/rpc_server/samr
diff options
context:
space:
mode:
Diffstat (limited to 'source4/rpc_server/samr')
-rw-r--r--source4/rpc_server/samr/samdb.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c
index e6862eb8f9..872ec82894 100644
--- a/source4/rpc_server/samr/samdb.c
+++ b/source4/rpc_server/samr/samdb.c
@@ -89,14 +89,6 @@ void samdb_close(void *ctx)
}
/*
- a alloc function for ldb
-*/
-static void *samdb_alloc(void *context, void *ptr, size_t size)
-{
- return talloc_realloc((TALLOC_CTX *)context, ptr, size);
-}
-
-/*
search the sam for the specified attributes - va_list varient
*/
int samdb_search_v(void *ctx,
@@ -116,7 +108,7 @@ int samdb_search_v(void *ctx,
return -1;
}
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
count = ldb_search(sam_ctx->ldb, basedn, LDB_SCOPE_SUBTREE, expr, attrs, res);
@@ -155,7 +147,7 @@ int samdb_search_free(void *ctx,
TALLOC_CTX *mem_ctx, struct ldb_message **res)
{
struct samdb_context *sam_ctx = ctx;
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_search_free(sam_ctx->ldb, res);
}
@@ -772,7 +764,7 @@ int samdb_msg_add_string(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
if (s == NULL || a == NULL) {
return -1;
}
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_msg_add_string(sam_ctx->ldb, msg, a, s);
}
@@ -787,7 +779,7 @@ int samdb_msg_add_delete(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
if (a == NULL) {
return -1;
}
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
/* we use an empty replace rather than a delete, as it allows for
samdb_replace() to be used everywhere */
return ldb_msg_add_empty(sam_ctx->ldb, msg, a, LDB_FLAG_MOD_REPLACE);
@@ -837,7 +829,7 @@ int samdb_msg_add_hash(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
return -1;
}
memcpy(val.data, hash.hash, 16);
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val);
}
@@ -858,7 +850,7 @@ int samdb_msg_add_hashes(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
for (i=0;i<count;i++) {
memcpy(i*16 + (char *)val.data, hashes[i].hash, 16);
}
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val);
}
@@ -881,7 +873,7 @@ int samdb_msg_add_logon_hours(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message
struct ldb_val val;
val.length = hours.units_per_week / 8;
val.data = hours.bitmap;
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val);
}
@@ -894,7 +886,7 @@ int samdb_msg_set_string(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
struct samdb_context *sam_ctx = ctx;
struct ldb_message_element *el;
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
el = ldb_msg_find_element(msg, attr_name);
if (el) {
@@ -923,7 +915,7 @@ int samdb_add(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg)
{
struct samdb_context *sam_ctx = ctx;
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_add(sam_ctx->ldb, msg);
}
@@ -934,7 +926,7 @@ int samdb_delete(void *ctx, TALLOC_CTX *mem_ctx, const char *dn)
{
struct samdb_context *sam_ctx = ctx;
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_delete(sam_ctx->ldb, dn);
}
@@ -945,7 +937,7 @@ int samdb_modify(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg)
{
struct samdb_context *sam_ctx = ctx;
- ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
+ ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx);
return ldb_modify(sam_ctx->ldb, msg);
}