summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-09-28 14:36:00 +1000
committerAndrew Tridgell <tridge@samba.org>2011-10-04 15:08:57 +1100
commit278e44cf9f6e0ba0c4f45dd6e7127ab7936f3ed7 (patch)
treea048c25a88fadedf230e1c9e9daf0fea134ca2ca /source4/dsdb/common
parentf469369fdf71b52930fdcc1f68632a727db38fc1 (diff)
downloadsamba-278e44cf9f6e0ba0c4f45dd6e7127ab7936f3ed7.tar.gz
samba-278e44cf9f6e0ba0c4f45dd6e7127ab7936f3ed7.tar.bz2
samba-278e44cf9f6e0ba0c4f45dd6e7127ab7936f3ed7.zip
s4-dsdb: simplify samdb_is_gc()
we already have a function for returning the NTDS options
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 3a55a55306..106e261db9 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1860,37 +1860,11 @@ failed:
*/
bool samdb_is_gc(struct ldb_context *ldb)
{
- const char *attrs[] = { "options", NULL };
uint32_t options;
- int ret;
- struct ldb_result *res;
- TALLOC_CTX *tmp_ctx;
-
- tmp_ctx = talloc_new(ldb);
- if (tmp_ctx == NULL) {
- DEBUG(1, ("talloc_new failed in samdb_is_pdc"));
- return false;
- }
-
- /* Query cn=ntds settings,.... */
- ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb), LDB_SCOPE_BASE, attrs, NULL);
- if (ret != LDB_SUCCESS) {
- talloc_free(tmp_ctx);
- return false;
- }
- if (res->count != 1) {
- talloc_free(tmp_ctx);
+ if (samdb_ntds_options(ldb, &options) != LDB_SUCCESS) {
return false;
}
-
- options = ldb_msg_find_attr_as_uint(res->msgs[0], "options", 0);
- talloc_free(tmp_ctx);
-
- /* if options attribute has the 0x00000001 flag set, then enable the global catlog */
- if (options & DS_NTDSDSA_OPT_IS_GC) {
- return true;
- }
- return false;
+ return (options & DS_NTDSDSA_OPT_IS_GC) != 0;
}
/* Find a domain object in the parents of a particular DN. */