>From 402ab3d26b67066a5230527130740a8a329064e7 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkin...@redhat.com>
Date: Thu, 17 Feb 2011 16:37:39 -0800
Subject: [PATCH] Reset target DN when generated UUID is used as RDN

When the UUID plug-in generates a value that is used in the RDN
of the entry being added, the old DN is free'd and replaced with
the new DN.  The problem is that the operation in the pblock holds
a pointer to the old DN address.  This can cause other plug-ins to
reference garbage, leading to incorrect results or crashes.  This
was causing the attribute uniqueness plug-in to not work correctly,
resulting in duplicate netgroup entries.

The fix is to have the UUID plug-in reset the target DN after
changing the DN of the entry to be added.

ticket 963
---
 daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c 
b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
index c6353ae..5cd65b3 100644
--- a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
+++ b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
@@ -1109,6 +1109,10 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
                     slapi_ch_free_string(&nrdn);
                     slapi_sdn_set_rdn(sdn, rdn);
                     slapi_entry_set_sdn(e, sdn);
+
+                    /* reset the target DN since we've changed it. */
+                    slapi_pblock_set(pb, SLAPI_ADD_TARGET,
+                                         
(char*)slapi_sdn_get_ndn(slapi_entry_get_sdn_const(e)));
                 }
                 slapi_rdn_free(&rdn);
                 slapi_sdn_free(&sdn);
-- 
1.7.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to