diff options
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb.c | 24 | ||||
-rw-r--r-- | src/db/sysdb.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index 5160e3df3..98b7afbfa 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -752,6 +752,30 @@ done: return ret; } +errno_t sysdb_attrs_copy(struct sysdb_attrs *src, struct sysdb_attrs *dst) +{ + int ret; + size_t c; + size_t d; + + if (src == NULL || dst == NULL) { + return EINVAL; + } + + for (c = 0; c < src->num; c++) { + for (d = 0; d < src->a[c].num_values; d++) { + ret = sysdb_attrs_add_val_safe(dst, src->a[c].name, + &src->a[c].values[d]); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, "sysdb_attrs_add_val failed.\n"); + return ret; + } + } + } + + return EOK; +} + 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 83d0d794c..c677957bb 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -352,6 +352,7 @@ int sysdb_attrs_add_lc_name_alias_safe(struct sysdb_attrs *attrs, int sysdb_attrs_copy_values(struct sysdb_attrs *src, struct sysdb_attrs *dst, const char *name); +errno_t sysdb_attrs_copy(struct sysdb_attrs *src, struct sysdb_attrs *dst); int sysdb_attrs_get_el(struct sysdb_attrs *attrs, const char *name, struct ldb_message_element **el); int sysdb_attrs_get_el_ext(struct sysdb_attrs *attrs, const char *name, |