[389-commits] Branch 'Directory_Server_8_2_Branch' - admserv/newinst

Richard Allen Megginson rmeggins at fedoraproject.org
Wed May 26 20:12:34 UTC 2010


 admserv/newinst/src/AdminUtil.pm.in        |    8 ++++++--
 admserv/newinst/src/migrate-ds-admin.pl.in |   13 +++++++++----
 admserv/newinst/src/setup-ds-admin.pl.in   |    8 ++------
 3 files changed, 17 insertions(+), 12 deletions(-)

New commits:
commit 72cf3dd8909cb1030559ef5b4471f23e795295e0
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Tue May 25 12:18:46 2010 -0600

    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: Directory_Server_8_2_Branch
    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
    (cherry picked from commit a5eb7a659963dd92e4237c3a03431bd6880111a7)

diff --git a/admserv/newinst/src/AdminUtil.pm.in b/admserv/newinst/src/AdminUtil.pm.in
index 3360aa8..d3808cc 100644
--- a/admserv/newinst/src/AdminUtil.pm.in
+++ b/admserv/newinst/src/AdminUtil.pm.in
@@ -698,7 +698,9 @@ sub registerManyDSWithConfigDS {
 
     for my $inst (@instances) {
         my $instinf = createInfFromConfig("$configdir/$inst", $inst);
-        unlink($instinf->{filename});
+        if ($instinf->{filename}) {
+            unlink($instinf->{filename});
+        }
         $instinf->{General}->{ConfigDirectoryLdapURL} = 
             $inf->{General}->{ConfigDirectoryLdapURL};
         $instinf->{General}->{AdminDomain} = $inf->{General}->{AdminDomain};
@@ -738,7 +740,9 @@ sub registerScatteredDSWithConfigDS {
     for $configdir ( @configdirs ) {
         foreach my $dsinst ( @{$instances_ref->{$configdir}} ) {
             my $instinf = createInfFromConfig("$configdir/$dsinst", $dsinst);
-            unlink($instinf->{filename});
+            if ($instinf->{filename}) {
+                unlink($instinf->{filename});
+            }
             $instinf->{General}->{ConfigDirectoryLdapURL} = 
                 $inf->{General}->{ConfigDirectoryLdapURL};
             $instinf->{General}->{AdminDomain} = $inf->{General}->{AdminDomain};
diff --git a/admserv/newinst/src/migrate-ds-admin.pl.in b/admserv/newinst/src/migrate-ds-admin.pl.in
index dfb82e0..dddd6be 100644
--- a/admserv/newinst/src/migrate-ds-admin.pl.in
+++ b/admserv/newinst/src/migrate-ds-admin.pl.in
@@ -73,9 +73,14 @@ $mig->msg('end_dsadmin_migration');
 $mig->doExit(0);
 
 END {
-    if ($mig) {
-        if (!$mig->{keep}) {
-            unlink $mig->{inffile};
-        }
+    if ($mig and $mig->{keep}) {
+        $mig->{inf}->write("__temp__");
     }
 }
+
+# emacs settings
+# Local Variables:
+# mode:perl
+# indent-tabs-mode: nil
+# tab-width: 4
+# End:
diff --git a/admserv/newinst/src/setup-ds-admin.pl.in b/admserv/newinst/src/setup-ds-admin.pl.in
index 65c2d1a..edb0f2d 100644
--- a/admserv/newinst/src/setup-ds-admin.pl.in
+++ b/admserv/newinst/src/setup-ds-admin.pl.in
@@ -207,8 +207,6 @@ if (!defined($setup->{inf}->{General}->{SuiteSpotGroup})) {
 # for admin server too, since ServerAdminID is used by AdminUtil code
 AdminServer::setDefaults($setup);
 
-$setup->{inf}->write();
-
 my @errs;
 
 if (!$setup->{update}) {
@@ -305,10 +303,8 @@ if (!$setup->{reconfigas}) {
 $setup->doExit(0);
 
 END {
-    if ($setup) {
-        if (!$setup->{keep}) {
-            unlink $setup->{inffile};
-        }
+    if ($setup and $setup->{keep}) {
+        $setup->{inf}->write("__temp__");
     }
 }
 




More information about the 389-commits mailing list