Browse Source

Ticket 47513 - Refine the check for @localrundir@

Bug Description:  if @localrundir@ is not set, then the wrong value is used for tmpfiles.d

Fix Description:  Improve the checking/setting of the localrundir.  set_path_attribute() is not
                  the correct subroutine to call as it can incorrectly add the prefix again
                  if @localrundir@ is not set.  Created new function to just add the prefix -
                  only if @localrundir@ is set.

https://fedorahosted.org/389/ticket/47513

Reviewed by: richm(Thanks!)
Mark Reynolds 12 years ago
parent
commit
9e38a3be20
1 changed files with 13 additions and 2 deletions
  1. 13 2
      ldap/admin/src/scripts/DSCreate.pm.in

+ 13 - 2
ldap/admin/src/scripts/DSCreate.pm.in

@@ -799,6 +799,17 @@ sub set_path_attribute {
     }
 }
 
+sub set_localrundir {
+    my $val = shift;
+    my $prefix = shift;
+
+    if ($val) {
+        return "$prefix" . "$val";
+    } else {
+        return "";
+    }
+}
+
 sub setDefaults {
     my $inf = shift;
     # set default values
@@ -1092,8 +1103,8 @@ sub updateTmpfilesDotD {
         # Type Path          Mode UID  GID  Age
         # d    /var/run/user 0755 root root 10d
         # we don't use age
-        my $localrundir = set_path_attribute("@localrundir@", $inf->{slapd}->{localstatedir}, $inf->{General}->{prefix});
-        if( -d "$localrundir"){
+        my $localrundir = set_localrundir("@localrundir@", $inf->{General}->{prefix});
+        if( $localrundir != "" && -d "$localrundir"){
             $rundir = "$localrundir/@PACKAGE_NAME@";
             $lockdir = "$localrundir/lock/@PACKAGE_NAME@/slapd-$inf->{slapd}->{ServerIdentifier}";
             $parentdir = "$localrundir/lock/@PACKAGE_NAME@";