diff options
author | Rich Megginson <rmeggins@redhat.com> | 2007-06-20 14:40:24 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2007-06-20 14:40:24 +0000 |
commit | 33f1e8722d417463e80f5f0ef1a5915427472393 (patch) | |
tree | 6bb2f1aec5f3632ae24470850dd4aa0e02913923 | |
parent | 4f756867c628ae34811c055fdcc13fc82cacf0db (diff) | |
download | ds-33f1e8722d417463e80f5f0ef1a5915427472393.tar.gz ds-33f1e8722d417463e80f5f0ef1a5915427472393.tar.xz ds-33f1e8722d417463e80f5f0ef1a5915427472393.zip |
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.
-rw-r--r-- | ldap/admin/src/ds_newinst.pl.in | 1 | ||||
-rw-r--r-- | ldap/admin/src/scripts/Inf.pm | 4 | ||||
-rw-r--r-- | ldap/admin/src/scripts/Setup.pm.in | 20 |
3 files changed, 15 insertions, 10 deletions
diff --git a/ldap/admin/src/ds_newinst.pl.in b/ldap/admin/src/ds_newinst.pl.in index 974e14c1..739f7a2a 100644 --- a/ldap/admin/src/ds_newinst.pl.in +++ b/ldap/admin/src/ds_newinst.pl.in @@ -217,6 +217,7 @@ if (!$table{slapd}->{RootDN}) { if (!$table{slapd}->{Suffix}) { my $suffix = $table{General}->{FullMachineName}; # convert fqdn to dc= domain components + $suffix =~ s/^[^\.]*\.//; # just the domain part $suffix = "dc=$suffix"; $suffix =~ s/\./, dc=/g; $table{slapd}->{Suffix} = $suffix; diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm index 4c6bd2c6..27a840ad 100644 --- a/ldap/admin/src/scripts/Inf.pm +++ b/ldap/admin/src/scripts/Inf.pm @@ -131,7 +131,9 @@ sub writeSection { 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"; } } } diff --git a/ldap/admin/src/scripts/Setup.pm.in b/ldap/admin/src/scripts/Setup.pm.in index dd2b5b64..48ca474e 100644 --- a/ldap/admin/src/scripts/Setup.pm.in +++ b/ldap/admin/src/scripts/Setup.pm.in @@ -132,17 +132,17 @@ sub new { $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 @@ sub new { } } + # 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; |