summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-14 19:44:18 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-14 15:37:22 +0200
commitd582e1bef6783a788378e32c64199a639d51b4e1 (patch)
treeaf984064d30398996f24667946149351048697bf /source4
parent773d0367a6d1bc4cbc3147420ddc0e94ee7cdc2c (diff)
downloadsamba-d582e1bef6783a788378e32c64199a639d51b4e1.tar.gz
samba-d582e1bef6783a788378e32c64199a639d51b4e1.tar.bz2
samba-d582e1bef6783a788378e32c64199a639d51b4e1.zip
s4-dsdb: Add samdb_dn_is_our_ntdsa()
This is like samdb_reference_dn_is_our_ntdsa but without the attribute de-reference. Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/common/util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index b5db1d145a..fd8ba62aab 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1613,6 +1613,31 @@ int samdb_reference_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ldb_
}
/*
+ find if a DN (must have GUID component!) is our ntdsDsa
+ */
+int samdb_dn_is_our_ntdsa(struct ldb_context *ldb, struct ldb_dn *dn, bool *is_ntdsa)
+{
+ NTSTATUS status;
+ TALLOC_CTX *tmp_ctx = talloc_new(ldb);
+ struct GUID dn_guid;
+ const struct GUID *our_ntds_guid;
+ status = dsdb_get_extended_dn_guid(dn, &dn_guid, "GUID");
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ our_ntds_guid = samdb_ntds_objectGUID(ldb);
+ if (!our_ntds_guid) {
+ DEBUG(0, ("Failed to find our NTDS Settings GUID for comparison with %s - %s\n", ldb_dn_get_linearized(dn), ldb_errstring(ldb)));
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ *is_ntdsa = GUID_equal(&dn_guid, our_ntds_guid);
+ return LDB_SUCCESS;
+}
+
+/*
find a 'reference' DN that points at another object and indicate if it is our ntdsDsa
*/
int samdb_reference_dn_is_our_ntdsa(struct ldb_context *ldb, struct ldb_dn *base,