From 13308d6c9e30ca6835c38fbdedcb47dfc343d8b3 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 19 Dec 2011 12:47:34 +0100 Subject: Save original memberof, not memberof --- src/providers/ldap/sdap_async_users.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/providers') diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c index cccf75b8..ac856a64 100644 --- a/src/providers/ldap/sdap_async_users.c +++ b/src/providers/ldap/sdap_async_users.c @@ -154,12 +154,24 @@ int sdap_save_user(TALLOC_CTX *memctx, goto fail; } - ret = sdap_attrs_add_list(attrs, SYSDB_MEMBEROF, - "original memberOf", - name, user_attrs); - if (ret != EOK) { + ret = sysdb_attrs_get_el(attrs, SYSDB_MEMBEROF, &el); + if (ret) { goto fail; } + if (el->num_values == 0) { + DEBUG(7, ("Original memberOf is not available for [%s].\n", + name)); + } else { + DEBUG(7, ("Adding original memberOf attributes to [%s].\n", + name)); + for (i = 0; i < el->num_values; i++) { + ret = sysdb_attrs_add_string(user_attrs, SYSDB_ORIG_MEMBEROF, + (const char *) el->values[i].data); + if (ret) { + goto fail; + } + } + } ret = sdap_attrs_add_string(attrs, opts->user_map[SDAP_AT_USER_MODSTAMP].sys_name, -- cgit