diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-04-06 16:10:34 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-04-06 18:37:03 +0200 |
commit | 4d5a2955a1724d6b5ef95289704686d730bc7071 (patch) | |
tree | 3ff61ec442e7e07d19485ea9431d322131dcb75e | |
parent | d622d21054e46dde53f751e43d8f3b481b4332b0 (diff) | |
download | samba-4d5a2955a1724d6b5ef95289704686d730bc7071.tar.gz samba-4d5a2955a1724d6b5ef95289704686d730bc7071.tar.bz2 samba-4d5a2955a1724d6b5ef95289704686d730bc7071.zip |
s4:dsdb/repl_meta_data: allow passing an explicit attribute list to replmd_update_rpmd()
This will be used for renames.
metze
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 0b915d897f..f5cdcf6361 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -1126,6 +1126,7 @@ static uint64_t find_max_local_usn(struct replPropertyMetaDataBlob omd) static int replmd_update_rpmd(struct ldb_module *module, const struct dsdb_schema *schema, struct ldb_request *req, + const char * const *rename_attrs, struct ldb_message *msg, uint64_t *seq_num, time_t t, bool *is_urgent) @@ -1137,14 +1138,21 @@ static int replmd_update_rpmd(struct ldb_module *module, NTTIME now; const struct GUID *our_invocation_id; int ret; - const char *attrs[] = { "replPropertyMetaData", "*", NULL }; - const char *attrs2[] = { "uSNChanged", "objectClass", NULL }; + const char * const *attrs = NULL; + const char * const attrs1[] = { "replPropertyMetaData", "*", NULL }; + const char * const attrs2[] = { "uSNChanged", "objectClass", NULL }; struct ldb_result *res; struct ldb_context *ldb; struct ldb_message_element *objectclass_el; enum urgent_situation situation; bool rodc, rmd_is_provided; + if (rename_attrs) { + attrs = rename_attrs; + } else { + attrs = attrs1; + } + ldb = ldb_module_get_ctx(module); our_invocation_id = samdb_ntds_invocation_id(ldb); @@ -1167,6 +1175,8 @@ static int replmd_update_rpmd(struct ldb_module *module, * otherwise we consider we are updating */ if (ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE")) { situation = REPL_URGENT_ON_DELETE; + } else if (rename_attrs) { + situation = REPL_URGENT_ON_CREATE | REPL_URGENT_ON_DELETE; } else { situation = REPL_URGENT_ON_UPDATE; } @@ -1185,7 +1195,7 @@ static int replmd_update_rpmd(struct ldb_module *module, "a specified replPropertyMetaData attribute or with others\n")); return LDB_ERR_OPERATIONS_ERROR; } - if (situation == REPL_URGENT_ON_DELETE) { + if (situation != REPL_URGENT_ON_UPDATE) { DEBUG(0,(__location__ ": changereplmetada control can't be called when deleting an object\n")); return LDB_ERR_OPERATIONS_ERROR; } @@ -2218,7 +2228,8 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req) ldb_msg_remove_attr(msg, "whenChanged"); ldb_msg_remove_attr(msg, "uSNChanged"); - ret = replmd_update_rpmd(module, ac->schema, req, msg, &ac->seq_num, t, &is_urgent); + ret = replmd_update_rpmd(module, ac->schema, req, NULL, + msg, &ac->seq_num, t, &is_urgent); if (ret == LDB_ERR_REFERRAL) { referral = talloc_asprintf(req, "ldap://%s/%s", |