From 4b970c00ae5a0b89dca4664725ab1fa1650490f0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 16 Dec 2009 11:31:30 +1100 Subject: s4-dsdb: fixed dsdb_module_dn_by_guid() needs to ask for the DN in storage format, plus fix compilation errors --- source4/dsdb/samdb/ldb_modules/util.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index 4c2e418858..1ef69895d4 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -22,6 +22,7 @@ #include "includes.h" #include "ldb.h" #include "ldb_module.h" +#include "librpc/ndr/libndr.h" #include "dsdb/samdb/ldb_modules/util.h" #include "dsdb/samdb/samdb.h" @@ -228,13 +229,16 @@ int dsdb_module_dn_by_guid(struct ldb_module *module, TALLOC_CTX *mem_ctx, } ret = dsdb_module_search(module, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, - attrs, DSDB_SEARCH_SHOW_DELETED | DSDB_SEARCH_SEARCH_ALL_PARTITIONS, + attrs, + DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SEARCH_ALL_PARTITIONS | + DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT, expression); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; } - if (ret->count == 0) { + if (res->count == 0) { talloc_free(tmp_ctx); return LDB_ERR_NO_SUCH_OBJECT; } @@ -245,7 +249,7 @@ int dsdb_module_dn_by_guid(struct ldb_module *module, TALLOC_CTX *mem_ctx, return LDB_ERR_OPERATIONS_ERROR; } - *dn = talloc_steal(mem_ctx, res->msgs[0].dn); + *dn = talloc_steal(mem_ctx, res->msgs[0]->dn); talloc_free(tmp_ctx); return LDB_SUCCESS; -- cgit