andykimpe / rpms / 389-ds-base

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

Blame SOURCES/0053-Ticket-49014-ns-accountstatus.pl-shows-wrong-status-.patch

95b556
From 1087a64b461358888ac50d47fde7f9be71449481 Mon Sep 17 00:00:00 2001
95b556
From: Mark Reynolds <mreynolds@redhat.com>
95b556
Date: Thu, 20 Oct 2016 12:38:49 -0400
95b556
Subject: [PATCH 53/55] Ticket 49014 - ns-accountstatus.pl shows wrong status
95b556
 for accounts inactivated by Account policy plugin
95b556
95b556
Bug Description:  ns-accountstatus.pl shows wrong status for accounts inactivated
95b556
                  by inactivity.  If there is no acct policy subentry the wrong
95b556
                  basedn was used to get the inactivity limit.  This prevented the
95b556
                  script from detecting if an account was inactivated due to inactivity.
95b556
95b556
Fix Description:  If there is no subentry, then use the existing config entry
95b556
                  to get the inactivity limit.
95b556
95b556
https://fedorahosted.org/389/ticket/49014
95b556
95b556
Reviewed by: nhosoi(Thanks!)
95b556
95b556
(cherry picked from commit 2e494bc7e5e73f97e8a425b22706418ff8879336)
95b556
(cherry picked from commit 1c6b1c99b576e7b9ffdc217d20737e216ec40a24)
95b556
---
95b556
 ldap/admin/src/scripts/ns-accountstatus.pl.in | 11 ++++++++---
95b556
 1 file changed, 8 insertions(+), 3 deletions(-)
95b556
95b556
diff --git a/ldap/admin/src/scripts/ns-accountstatus.pl.in b/ldap/admin/src/scripts/ns-accountstatus.pl.in
95b556
index 37fc7fa..a20d2df 100644
95b556
--- a/ldap/admin/src/scripts/ns-accountstatus.pl.in
95b556
+++ b/ldap/admin/src/scripts/ns-accountstatus.pl.in
95b556
@@ -474,7 +474,7 @@ sub getAcctPolicy
95b556
     close(LDAP1);
95b556
 
95b556
     #
95b556
-    # Now, get the DN for the cos template from the entry
95b556
+    # Now, get the DN for the account policy subEntry from the entry (if available)
95b556
     #
95b556
     $srch{base} = $entry;
95b556
     $srch{filter} = "(objectclass=*)";
95b556
@@ -486,14 +486,19 @@ sub getAcctPolicy
95b556
         s/\n //g;
95b556
         if (/^$cosspecattr: (.*)/i){
95b556
             $templateDN = $1;
95b556
+            break;
95b556
         }
95b556
     }
95b556
     close(LDAP1);
95b556
 
95b556
     #
95b556
-    # Get the inactivity limit from the template]
95b556
+    # Get the inactivity limit
95b556
     #
95b556
-    $srch{base} = $templateDN;
95b556
+    $srch{base} = $configentry;
95b556
+    if ($templateDN){
95b556
+        # Use subEntry DN
95b556
+        $srch{base} = $templateDN;
95b556
+    }
95b556
     $srch{filter} = "($limitattr=*)";
95b556
     $srch{scope} = "base";
95b556
     $srch{attrs} = "$limitattr";
95b556
-- 
95b556
2.4.11
95b556