Initialize map lock in NIS plugin

This commit is contained in:
Alexander Bokovoy 2020-05-06 14:49:33 +03:00
parent 699243ed49
commit e1e953db74
2 changed files with 55 additions and 1 deletions

49
slapi-nis-bz1832190.patch Normal file
View File

@ -0,0 +1,49 @@
From e8c3ed416a442f5a431ca48f7ea384a6abc1fa53 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Wed, 6 May 2020 14:08:41 +0300
Subject: [PATCH] Initialize map lock in NIS plugin as well
Also if ignored_containers_sdn is NULL, we don't really need to check
whether a write could be ignored. It has to be processed, so bail out
early with FALSE.
Resolves: rhbz#1832190
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
---
src/back-shr.c | 4 ++++
src/plug-nis.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/src/back-shr.c b/src/back-shr.c
index e2b5dd3..c6a181e 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -2960,6 +2960,10 @@ backend_shr_write_ignore(Slapi_PBlock *pb)
int i = 0;
PRBool ignore = PR_FALSE;
+ if (ignored_containers_sdn == NULL) {
+ return ignore;
+ }
+
/* Check if the target DN is a subordinates of
* on of the ignored containers
*/
diff --git a/src/plug-nis.c b/src/plug-nis.c
index ee90c37..0ce4ae6 100644
--- a/src/plug-nis.c
+++ b/src/plug-nis.c
@@ -540,6 +540,9 @@ nis_plugin_init(Slapi_PBlock *pb)
"error setting up plugin\n");
return -1;
}
+
+ init_map_lock();
+
/* Read global configuration. */
if ((slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY,
&plugin_entry) == 0) &&
--
2.25.4

View File

@ -11,12 +11,13 @@
Name: slapi-nis
Version: 0.56.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: NIS Server and Schema Compatibility plugins for Directory Server
License: GPLv2
URL: http://pagure.io/slapi-nis/
Source0: https://releases.pagure.org/slapi-nis/slapi-nis-%{version}.tar.gz
Source1: https://releases.pagure.org/slapi-nis/slapi-nis-%{version}.tar.gz.asc
Patch1: slapi-nis-bz1832190.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
@ -54,6 +55,7 @@ for attributes from multiple entries in the tree.
%prep
%setup -q
%patch1 -p1
%build
autoconf --force
@ -81,6 +83,9 @@ make check
%{_sbindir}/nisserver-plugin-defs
%changelog
* Wed May 06 2020 Alexander Bokovoy <abokovoy@redhat.com> - 0.56.5-2
- Initialize map locks in NIS plugin to prevent crash
* Mon May 04 2020 Alexander Bokovoy <abokovoy@redhat.com> - 0.56.5-1
- New upstream release
- Resolves: rhbz#1751295: (2) When sync-repl is enabled, slapi-nis can deadlock during retrochanglog trimming