diff options
author | Torgeir Lerkerød <torgeir.lerkerod@gmail.com> | 2009-10-20 18:33:25 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-10-21 15:46:38 +0200 |
commit | 95ce7dff20d5629eff16cc6f7527c542987d8eb0 (patch) | |
tree | 990e8b5dd63118fbc7ff86248f6ac45303329cbe /source4/lib/ldb | |
parent | 6e5dad49d9cfc8e8a3fc6c1e60733d6e25865ef7 (diff) | |
download | samba-95ce7dff20d5629eff16cc6f7527c542987d8eb0.tar.gz samba-95ce7dff20d5629eff16cc6f7527c542987d8eb0.tar.bz2 samba-95ce7dff20d5629eff16cc6f7527c542987d8eb0.zip |
S4: ldb_map modules uses defines that are reserved
On OpenSolaris MAP_RENAME and friends are defined in <sys/mman.h> e.g. mmap and friends. So on these systems MAP_* have a meaning. Cleaned up LDB name space by adding LDB_ in front of MAP_* e.g. MAP_RENAME => LDB_MAP_RENAME
Signed-off-by: Torgeir Lerkerød <torgeir.lerkerod@gmail.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.c | 58 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.h | 10 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map_inbound.c | 10 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map_outbound.c | 38 |
4 files changed, 58 insertions, 58 deletions
diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index 68e9d3f392..ab9578bd88 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -314,23 +314,23 @@ const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_contex } switch (map->type) { - case MAP_IGNORE: + case LDB_MAP_IGNORE: break; - case MAP_KEEP: + case LDB_MAP_KEEP: if (ldb_attr_cmp(map->local_name, name) == 0) { return map; } break; - case MAP_RENAME: - case MAP_CONVERT: + case LDB_MAP_RENAME: + case LDB_MAP_CONVERT: if (ldb_attr_cmp(map->u.rename.remote_name, name) == 0) { return map; } break; - case MAP_GENERATE: + case LDB_MAP_GENERATE: for (j = 0; map->u.generate.remote_names && map->u.generate.remote_names[j]; j++) { if (ldb_attr_cmp(map->u.generate.remote_names[j], name) == 0) { return map; @@ -356,7 +356,7 @@ bool map_attr_check_remote(const struct ldb_map_context *data, const char *attr) if (map == NULL) { return false; } - if (map->type == MAP_IGNORE) { + if (map->type == LDB_MAP_IGNORE) { return false; } @@ -371,11 +371,11 @@ const char *map_attr_map_local(void *mem_ctx, const struct ldb_map_attribute *ma } switch (map->type) { - case MAP_KEEP: + case LDB_MAP_KEEP: return talloc_strdup(mem_ctx, attr); - case MAP_RENAME: - case MAP_CONVERT: + case LDB_MAP_RENAME: + case LDB_MAP_CONVERT: return talloc_strdup(mem_ctx, map->u.rename.remote_name); default: @@ -390,7 +390,7 @@ const char *map_attr_map_remote(void *mem_ctx, const struct ldb_map_attribute *m return talloc_strdup(mem_ctx, attr); } - if (map->type == MAP_KEEP) { + if (map->type == LDB_MAP_KEEP) { return talloc_strdup(mem_ctx, attr); } @@ -429,7 +429,7 @@ int map_attrs_merge(struct ldb_module *module, void *mem_ctx, struct ldb_val ldb_val_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_val *val) { - if (map && (map->type == MAP_CONVERT) && (map->u.convert.convert_local)) { + if (map && (map->type == LDB_MAP_CONVERT) && (map->u.convert.convert_local)) { return map->u.convert.convert_local(module, mem_ctx, val); } @@ -440,7 +440,7 @@ struct ldb_val ldb_val_map_local(struct ldb_module *module, void *mem_ctx, struct ldb_val ldb_val_map_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_val *val) { - if (map && (map->type == MAP_CONVERT) && (map->u.convert.convert_remote)) { + if (map && (map->type == LDB_MAP_CONVERT) && (map->u.convert.convert_remote)) { return map->u.convert.convert_remote(module, mem_ctx, val); } @@ -493,20 +493,20 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct /* Unknown attribute - leave this RDN as is and hope the best... */ if (map == NULL) { - map_type = MAP_KEEP; + map_type = LDB_MAP_KEEP; } else { map_type = map->type; } switch (map_type) { - case MAP_IGNORE: - case MAP_GENERATE: + case LDB_MAP_IGNORE: + case LDB_MAP_GENERATE: ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_map: " - "MAP_IGNORE/MAP_GENERATE attribute '%s' " + "LDB_MAP_IGNORE/LDB_MAP_GENERATE attribute '%s' " "used in DN!", ldb_dn_get_component_name(dn, i)); goto failed; - case MAP_CONVERT: + case LDB_MAP_CONVERT: if (map->u.convert.convert_local == NULL) { ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_map: " "'convert_local' not set for attribute '%s' " @@ -514,8 +514,8 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct goto failed; } /* fall through */ - case MAP_KEEP: - case MAP_RENAME: + case LDB_MAP_KEEP: + case LDB_MAP_RENAME: name = map_attr_map_local(newdn, map, ldb_dn_get_component_name(dn, i)); if (name == NULL) goto failed; @@ -568,20 +568,20 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc /* Unknown attribute - leave this RDN as is and hope the best... */ if (map == NULL) { - map_type = MAP_KEEP; + map_type = LDB_MAP_KEEP; } else { map_type = map->type; } switch (map_type) { - case MAP_IGNORE: - case MAP_GENERATE: + case LDB_MAP_IGNORE: + case LDB_MAP_GENERATE: ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_map: " - "MAP_IGNORE/MAP_GENERATE attribute '%s' " + "LDB_MAP_IGNORE/LDB_MAP_GENERATE attribute '%s' " "used in DN!", ldb_dn_get_component_name(dn, i)); goto failed; - case MAP_CONVERT: + case LDB_MAP_CONVERT: if (map->u.convert.convert_remote == NULL) { ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_map: " "'convert_remote' not set for attribute '%s' " @@ -589,8 +589,8 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc goto failed; } /* fall through */ - case MAP_KEEP: - case MAP_RENAME: + case LDB_MAP_KEEP: + case LDB_MAP_RENAME: name = map_attr_map_remote(newdn, map, ldb_dn_get_component_name(dn, i)); if (name == NULL) goto failed; @@ -842,7 +842,7 @@ static struct ldb_message_element *map_objectclass_generate_local(struct ldb_mod static const struct ldb_map_attribute objectclass_convert_map = { .local_name = "objectClass", - .type = MAP_CONVERT, + .type = LDB_MAP_CONVERT, .u = { .convert = { .remote_name = "objectClass", @@ -957,7 +957,7 @@ failed: static const struct ldb_map_attribute builtin_attribute_maps[] = { { .local_name = "dn", - .type = MAP_CONVERT, + .type = LDB_MAP_CONVERT, .u = { .convert = { .remote_name = "dn", @@ -973,7 +973,7 @@ static const struct ldb_map_attribute builtin_attribute_maps[] = { static const struct ldb_map_attribute objectclass_attribute_map = { .local_name = "objectClass", - .type = MAP_GENERATE, + .type = LDB_MAP_GENERATE, .convert_operator = map_objectclass_convert_operator, .u = { .generate = { diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h index 3c1fe80895..21937bcfb3 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.h +++ b/source4/lib/ldb/ldb_map/ldb_map.h @@ -59,11 +59,11 @@ struct ldb_map_attribute { const char *local_name; /* local name */ enum ldb_map_attr_type { - MAP_IGNORE, /* Ignore this local attribute. Doesn't exist remotely. */ - MAP_KEEP, /* Keep as is. Same name locally and remotely. */ - MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */ - MAP_CONVERT, /* Rename + convert data */ - MAP_GENERATE /* Use generate function for generating new name/data. + LDB_MAP_IGNORE, /* Ignore this local attribute. Doesn't exist remotely. */ + LDB_MAP_KEEP, /* Keep as is. Same name locally and remotely. */ + LDB_MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */ + LDB_MAP_CONVERT, /* Rename + convert data */ + LDB_MAP_GENERATE /* Use generate function for generating new name/data. Used for generating attributes based on multiple remote attributes. */ } type; diff --git a/source4/lib/ldb/ldb_map/ldb_map_inbound.c b/source4/lib/ldb/ldb_map/ldb_map_inbound.c index 89037419fb..5a237ef28c 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_inbound.c @@ -79,10 +79,10 @@ static int ldb_msg_el_partition(struct ldb_module *module, struct ldb_message *l } switch (map->type) { - case MAP_IGNORE: + case LDB_MAP_IGNORE: goto local; - case MAP_CONVERT: + case LDB_MAP_CONVERT: if (map->u.convert.convert_local == NULL) { ldb_debug(ldb, LDB_DEBUG_WARNING, "ldb_map: " "Not mapping attribute '%s': " @@ -91,12 +91,12 @@ static int ldb_msg_el_partition(struct ldb_module *module, struct ldb_message *l goto local; } /* fall through */ - case MAP_KEEP: - case MAP_RENAME: + case LDB_MAP_KEEP: + case LDB_MAP_RENAME: el = ldb_msg_el_map_local(module, remote, map, old); break; - case MAP_GENERATE: + case LDB_MAP_GENERATE: if (map->u.generate.generate_remote == NULL) { ldb_debug(ldb, LDB_DEBUG_WARNING, "ldb_map: " "Not mapping attribute '%s': " diff --git a/source4/lib/ldb/ldb_map/ldb_map_outbound.c b/source4/lib/ldb/ldb_map/ldb_map_outbound.c index 45caffeeae..922d13991b 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_outbound.c @@ -124,19 +124,19 @@ static const char **map_attrs_collect_remote(struct ldb_module *module, void *me } switch (map->type) { - case MAP_IGNORE: + case LDB_MAP_IGNORE: continue; - case MAP_KEEP: + case LDB_MAP_KEEP: name = attrs[i]; goto named; - case MAP_RENAME: - case MAP_CONVERT: + case LDB_MAP_RENAME: + case LDB_MAP_CONVERT: name = map->u.rename.remote_name; goto named; - case MAP_GENERATE: + case LDB_MAP_GENERATE: /* Add all remote names of "generate" attrs */ for (j = 0; map->u.generate.remote_names[j]; j++) { result = talloc_realloc(mem_ctx, result, const char *, last+2); @@ -281,26 +281,26 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local } switch (map->type) { - case MAP_IGNORE: + case LDB_MAP_IGNORE: break; - case MAP_CONVERT: + case LDB_MAP_CONVERT: remote_name = map->u.convert.remote_name; break; - case MAP_KEEP: + case LDB_MAP_KEEP: remote_name = attr_name; break; - case MAP_RENAME: + case LDB_MAP_RENAME: remote_name = map->u.rename.remote_name; break; - case MAP_GENERATE: + case LDB_MAP_GENERATE: break; } switch (map->type) { - case MAP_IGNORE: + case LDB_MAP_IGNORE: return LDB_SUCCESS; - case MAP_CONVERT: + case LDB_MAP_CONVERT: if (map->u.convert.convert_remote == NULL) { ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_map: " "Skipping attribute '%s': " @@ -309,8 +309,8 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local return LDB_SUCCESS; } /* fall through */ - case MAP_KEEP: - case MAP_RENAME: + case LDB_MAP_KEEP: + case LDB_MAP_RENAME: old = ldb_msg_find_element(remote, remote_name); if (old) { el = ldb_msg_el_map_remote(module, local, map, attr_name, old); @@ -319,7 +319,7 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local } break; - case MAP_GENERATE: + case LDB_MAP_GENERATE: if (map->u.generate.generate_local == NULL) { ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_map: " "Skipping attribute '%s': " @@ -353,7 +353,7 @@ static int ldb_msg_el_merge_wildcard(struct ldb_module *module, struct ldb_messa int i, ret; /* Perhaps we have a mapping for "*" */ - if (map && map->type == MAP_KEEP) { + if (map && map->type == LDB_MAP_KEEP) { /* We copy everything over, and hope that anything with a more specific rule is overwritten */ for (i = 0; i < remote->num_elements; i++) { @@ -772,7 +772,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, } **new = *tree; - if (map->type == MAP_KEEP) { + if (map->type == LDB_MAP_KEEP) { /* Nothing to do here */ return 0; } @@ -814,7 +814,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, return 0; } - if (map->type == MAP_RENAME) { + if (map->type == LDB_MAP_RENAME) { /* Nothing more to do here, the attribute has been renamed */ return 0; } @@ -897,7 +897,7 @@ static int map_subtree_collect_remote(struct ldb_module *module, void *mem_ctx, return map->convert_operator(module, mem_ctx, new, tree); } - if (map->type == MAP_GENERATE) { + if (map->type == LDB_MAP_GENERATE) { ldb_debug(ldb, LDB_DEBUG_WARNING, "ldb_map: " "Skipping attribute '%s': " "'convert_operator' not set", |