summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorFernando J V da Silva <fernandojvsilva@yahoo.com.br>2010-01-07 16:30:05 -0200
committerAndrew Tridgell <tridge@samba.org>2010-01-14 15:37:58 +1100
commite30d009965a789e8a4495609f8d19adb621df6f4 (patch)
tree12ed0c7fe56d36c647833d6b478de8a5afe6c8d3 /source4/dsdb/common
parentac224452b94865db346ed68dc517f84d40e6303c (diff)
downloadsamba-e30d009965a789e8a4495609f8d19adb621df6f4.tar.gz
samba-e30d009965a789e8a4495609f8d19adb621df6f4.tar.bz2
samba-e30d009965a789e8a4495609f8d19adb621df6f4.zip
s4-drs: Store uSNUrgent for Urgent Replication
When a object or attribute is created/updated/deleted, according to [MS-ADTS] 3.1.1.5.1.6, it stores the uSNUrgent on @REPLCHANGED for the partitions that it belongs. Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 652f1345d5..5dcbbd8d03 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2655,10 +2655,11 @@ failed:
/*
- load the uSNHighest attribute from the @REPLCHANGED object for a
- partition
+ load the uSNHighest and the uSNUrgent attributes from the @REPLCHANGED
+ object for a partition
*/
-int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, uint64_t *uSN)
+int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn,
+ uint64_t *uSN, uint64_t *urgent_uSN)
{
struct ldb_request *req;
int ret;
@@ -2723,8 +2724,14 @@ int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, uint64_t
if (res->count < 1) {
*uSN = 0;
+ if (urgent_uSN) {
+ *urgent_uSN = 0;
+ }
} else {
*uSN = ldb_msg_find_attr_as_uint64(res->msgs[0], "uSNHighest", 0);
+ if (urgent_uSN) {
+ *urgent_uSN = ldb_msg_find_attr_as_uint64(res->msgs[0], "uSNUrgent", 0);
+ }
}
talloc_free(tmp_ctx);
@@ -2733,10 +2740,11 @@ int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, uint64_t
}
/*
- save the uSNHighest attribute in the @REPLCHANGED object for a
+ save uSNHighest and uSNUrgent attributes in the @REPLCHANGED object for a
partition
*/
-int dsdb_save_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, uint64_t uSN)
+int dsdb_save_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn,
+ uint64_t uSN, uint64_t urgent_uSN)
{
struct ldb_request *req;
struct ldb_message *msg;
@@ -2761,6 +2769,16 @@ int dsdb_save_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, uint64_t
}
msg->elements[0].flags = LDB_FLAG_MOD_REPLACE;
+ /* urgent_uSN is optional so may not be stored */
+ if (urgent_uSN) {
+ ret = ldb_msg_add_fmt(msg, "uSNUrgent", "%llu", (unsigned long long)urgent_uSN);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(msg);
+ return ret;
+ }
+ msg->elements[1].flags = LDB_FLAG_MOD_REPLACE;
+ }
+
p_ctrl = talloc(msg, struct dsdb_control_current_partition);
if (p_ctrl == NULL) {