]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
replmd: check for the sortedLinks feature flag
authorAndrew Bartlett <abartlet@samba.org>
Thu, 2 Feb 2017 22:25:37 +0000 (11:25 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 9 Feb 2017 02:17:16 +0000 (03:17 +0100)
If it is there, we assume linked attributes are stored in a sorted
order.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/dsdb/samdb/ldb_modules/samba_dsdb.c
source4/dsdb/samdb/samdb.h

index eae978df8c7ceb7eb8e80eb71b224298fcf205fb..6e041c76e20a527a2f415eee0615b4e1e181489c 100644 (file)
@@ -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);
 }
 
index bf45fa59f6a0cec36174d6177d46813177195f39..9098b52f816464ec0d0b53a8ca01828c990b714f 100644 (file)
@@ -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);
index 3eb4a67bdfc5156700cbeae18a9d5ff7f5eb3f5c..a85d05c93ae2af79b3664584e64a8b873cf5cb28 100644 (file)
@@ -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__ */