*/
-#include "ldb_module.h"
-
+#include "ldb_includes.h"
#include "ldb_map.h"
#include "ldb_map_private.h"
/* Unknown attribute: ignore */
if (map == NULL) {
ldb_debug(ldb, LDB_DEBUG_WARNING, "ldb_map: "
- "Not mapping attribute '%s': no mapping found\n",
+ "Not mapping attribute '%s': no mapping found",
old->name);
goto local;
}
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': "
- "'convert_local' not set\n",
+ "'convert_local' not set",
map->local_name);
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': "
- "'generate_remote' not set\n",
+ "'generate_remote' not set",
map->local_name);
goto local;
}
/* Skip 'IS_MAPPED' */
if (ldb_attr_cmp(msg->elements[i].name, IS_MAPPED) == 0) {
ldb_debug(ldb, LDB_DEBUG_WARNING, "ldb_map: "
- "Skipping attribute '%s'\n",
+ "Skipping attribute '%s'",
msg->elements[i].name);
continue;
}
struct ldb_context *ldb;
struct map_context *ac;
struct ldb_message *remote_msg;
- const char *dn;
int ret;
ldb = ldb_module_get_ctx(module);
/* Store remote DN in 'IS_MAPPED' */
/* TODO: use GUIDs here instead */
- dn = ldb_dn_alloc_linearized(ac->local_msg, remote_msg->dn);
- if (ldb_msg_add_string(ac->local_msg, IS_MAPPED, dn) != 0) {
+ if (ldb_msg_add_dn(ac->local_msg, IS_MAPPED, remote_msg->dn) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
{
struct ldb_request *local_req;
struct ldb_context *ldb;
- char *dn;
int ret;
ldb = ldb_module_get_ctx(ac->module);
LDB_FLAG_MOD_ADD, NULL) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
- dn = ldb_dn_alloc_linearized(ac->local_msg,
- ac->remote_req->op.mod.message->dn);
- if (ldb_msg_add_string(ac->local_msg, IS_MAPPED, dn) != 0) {
+ if (ldb_msg_add_dn(ac->local_msg, IS_MAPPED,
+ ac->remote_req->op.mod.message->dn) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}