amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone

Blame SOURCES/0071-Ticket-49161-memberof-fails-if-group-is-moved-into-s.patch

96373c
From 293361f34d935080c1d8d0e73b4355b48faebe2a Mon Sep 17 00:00:00 2001
96373c
From: Ludwig Krispenz <lkrispen@redhat.com>
96373c
Date: Tue, 27 Feb 2018 13:56:14 +0100
96373c
Subject: [PATCH] Ticket 49161 - memberof fails if group is moved into scope
96373c
96373c
if the DEL part of the replace of memberof fails because it does not exist
96373c
just add the new memberof values
96373c
96373c
Reviwed by: Mark, thanks
96373c
---
96373c
 ldap/servers/plugins/memberof/memberof.c | 7 +++++++
96373c
 1 file changed, 7 insertions(+)
96373c
96373c
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c
96373c
index fcfa7817d..2f46167dc 100644
96373c
--- a/ldap/servers/plugins/memberof/memberof.c
96373c
+++ b/ldap/servers/plugins/memberof/memberof.c
96373c
@@ -1710,6 +1710,13 @@ memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod_o
96373c
                 replace_mod.mod_values = replace_val;
96373c
             }
96373c
             rc = memberof_add_memberof_attr(mods, op_to, config->auto_add_oc);
96373c
+            if (rc == LDAP_NO_SUCH_ATTRIBUTE) {
96373c
+                /* the memberof values to be replaced do not exist
96373c
+                 * just add the new values */
96373c
+                mods[0] = mods[1];
96373c
+                mods[1] = NULL;
96373c
+                rc = memberof_add_memberof_attr(mods, op_to, config->auto_add_oc);
96373c
+            }
96373c
         }
96373c
     }
96373c
 
96373c
-- 
96373c
2.13.6
96373c