The branch, master has been updated
       via  7e49fd9... s4:dsdb: cached results of samdb_rodc()
      from  b81887f... tdb: commit ABI/tdb-1.2.2.sigs

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7e49fd92ca8dca87cc13fade08c1aa5d95df55a6
Author: Stefan Metzmacher <[email protected]>
Date:   Tue May 11 10:34:19 2010 +0200

    s4:dsdb: cached results of samdb_rodc()
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/common/util.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 5deb1d0..b9bff91 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2705,11 +2705,39 @@ int samdb_is_rodc(struct ldb_context *sam_ctx, const 
struct GUID *objectGUID, bo
 int samdb_rodc(struct ldb_context *sam_ctx, bool *am_rodc)
 {
        const struct GUID *objectGUID;
+       int ret;
+       bool *cached;
+
+       /* see if we have a cached copy */
+       cached = (bool *)ldb_get_opaque(sam_ctx, "cache.am_rodc");
+       if (cached) {
+               *am_rodc = *cached;
+               return LDB_SUCCESS;
+       }
+
        objectGUID = samdb_ntds_objectGUID(sam_ctx);
        if (!objectGUID) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       return samdb_is_rodc(sam_ctx, objectGUID, am_rodc);
+
+       ret = samdb_is_rodc(sam_ctx, objectGUID, am_rodc);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+
+       cached = talloc(sam_ctx, bool);
+       if (cached == NULL) {
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
+       *cached = *am_rodc;
+
+       ret = ldb_set_opaque(sam_ctx, "cache.am_rodc", cached);
+       if (ret != LDB_SUCCESS) {
+               talloc_free(cached);
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
+
+       return LDB_SUCCESS;
 }
 
 


-- 
Samba Shared Repository

Reply via email to