amoralej / rpms / 389-ds-base

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

Blame SOURCES/0020-Ticket-47513-Refine-the-check-for-localrundir.patch

ba46c7
From bb542f7825922e9494d90c9279601d43442ba761 Mon Sep 17 00:00:00 2001
ba46c7
From: Mark Reynolds <mreynolds@redhat.com>
ba46c7
Date: Mon, 30 Sep 2013 12:11:34 -0400
ba46c7
Subject: [PATCH 20/28] Ticket 47513 - Refine the check for @localrundir@
ba46c7
ba46c7
Bug Description:  if @localrundir@ is not set, then the wrong value is used for tmpfiles.d
ba46c7
ba46c7
Fix Description:  Improve the checking/setting of the localrundir.  set_path_attribute() is not
ba46c7
                  the correct subroutine to call as it can incorrectly add the prefix again
ba46c7
                  if @localrundir@ is not set.  Created new function to just add the prefix -
ba46c7
                  only if @localrundir@ is set.
ba46c7
ba46c7
https://fedorahosted.org/389/ticket/47513
ba46c7
ba46c7
Reviewed by: richm(Thanks!)
ba46c7
(cherry picked from commit 9e38a3be20c87141221b52ce992a713cba9eae3b)
ba46c7
(cherry picked from commit bb1fc9688887a4b2ba6020bab0f4b9ecbfb7c576)
ba46c7
---
ba46c7
 ldap/admin/src/scripts/DSCreate.pm.in |   15 +++++++++++++--
ba46c7
 1 files changed, 13 insertions(+), 2 deletions(-)
ba46c7
ba46c7
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
ba46c7
index 3957277..fb834df 100644
ba46c7
--- a/ldap/admin/src/scripts/DSCreate.pm.in
ba46c7
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
ba46c7
@@ -799,6 +799,17 @@ sub set_path_attribute {
ba46c7
     }
ba46c7
 }
ba46c7
 
ba46c7
+sub set_localrundir {
ba46c7
+    my $val = shift;
ba46c7
+    my $prefix = shift;
ba46c7
+
ba46c7
+    if ($val) {
ba46c7
+        return "$prefix" . "$val";
ba46c7
+    } else {
ba46c7
+        return "";
ba46c7
+    }
ba46c7
+}
ba46c7
+
ba46c7
 sub setDefaults {
ba46c7
     my $inf = shift;
ba46c7
     # set default values
ba46c7
@@ -1082,8 +1093,8 @@ sub updateTmpfilesDotD {
ba46c7
         # Type Path          Mode UID  GID  Age
ba46c7
         # d    /var/run/user 0755 root root 10d
ba46c7
         # we don't use age
ba46c7
-        my $localrundir = set_path_attribute("@localrundir@", $inf->{slapd}->{localstatedir}, $inf->{General}->{prefix});
ba46c7
-        if( -d "$localrundir"){
ba46c7
+        my $localrundir = set_localrundir("@localrundir@", $inf->{General}->{prefix});
ba46c7
+        if( $localrundir != "" && -d "$localrundir"){
ba46c7
             $rundir = "$localrundir/@PACKAGE_NAME@";
ba46c7
             $lockdir = "$localrundir/lock/@PACKAGE_NAME@/slapd-$inf->{slapd}->{ServerIdentifier}";
ba46c7
             $parentdir = "$localrundir/lock/@PACKAGE_NAME@";
ba46c7
-- 
ba46c7
1.7.1
ba46c7