[SSSD] [PATCH] Save original memberof, not memberof
Jakub Hrozek
jhrozek at redhat.com
Tue Dec 20 15:16:11 UTC 2011
On Tue, Dec 20, 2011 at 01:45:59PM +0100, Jan Zelený wrote:
> > The sdap_save_* refactoring brought one bug where instead of saving into
> > SYSDB_ORIG_MEMBEROF we would save into SYSDB_MEMBEROF. I rechecked all
> > other attribute names and this was the only one that was changed.
>
> Nack,
>
> the issue is deeper than it looks. In the original code, there was conversion
> from SYSDB_MEMBEROF to SYSDB_ORIG_MEMBEROF, hence this fix should be done not
> only here, but also in user map. Also please review if the memberof attribute
> is mapped correctly in other maps, I think I saw some similar code on other
> places.
>
> Thanks
> Jan
Thanks, you're right. New patch attached.
-------------- next part --------------
From 6126ef2e8f98336518ab9a71e975f05f63ad1345 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Mon, 19 Dec 2011 12:47:34 +0100
Subject: [PATCH] Save original memberof, not memberof
---
src/providers/ldap/sdap_async_users.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index cccf75b8caecd34ba6d562e2e8b8e7e3d0e18e49..ac856a64208cb87994f676ab50fdba6d82dbcb50 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,
--
1.7.7.4
More information about the sssd-devel
mailing list