4612 Update script pgsqlsetup against PGSQL secure hole

This commit is contained in:
Lei Ai 2015-03-23 11:52:01 +08:00
parent 71d4dabbd4
commit 9f839cd82f

View File

@ -180,7 +180,8 @@ if ($::RUNCMD_RC != 0)
exit(1);
}
# check if 9.X release not built by us is installed, setup different
if (grep(/postgresql9/, @output)) { # postgresql 9.x
# SLES used default dir
if ( (grep(/postgresql9/, @output)) && ($::linuxos !~ /sles/) ){ # postgresql 9.x
# figure out which 9.x release and build path
my @parseout= split(/\-/, $output[0]);
my @ptflevel= split ("postgresql9",$parseout[0]);
@ -778,7 +779,7 @@ sub initpgdb
`$cmd`;
if ($::osname eq 'Linux')
{
$cmd = qq~ echo listen_addresses = \\'*\\' >> $pgconf~;
$cmd = qq~ echo listen_addresses = \\'localhost,$::MN\\' >> $pgconf~;
`$cmd`;
}
@ -986,7 +987,7 @@ sub setupxcatdb
$cmd = "/var/lib/pgsql/bin/psql -d $::dbname -U postgres";
} else { # Linux
$cmd = "$::pgcmddir/psql -d $::dbname -U postgres";
if ($debianflag){
if ( ($debianflag) || ($::linuxos =~ /sles/) ){
$cmd = "su - postgres -c '$::pgcmddir/psql -d $::dbname -U postgres'";
}
}