summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-05-22 18:31:42 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-06-05 16:39:30 +0200
commit12089241f6a6eabf4f0c95669e5fc2bb3b503c06 (patch)
tree405481207642c3899abe8420e7f9d9c9cb8ce392 /src/providers
parentb3d110fbc424a03674a6e50e489a7cbab9702f0b (diff)
downloadsssd-12089241f6a6eabf4f0c95669e5fc2bb3b503c06.tar.gz
sssd-12089241f6a6eabf4f0c95669e5fc2bb3b503c06.tar.xz
sssd-12089241f6a6eabf4f0c95669e5fc2bb3b503c06.zip
SDAP: Add sdap_copy_map_entry
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ldap/sdap.c17
-rw-r--r--src/providers/ldap/sdap.h4
2 files changed, 21 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c
index bae7d02c5..2568bdd1f 100644
--- a/src/providers/ldap/sdap.c
+++ b/src/providers/ldap/sdap.c
@@ -28,6 +28,23 @@
/* =Retrieve-Options====================================================== */
+errno_t sdap_copy_map_entry(const struct sdap_attr_map *src_map,
+ struct sdap_attr_map *dst_map,
+ int entry_index)
+{
+ if (src_map[entry_index].name != NULL) {
+ dst_map[entry_index].name = talloc_strdup(dst_map,
+ src_map[entry_index].name);
+ if (dst_map[entry_index].name == NULL) {
+ return ENOMEM;
+ }
+ } else {
+ dst_map->name = NULL;
+ }
+
+ return EOK;
+}
+
int sdap_copy_map(TALLOC_CTX *memctx,
struct sdap_attr_map *src_map,
int num_entries,
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index d7f6c646e..e7e1b5194 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -467,6 +467,10 @@ struct sdap_deref_attrs {
struct sysdb_attrs *attrs;
};
+errno_t sdap_copy_map_entry(const struct sdap_attr_map *src_map,
+ struct sdap_attr_map *dst_map,
+ int entry_index);
+
int sdap_copy_map(TALLOC_CTX *memctx,
struct sdap_attr_map *src_map,
int num_entries,