summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/map.c b/src/map.c
index 263c22d..c09cff0 100644
--- a/src/map.c
+++ b/src/map.c
@@ -476,6 +476,7 @@ map_data_unset_map_entry(struct plugin_state *state,
free(entry);
}
}
+
static void
map_data_unset_entry(struct plugin_state *state,
const char *domain_name,
@@ -489,6 +490,7 @@ map_data_unset_entry(struct plugin_state *state,
entry = map_data_find_map_entry(state, map, key_len, key);
map_data_unset_map_entry(state, map, entry);
}
+
static void
map_data_unset_entry_dn(struct plugin_state *state,
const char *domain_name,
@@ -502,6 +504,45 @@ map_data_unset_entry_dn(struct plugin_state *state,
map_data_unset_map_entry(state, map, entry);
}
+static void
+map_data_set_entry_dn(struct plugin_state *state,
+ const char *domain_name,
+ const char *map_name,
+ const char *dn,
+ unsigned int key_len,
+ char *key,
+ unsigned int value_len,
+ char *value)
+{
+ struct map *map;
+ struct entry *entry;
+ map = map_data_find_map(state, domain_name, map_name);
+ entry = map_data_find_map_entry_dn(state, map, dn);
+ if (entry != NULL) {
+ free(entry->key);
+ free(entry->value);
+ entry->key = key;
+ entry->key_len = key_len;
+ entry->value = value;
+ entry->value_len = value_len;
+ } else {
+ entry = malloc(sizeof(*entry));
+ if (entry != NULL) {
+ memset(entry, 0, sizeof(*entry));
+ entry->dn = strdup(dn);
+ entry->key = key;
+ entry->key_len = key_len;
+ entry->value = value;
+ entry->value_len = value_len;
+ entry->next = map->entries;
+ if (map->entries != NULL) {
+ map->entries->prev = entry;
+ }
+ map->entries = entry;
+ }
+ }
+}
+
void
map_init(struct plugin_state *state)
{