summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2010-05-13 15:07:50 +0300
committerAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2010-05-17 13:30:27 +0300
commit26d41c23f69b9e3ee327f159c9164917422d45c5 (patch)
treeb2279caf7ab80ded9f48443de0f7f1729401c007 /source4/dsdb/common
parenta15b6664389b05ea0cded46de3abe53034a7edef (diff)
downloadsamba-26d41c23f69b9e3ee327f159c9164917422d45c5.tar.gz
samba-26d41c23f69b9e3ee327f159c9164917422d45c5.tar.bz2
samba-26d41c23f69b9e3ee327f159c9164917422d45c5.zip
s4-rodc: Cache am_rodc flag
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 63870278ce..df4e734252 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2747,6 +2747,35 @@ int samdb_rodc(struct ldb_context *sam_ctx, bool *am_rodc)
return LDB_SUCCESS;
}
+bool samdb_set_am_rodc(struct ldb_context *ldb, bool am_rodc)
+{
+ TALLOC_CTX *tmp_ctx;
+ bool *cached;
+
+ tmp_ctx = talloc_new(ldb);
+ if (tmp_ctx == NULL) {
+ goto failed;
+ }
+
+ cached = talloc(tmp_ctx, bool);
+ if (!cached) {
+ goto failed;
+ }
+
+ *cached = am_rodc;
+ if (ldb_set_opaque(ldb, "cache.am_rodc", cached) != LDB_SUCCESS) {
+ goto failed;
+ }
+
+ talloc_steal(ldb, cached);
+ talloc_free(tmp_ctx);
+ return true;
+
+failed:
+ DEBUG(1,("Failed to set our own cached am_rodc in the ldb!\n"));
+ talloc_free(tmp_ctx);
+ return false;
+}
/*