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

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