summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/db/sysdb.c24
-rw-r--r--src/db/sysdb.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index fd76f73c..7f7310a2 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -604,6 +604,30 @@ int sysdb_attrs_add_time_t(struct sysdb_attrs *attrs,
return ret;
}
+int sysdb_attrs_copy_values(struct sysdb_attrs *src,
+ struct sysdb_attrs *dst,
+ const char *name)
+{
+ int ret = EOK;
+ int i;
+ struct ldb_message_element *src_el;
+
+ ret = sysdb_attrs_get_el(src, name, &src_el);
+ if (ret != EOK) {
+ goto done;
+ }
+
+ for (i = 0; i < src_el->num_values; i++) {
+ ret = sysdb_attrs_add_val(dst, name, &src_el->values[i]);
+ if (ret != EOK) {
+ goto done;
+ }
+ }
+
+done:
+ return ret;
+}
+
int sysdb_attrs_users_from_str_list(struct sysdb_attrs *attrs,
const char *attr_name,
const char *domain,
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index f0ff6f5a..5baac98b 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -268,6 +268,9 @@ int sysdb_attrs_add_uint32(struct sysdb_attrs *attrs,
const char *name, uint32_t value);
int sysdb_attrs_add_time_t(struct sysdb_attrs *attrs,
const char *name, time_t value);
+int sysdb_attrs_copy_values(struct sysdb_attrs *src,
+ struct sysdb_attrs *dst,
+ const char *name);
int sysdb_attrs_get_el(struct sysdb_attrs *attrs, const char *name,
struct ldb_message_element **el);
int sysdb_attrs_steal_string(struct sysdb_attrs *attrs,