andykimpe / rpms / 389-ds-base

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

Blame SOURCES/0007-Ticket-49932-Crash-in-delete_passwdPolicy-when-persi.patch

31affc
From de03e7456108de3f3d28c6a5d33926525b70557f Mon Sep 17 00:00:00 2001
92192e
From: Mark Reynolds <mreynolds@redhat.com>
92192e
Date: Thu, 30 Aug 2018 14:28:10 -0400
92192e
Subject: [PATCH] Ticket 49932 - Crash in delete_passwdPolicy when persistent
92192e
 search connections are terminated unexpectedly
92192e
92192e
Bug Description:  We clone a pblock in a psearch search, and under certain
92192e
                  error conditions this pblock is freed, but it frees the
92192e
                  password policy struct which can lead to a double free
92192e
                  when the original pblock is destroyed.
92192e
92192e
Fix Description:  During the cloning, set the pwppolicy struct to NULL
92192e
                  so the clone allocates its own policy if needed
92192e
92192e
https://pagure.io/389-ds-base/issue/49932
92192e
92192e
Reviewed by: ?
92192e
92192e
(cherry picked from commit 78fc627accacfa4061ce48977e22301f81ea8d73)
92192e
---
92192e
 ldap/servers/slapd/pblock.c | 2 ++
92192e
 1 file changed, 2 insertions(+)
92192e
92192e
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
92192e
index 4514c3ce6..bc18a7b18 100644
92192e
--- a/ldap/servers/slapd/pblock.c
92192e
+++ b/ldap/servers/slapd/pblock.c
92192e
@@ -322,6 +322,8 @@ slapi_pblock_clone(Slapi_PBlock *pb)
92192e
     if (pb->pb_intop != NULL) {
92192e
         _pblock_assert_pb_intop(new_pb);
92192e
         *(new_pb->pb_intop) = *(pb->pb_intop);
92192e
+        /* set pwdpolicy to NULL so this clone allocates its own policy */
92192e
+        new_pb->pb_intop->pwdpolicy = NULL;
92192e
     }
92192e
     if (pb->pb_intplugin != NULL) {
92192e
         _pblock_assert_pb_intplugin(new_pb);
92192e
-- 
92192e
2.17.1
92192e