From 5be159f304411b58c417a979c819f9ab211a0337 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Jun 2005 07:52:00 +0000 Subject: r7804: added the samba specific ldif handlers into the tree, but don't enable them just yet. I have tested them, and they work fine, but enabling them will break code in rpc_server/ and samdb, so we need to fix that first (This used to be commit 07d459406b4c63e49141e0e533e1274b4052abf9) --- source4/lib/ldb/common/ldb_ldif.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c index 88ef9fae45..94109ce224 100644 --- a/source4/lib/ldb/common/ldb_ldif.c +++ b/source4/lib/ldb/common/ldb_ldif.c @@ -41,6 +41,30 @@ #include "ldb/include/ldb_private.h" #include + +/* + add to the list of ldif handlers for this ldb context +*/ +int ldb_ldif_add_handlers(struct ldb_context *ldb, + const struct ldb_ldif_handler *handlers, + unsigned num_handlers) +{ + struct ldb_ldif_handler *h; + h = talloc_realloc(ldb, ldb->ldif_handlers, + struct ldb_ldif_handler, + ldb->ldif_num_handlers + num_handlers); + if (h == NULL) { + ldb_oom(ldb); + return -1; + } + ldb->ldif_handlers = h; + memcpy(h + ldb->ldif_num_handlers, + handlers, sizeof(*h) * num_handlers); + ldb->ldif_num_handlers += num_handlers; + return 0; +} + + /* default function for ldif read/write */ @@ -59,7 +83,7 @@ static ldb_ldif_handler_t ldb_ldif_read_fn(struct ldb_context *ldb, const char * { int i; for (i=0;ildif_num_handlers;i++) { - if (strcmp(attr, ldb->ldif_handlers[i].attr) == 0) { + if (ldb_attr_cmp(attr, ldb->ldif_handlers[i].attr) == 0) { return ldb->ldif_handlers[i].read_fn; } } @@ -73,7 +97,7 @@ static ldb_ldif_handler_t ldb_ldif_write_fn(struct ldb_context *ldb, const char { int i; for (i=0;ildif_num_handlers;i++) { - if (strcmp(attr, ldb->ldif_handlers[i].attr) == 0) { + if (ldb_attr_cmp(attr, ldb->ldif_handlers[i].attr) == 0) { return ldb->ldif_handlers[i].write_fn; } } -- cgit