s4-dsdb: added samdb_rid_set_dn()
authorAndrew Tridgell <tridge@samba.org>
Tue, 5 Jan 2010 06:07:51 +0000 (17:07 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 8 Jan 2010 02:02:58 +0000 (13:02 +1100)
This returns the DN of our RID Set object

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/common/util.c

index 2548b0b15593cfab4c9258056971dbec23352edb..2b8a68e58f70448bb3e299977282108aae814a57 100644 (file)
@@ -1583,6 +1583,24 @@ int samdb_rid_manager_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ld
        return samdb_reference_dn(ldb, mem_ctx, samdb_base_dn(ldb), "rIDManagerReference", dn);
 }
 
+/*
+  find the RID Set DN via the rIDSetReferences attribute in our
+  machine account DN
+ */
+int samdb_rid_set_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ldb_dn **dn)
+{
+       struct ldb_dn *server_ref_dn;
+       int ret;
+
+       ret = samdb_server_reference_dn(ldb, mem_ctx, &server_ref_dn);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+       ret = samdb_reference_dn(ldb, mem_ctx, server_ref_dn, "rIDSetReferences", dn);
+       talloc_free(server_ref_dn);
+       return ret;
+}
+
 const char *samdb_server_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
 {
        const struct ldb_val *val = ldb_dn_get_rdn_val(samdb_server_site_dn(ldb, mem_ctx));