[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts Inf.pm, 1.2, 1.3 Setup.pm.in, 1.5, 1.6

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Wed Jun 20 14:40:26 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22246/ldapserver/ldap/admin/src/scripts

Modified Files:
	Inf.pm Setup.pm.in 
Log Message:
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server - Inf, ds_newinst.pl
Fix Description: Some minor cleanup:
1) Setup must not write to the user supplied inf file.  Setup uses the user supplied inf to initialize its cache, but creates a tempfile for writing.
2) When writing an Inf, preserve the continuation lines.
3) Added Noriko's fix for suffix generation to ds_newinst.pl
Platforms tested: RHEL4
Flag Day: No.
Doc impact: No.



Index: Inf.pm
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/Inf.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Inf.pm	19 Jun 2007 18:24:57 -0000	1.2
+++ Inf.pm	20 Jun 2007 14:40:24 -0000	1.3
@@ -131,7 +131,9 @@
         print $fh "[$name]\n";
         for my $key (keys %{$section}) {
             if (defined($section->{$key})) {
-                print $fh "$key = ", $section->{$key}, "\n";
+                my $val = $section->{$key};
+                $val =~ s/\n/\\\n/g; # make continuation lines
+                print $fh "$key = $val\n";
             }
         }
     }


Index: Setup.pm.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/Setup.pm.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Setup.pm.in	19 Jun 2007 23:24:58 -0000	1.5
+++ Setup.pm.in	20 Jun 2007 14:40:24 -0000	1.6
@@ -132,17 +132,17 @@
     $self->{preonly} = $preonly;
     $self->{logfile} = $logfile;
     $self->{log} = new SetupLog($self->{logfile});
-    if (!$self->{inffile}) {
-        my ($fh, $filename) = tempfile("setupXXXXXX", UNLINK => !$keep,
-                                       SUFFIX => ".inf", OPEN => 0,
-                                       DIR => File::Spec->tmpdir);
-        $self->{inffile} = $filename;
-        $self->{inf} = new Inf;
-        $self->{inf}->{filename} = $self->{inffile};
-    } else {
+    # if user supplied inf file, use that to initialize
+    if (defined($self->{inffile})) {
         $self->{inf} = new Inf($self->{inffile});
-        $self->{keep} = 1; # do not delete user supplied inf file
     }
+    my $fh;
+    # create a temp inf file for writing for other processes
+    # never overwrite the user supplied inf file
+    ($fh, $self->{inffile}) = tempfile("setupXXXXXX", UNLINK => !$keep,
+                                       SUFFIX => ".inf", OPEN => 0,
+                                       DIR => File::Spec->tmpdir);
+    $self->{inf}->{filename} = $self->{inffile};
 
     # see if user passed in default inf values - also, command line
     # arguments override those passed in via an inf file - this
@@ -157,6 +157,8 @@
         }
     }
 
+    # this is the base config directory - the directory containing
+    # the slapd-instance instance specific config directories
     $self->{configdir} = $ENV{DS_CONFIG_DIR} || "@instconfigdir@";
 
     $self = bless $self, $type;




More information about the Fedora-directory-commits mailing list