summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2010-12-21 11:39:03 +0100
committerStephen Gallagher <sgallagh@redhat.com>2010-12-21 08:20:32 -0500
commit3767675546204e4b2ace9a3c17f9ff2aed2c18a4 (patch)
tree14b44da4523e7ec06fe5b305646ec306bced869a /src
parent22310aadc8733e87153d6519aff0aed7dea44e79 (diff)
downloadsssd-3767675546204e4b2ace9a3c17f9ff2aed2c18a4.tar.gz
sssd-3767675546204e4b2ace9a3c17f9ff2aed2c18a4.tar.xz
sssd-3767675546204e4b2ace9a3c17f9ff2aed2c18a4.zip
Add all values of a multi-valued user attribute
Diffstat (limited to 'src')
-rw-r--r--src/providers/ldap/sdap_async_accounts.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c
index 004c69aff..289b63733 100644
--- a/src/providers/ldap/sdap_async_accounts.c
+++ b/src/providers/ldap/sdap_async_accounts.c
@@ -51,6 +51,7 @@ static int sdap_save_user(TALLOC_CTX *memctx,
char *val = NULL;
int cache_timeout;
char *usn_value = NULL;
+ size_t c;
DEBUG(9, ("Save user\n"));
@@ -235,18 +236,20 @@ static int sdap_save_user(TALLOC_CTX *memctx,
goto fail;
}
if (el->num_values > 0) {
- DEBUG(9, ("Adding [%s]=[%s] to user attributes.\n",
- opts->user_map[i].sys_name,
- (const char*) el->values[0].data));
- val = talloc_strdup(user_attrs, (const char*) el->values[0].data);
- if (val == NULL) {
- ret = ENOMEM;
- goto fail;
- }
- ret = sysdb_attrs_add_string(user_attrs,
- opts->user_map[i].sys_name, val);
- if (ret) {
- goto fail;
+ for (c = 0; c < el->num_values; c++) {
+ DEBUG(9, ("Adding [%s]=[%s] to user attributes.\n",
+ opts->user_map[i].sys_name,
+ (const char*) el->values[c].data));
+ val = talloc_strdup(user_attrs, (const char*) el->values[c].data);
+ if (val == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+ ret = sysdb_attrs_add_string(user_attrs,
+ opts->user_map[i].sys_name, val);
+ if (ret) {
+ goto fail;
+ }
}
}
}