From 2b91164db361bbda212f33fbb32de4550c028d2e Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 6 May 2020 14:49:33 +0300 Subject: [PATCH] Initialize map lock in NIS plugin --- slapi-nis-bz1832190.patch | 49 +++++++++++++++++++++++++++++++++++++++ slapi-nis.spec | 7 +++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 slapi-nis-bz1832190.patch diff --git a/slapi-nis-bz1832190.patch b/slapi-nis-bz1832190.patch new file mode 100644 index 0000000..570735b --- /dev/null +++ b/slapi-nis-bz1832190.patch @@ -0,0 +1,49 @@ +From e8c3ed416a442f5a431ca48f7ea384a6abc1fa53 Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +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 +--- + 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 + diff --git a/slapi-nis.spec b/slapi-nis.spec index fea2f05..b3de214 100644 --- a/slapi-nis.spec +++ b/slapi-nis.spec @@ -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 - 0.56.5-2 +- Initialize map locks in NIS plugin to prevent crash + * Mon May 04 2020 Alexander Bokovoy - 0.56.5-1 - New upstream release - Resolves: rhbz#1751295: (2) When sync-repl is enabled, slapi-nis can deadlock during retrochanglog trimming