summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules/ldb_map.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-09-14 03:15:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:38 -0500
commit1e4f5a096cb75f0db0219fc55a6f654c485b0427 (patch)
tree2a1724130e34798309ba6a2b840fa15dc2a01e82 /source4/lib/ldb/modules/ldb_map.c
parent48615ca0da4a4521fdf632ec3cbc45286919f996 (diff)
downloadsamba-1e4f5a096cb75f0db0219fc55a6f654c485b0427.tar.gz
samba-1e4f5a096cb75f0db0219fc55a6f654c485b0427.tar.bz2
samba-1e4f5a096cb75f0db0219fc55a6f654c485b0427.zip
r18495: More work on the LDAP backend (which now passes a lot of our tests!)
This adds a list of attributes that are in our wildcard seaches, but the remote server requires to be explicitly listed. This also cleans up the handling of wildcards in ldb_map to be more consistant. Also fix the partitions module to rebase the search, if on the GC port, we do a subtree search. (Otherwise backends can rightly complain that the search is not in their scope). Andrew Bartlett (This used to be commit bc58792b7102f086b19353635d5d5ef9d40a0aae)
Diffstat (limited to 'source4/lib/ldb/modules/ldb_map.c')
-rw-r--r--source4/lib/ldb/modules/ldb_map.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c
index 2bc3416a93..0c58687ddb 100644
--- a/source4/lib/ldb/modules/ldb_map.c
+++ b/source4/lib/ldb/modules/ldb_map.c
@@ -432,6 +432,30 @@ const char *map_attr_map_remote(void *mem_ctx, const struct ldb_map_attribute *m
return talloc_strdup(mem_ctx, map->local_name);
}
+
+/* Merge two lists of attributes into a single one. */
+int map_attrs_merge(struct ldb_module *module, void *mem_ctx, const char ***attrs, const char * const *more_attrs)
+{
+ int i, j, k;
+
+ for (i = 0; *attrs && (*attrs)[i]; i++) /* noop */ ;
+ for (j = 0; more_attrs && more_attrs[j]; j++) /* noop */ ;
+
+ *attrs = talloc_realloc(mem_ctx, *attrs, const char *, i+j+1);
+ if (*attrs == NULL) {
+ map_oom(module);
+ return -1;
+ }
+
+ for (k = 0; k < j; k++) {
+ (*attrs)[i+k] = more_attrs[k];
+ }
+
+ (*attrs)[i+k] = NULL;
+
+ return 0;
+}
+
/* Mapping ldb values
* ================== */
@@ -1226,7 +1250,10 @@ static int map_init_dns(struct ldb_module *module, struct ldb_map_context *data,
}
/* Store attribute maps and objectClass maps in private data. */
-static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data, const struct ldb_map_attribute *attrs, const struct ldb_map_objectclass *ocls)
+static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data,
+ const struct ldb_map_attribute *attrs,
+ const struct ldb_map_objectclass *ocls,
+ const char * const *wildcard_attributes)
{
int i, j, last;
last = 0;
@@ -1261,6 +1288,8 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data
/* Store list of objectClass maps */
data->objectclass_maps = ocls;
+ data->wildcard_attributes = wildcard_attributes;
+
return LDB_SUCCESS;
}
@@ -1271,7 +1300,10 @@ struct ldb_module_ops ldb_map_get_ops(void)
}
/* Initialize global private data. */
-int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs, const struct ldb_map_objectclass *ocls, const char *name)
+int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs,
+ const struct ldb_map_objectclass *ocls,
+ const char * const *wildcard_attributes,
+ const char *name)
{
struct map_private *data;
int ret;
@@ -1299,7 +1331,7 @@ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attr
}
/* Store list of attribute and objectClass maps */
- ret = map_init_maps(module, data->context, attrs, ocls);
+ ret = map_init_maps(module, data->context, attrs, ocls, wildcard_attributes);
if (ret != LDB_SUCCESS) {
talloc_free(data);
return ret;