From: Andrew Bartlett Date: Thu, 2 Feb 2017 22:25:37 +0000 (+1300) Subject: replmd: check for the sortedLinks feature flag X-Git-Tag: talloc-2.1.9~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84d08629af2e5de1da209023be484cdf19570579;p=thirdparty%2Fsamba.git replmd: check for the sortedLinks feature flag If it is there, we assume linked attributes are stored in a sorted order. Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index eae978df8c7..6e041c76e20 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -237,16 +237,37 @@ static int replmd_init(struct ldb_module *module) { struct replmd_private *replmd_private; struct ldb_context *ldb = ldb_module_get_ctx(module); - + static const char *samba_dsdb_attrs[] = { SAMBA_COMPATIBLE_FEATURES_ATTR, NULL }; + struct ldb_dn *samba_dsdb_dn; + struct ldb_result *res; + int ret; + TALLOC_CTX *frame = talloc_stackframe(); replmd_private = talloc_zero(module, struct replmd_private); if (replmd_private == NULL) { ldb_oom(ldb); + TALLOC_FREE(frame); return LDB_ERR_OPERATIONS_ERROR; } ldb_module_set_private(module, replmd_private); replmd_private->schema_dn = ldb_get_schema_basedn(ldb); + samba_dsdb_dn = ldb_dn_new(frame, ldb, "@SAMBA_DSDB"); + if (!samba_dsdb_dn) { + TALLOC_FREE(frame); + return ldb_oom(ldb); + } + + ret = dsdb_module_search_dn(module, frame, &res, samba_dsdb_dn, + samba_dsdb_attrs, DSDB_FLAG_NEXT_MODULE, NULL); + if (ret == LDB_SUCCESS) { + replmd_private->sorted_links + = ldb_msg_check_string_attribute(res->msgs[0], + SAMBA_COMPATIBLE_FEATURES_ATTR, + SAMBA_SORTED_LINKS_FEATURE); + } + TALLOC_FREE(frame); + return ldb_next_init(module); } diff --git a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c index bf45fa59f6a..9098b52f816 100644 --- a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c +++ b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c @@ -325,7 +325,7 @@ static int samba_dsdb_init(struct ldb_module *module) const char *backendType, *backendUrl; bool use_sasl_external = false; - const char *current_supportedFeatures[] = {}; + const char *current_supportedFeatures[] = {SAMBA_SORTED_LINKS_FEATURE}; if (!tmp_ctx) { return ldb_oom(ldb); diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 3eb4a67bdfc..a85d05c93ae 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -317,4 +317,7 @@ struct dsdb_extended_sec_desc_propagation_op { #define SAMBA_COMPATIBLE_FEATURES_ATTR "compatibleFeatures" #define SAMBA_REQUIRED_FEATURES_ATTR "requiredFeatures" #define SAMBA_FEATURES_SUPPORTED_FLAG "@SAMBA_FEATURES_SUPPORTED" + +#define SAMBA_SORTED_LINKS_FEATURE "sortedLinks" + #endif /* __SAMDB_H__ */