summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2011-02-14 11:34:32 +0200
committerKamen Mazdrashki <kamenim@samba.org>2011-02-14 12:32:22 +0100
commit73972072d7c02ea8eaadd99be4361d7ee0e04d4a (patch)
tree150bbfc325d604534336b330095f6889326485c4 /source4/dsdb/samdb/ldb_modules
parent6110887802e8912b2a1d17f0bde9d77c8f12ea87 (diff)
downloadsamba-73972072d7c02ea8eaadd99be4361d7ee0e04d4a.tar.gz
samba-73972072d7c02ea8eaadd99be4361d7ee0e04d4a.tar.bz2
samba-73972072d7c02ea8eaadd99be4361d7ee0e04d4a.zip
s4-ldb_modules/util: Implement dsdb_module_find_ntdsguid_for_computer()
as a counterpart for samdb_find_ntdsguid_for_computer() to be used in LDB modules
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index e3e908f033..37ab4707f3 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -607,6 +607,36 @@ int dsdb_check_optional_feature(struct ldb_module *module, struct ldb_dn *scope,
}
/*
+ find the NTDS GUID from a computers DN record
+ */
+int dsdb_module_find_ntdsguid_for_computer(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *computer_dn,
+ struct GUID *ntds_guid,
+ struct ldb_request *parent)
+{
+ int ret;
+ struct ldb_dn *dn;
+
+ *ntds_guid = GUID_zero();
+
+ ret = dsdb_module_reference_dn(module, mem_ctx, computer_dn,
+ "serverReferenceBL", &dn, parent);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ if (!ldb_dn_add_child_fmt(dn, "CN=NTDS Settings")) {
+ talloc_free(dn);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ ret = dsdb_module_guid_by_dn(module, dn, ntds_guid, parent);
+ talloc_free(dn);
+ return ret;
+}
+
+/*
find a 'reference' DN that points at another object
(eg. serverReference, rIDManagerReference etc)
*/