andykimpe / rpms / 389-ds-base

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

Blame 0033-Ticket-579-Error-messages-encountered-when-using-POS.patch

dc8c34
From 1e2d920b07f0726c67b0f1543f1a378a6aa8c15a Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@totoro.usersys.redhat.com>
dc8c34
Date: Mon, 11 Feb 2013 14:49:14 -0800
dc8c34
Subject: [PATCH 33/33] Ticket #579 - Error messages encountered when using
dc8c34
 POSIX winsync
dc8c34
dc8c34
Bug description: posix_group_fix_memberuid_callback registered by
dc8c34
posixWinsyncCreateMemberOfTask calls an internal modify function
dc8c34
even if there are no attributes to fix up.  The attempt fails as
dc8c34
expected, but it logs cryptic errors in the error log:
dc8c34
  - slapi_modify_internal_set_pb: NULL parameter
dc8c34
  - allow_operation: component identity is NULL
dc8c34
dc8c34
Fix description: This patch skips calling the fix up internal
dc8c34
modify if there is no attributes to fix up.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/579
dc8c34
dc8c34
Reviewed by Rich (Thank you!!)
dc8c34
(cherry picked from commit 74423d2eaef50949fd96ded8a2251834663e95e8)
dc8c34
---
dc8c34
 .../plugins/posix-winsync/posix-group-task.c       |   21 +++++++++++--------
dc8c34
 1 files changed, 12 insertions(+), 9 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-task.c b/ldap/servers/plugins/posix-winsync/posix-group-task.c
dc8c34
index 92ac342..1d9135d 100644
dc8c34
--- a/ldap/servers/plugins/posix-winsync/posix-group-task.c
dc8c34
+++ b/ldap/servers/plugins/posix-winsync/posix-group-task.c
dc8c34
@@ -250,6 +250,7 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data)
dc8c34
 
dc8c34
     char *dn = slapi_entry_get_dn(e);
dc8c34
     Slapi_DN *sdn = slapi_entry_get_sdn(e);
dc8c34
+    LDAPMod **mods = NULL;
dc8c34
 
dc8c34
 /* Clean out memberuids and dsonlymemberuids without a valid referant */
dc8c34
     rc = slapi_entry_attr_find(e, "memberuid", &muid_attr);
dc8c34
@@ -380,17 +381,19 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data)
dc8c34
         }
dc8c34
     }
dc8c34
 
dc8c34
-    Slapi_PBlock *mod_pb = slapi_pblock_new();
dc8c34
+    mods = slapi_mods_get_ldapmods_passout(smods);
dc8c34
+    if (mods) {
dc8c34
+        Slapi_PBlock *mod_pb = NULL;
dc8c34
+        mod_pb = slapi_pblock_new();
dc8c34
+        slapi_modify_internal_set_pb_ext(mod_pb, sdn, mods, 0, 0,
dc8c34
+                                        posix_winsync_get_plugin_identity(), 0);
dc8c34
 
dc8c34
-    slapi_modify_internal_set_pb_ext(mod_pb, sdn, slapi_mods_get_ldapmods_passout(smods), 0, 0,
dc8c34
-                                     posix_winsync_get_plugin_identity(), 0);
dc8c34
-
dc8c34
-    slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);
dc8c34
-    slapi_modify_internal_pb(mod_pb);
dc8c34
-
dc8c34
-    slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
dc8c34
-    slapi_pblock_destroy(mod_pb);
dc8c34
+        slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);
dc8c34
+        slapi_modify_internal_pb(mod_pb);
dc8c34
 
dc8c34
+        slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
dc8c34
+        slapi_pblock_destroy(mod_pb);
dc8c34
+    }
dc8c34
     slapi_mods_free(&smods);
dc8c34
 
dc8c34
     slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
dc8c34
-- 
dc8c34
1.7.7.6
dc8c34