diff options
| author | Rich Megginson <rmeggins@redhat.com> | 2010-05-25 12:15:18 -0600 |
|---|---|---|
| committer | Rich Megginson <rmeggins@redhat.com> | 2010-05-26 13:46:57 -0600 |
| commit | 8e6e74009c80a7032308657e71450cb5aed9483c (patch) | |
| tree | e7bb7a6b150b03ca0db65c397c4fec1c0d51c883 /ldap/admin/src/scripts/Setup.pm.in | |
| parent | caaa2b7c5fdab6d3bf8c3155f32020eae8fc82ce (diff) | |
Bug 593392 - setup-ds-admin.pl -k creates world readable file
https://bugzilla.redhat.com/show_bug.cgi?id=593392
Resolves: bug 593392
Bug Description: setup-ds-admin.pl -k creates world readable file
Reviewed by: thoger (Thanks!)
Branch: HEAD
Fix Description: Use umask to make sure we create a .inf file that is
only viewable by the user. In addition, only create the temp file and
filename when necessary. In some places, the code was creating a .inf
file on disk when it could just create one in memory. The code should
check to see if the Inf object has a file associated with it before
attemtping to unlink it. Make sure we do not unlink a .inf file given
with -f on the command line. If the user specified -k, always write to
a temp file using __temp__ as the keyword to tell Inf->write to generate
a temp file.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
Diffstat (limited to 'ldap/admin/src/scripts/Setup.pm.in')
| -rw-r--r-- | ldap/admin/src/scripts/Setup.pm.in | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/ldap/admin/src/scripts/Setup.pm.in b/ldap/admin/src/scripts/Setup.pm.in index 52300db0..753062db 100644 --- a/ldap/admin/src/scripts/Setup.pm.in +++ b/ldap/admin/src/scripts/Setup.pm.in @@ -52,9 +52,6 @@ use Exporter (); @EXPORT = qw($SILENT $EXPRESS $TYPICAL $CUSTOM); @EXPORT_OK = qw($SILENT $EXPRESS $TYPICAL $CUSTOM); -# tempfiles -use File::Temp qw(tempfile tempdir); - # hostname use Net::Domain qw(hostfqdn); @@ -66,8 +63,6 @@ use Mozilla::LDAP::LDIF; use Getopt::Long; -use File::Temp qw(tempfile tempdir); - use SetupLog; use DSUtil; use Inf; @@ -141,7 +136,6 @@ sub init { ); $self->{silent} = $silent; - $self->{inffile} = $inffile; $self->{keep} = $keep; $self->{preonly} = $preonly; $self->{update} = $update; @@ -149,18 +143,11 @@ sub init { $self->{logfile} = $logfile; $self->{log} = new SetupLog($self->{logfile}); # if user supplied inf file, use that to initialize - if (defined($self->{inffile})) { - $self->{inf} = new Inf($self->{inffile}); + if (defined($inffile)) { + $self->{inf} = new Inf($inffile); } else { $self->{inf} = new Inf; } - 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 |
