CVS User Account cvsuser
Tue Nov 7 08:08:41 PST 2006
Log Message:
-----------
Replace "print SLONIK" (which had a /tmp file security exploit) with
"$slonik .= ..."

Modified Files:
--------------
    slony1-engine/tools/altperl:
        slonik_init_cluster.pl (r1.4 -> r1.5)

-------------- next part --------------
Index: slonik_init_cluster.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slonik_init_cluster.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -Ltools/altperl/slonik_init_cluster.pl -Ltools/altperl/slonik_init_cluster.pl -u -w -r1.4 -r1.5
--- tools/altperl/slonik_init_cluster.pl
+++ tools/altperl/slonik_init_cluster.pl
@@ -30,29 +30,26 @@
 require '@@PGLIBDIR@@/slon-tools.pm';
 require $CONFIG_FILE;
 
-my $FILE="/tmp/init-cluster.$$";
-
 # INIT CLUSTER
-open(SLONIK, ">", $FILE);
-print SLONIK "\n# INIT CLUSTER\n";
-print SLONIK genheader();
+$slonik .=  "\n# INIT CLUSTER\n";
+$slonik .=  genheader();
 my ($dbname, $dbhost) = ($DBNAME[$MASTERNODE], $HOST[$MASTERNODE]);
-print SLONIK "  init cluster (id = $MASTERNODE, comment = 'Node $MASTERNODE - $dbname\@$dbhost');\n";
+$slonik .=  "  init cluster (id = $MASTERNODE, comment = 'Node $MASTERNODE - $dbname\@$dbhost');\n";
 
 # STORE NODE
-print SLONIK "\n# STORE NODE\n";
+$slonik .=  "\n# STORE NODE\n";
 foreach my $node (@NODES) {
   if ($node != $MASTERNODE) {		# skip the master node; it's already initialized!
     my ($dbname, $dbhost) = ($DBNAME[$node], $HOST[$node]);
-    print SLONIK "  store node (id = $node, event node = $MASTERNODE, comment = 'Node $node - $dbname\@$dbhost');\n";
+    $slonik .=  "  store node (id = $node, event node = $MASTERNODE, comment = 'Node $node - $dbname\@$dbhost');\n";
   }
 }
-print SLONIK "  echo 'Set up replication nodes';\n";
+$slonik .=  "  echo 'Set up replication nodes';\n";
 
 # STORE PATH
-print SLONIK "\n# STORE PATH\n";
+$slonik .=  "\n# STORE PATH\n";
 
-print SLONIK "  echo 'Next: configure paths for each node/origin';\n";
+$slonik .=  "  echo 'Next: configure paths for each node/origin';\n";
 foreach my $nodea (@NODES) {
   my $dsna = $DSN[$nodea];
   foreach my $nodeb (@NODES) {
@@ -72,7 +69,6 @@
   }
 }
 
-print SLONIK "  echo 'Replication nodes prepared';\n";
-print SLONIK "  echo 'Please start a slon replication daemon for each node';\n";
-close SLONIK;
-run_slonik_script($FILE);
+$slonik .=  "  echo 'Replication nodes prepared';\n";
+$slonik .=  "  echo 'Please start a slon replication daemon for each node';\n";
+run_slonik_script($slonik, 'INIT CLUSTER');



More information about the Slony1-commit mailing list