fix for defect 3562802

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13670 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2012-08-30 16:05:33 +00:00
parent d0d45062f6
commit 1fdcfdb959
2 changed files with 44 additions and 2 deletions

View File

@ -205,20 +205,41 @@ if ($odbconly == 0)
{ # not just updating the odbc
if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password
{
my $pw= $ENV{'XCATMYSQLADMIN_PW'};
if ($pw =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
my $warning =
" The password in the env variable XCATMYSQLADMIN_PW is not alpha-numeric.";
xCAT::MsgUtils->message("E", $warning);
exit 1;
}
$::adminpassword = $ENV{'XCATMYSQLADMIN_PW'};
}
else # prompt for password
{
my $msg = "Input the password for xcatadmin in the MySQL database: ";
my $msg = "Input the alpha-numberic password for xcatadmin in the MySQL database: ";
xCAT::MsgUtils->message('I', "$msg");
`stty -echo`;
chop($::adminpassword = <STDIN>);
`stty echo`;
if ($::adminpassword =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
my $warning =
"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password.";
xCAT::MsgUtils->message("E", $warning);
exit 1;
}
}
if ($ENV{'XCATMYSQLROOT_PW'}) # input env sets the password
{
my $pw= $ENV{'XCATMYSQLROOT_PW'};
if ($pw =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
my $warning =
" The password in the env variable XCATMYSQLROOT_PW is not alpha-numeric.";
xCAT::MsgUtils->message("E", $warning);
exit 1;
}
$::rootpassword = $ENV{'XCATMYSQLROOT_PW'};
@ -231,6 +252,13 @@ if ($odbconly == 0)
`stty -echo`;
chop($::rootpassword = <STDIN>);
`stty echo`;
if ($::rootpassword =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
my $warning =
"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password.";
xCAT::MsgUtils->message("E", $warning);
exit 1;
}
}
}

View File

@ -211,14 +211,28 @@ if (($odbconly == 0) && ($xcatrunningpgsql == 0))
{ # not just updating the odbc and xcat not already running on pg
if ($ENV{'XCATPGPW'}) # passwd supplied
{
my $pw=$ENV{'XCATPGPW'};
if ($pw =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
my $warning =
"The password in the env variable XCATPGPW is not alpha-numeric.";
xCAT::MsgUtils->message("E", $warning);
exit 1;
}
$::adminpassword = $ENV{'XCATPGPW'};
} else {
my $msg = "Input the password for xcatadm userid: ";
my $msg = "Input the password for xcatadm id: ";
xCAT::MsgUtils->message('I', "$msg");
`stty -echo`;
chop($::adminpassword = <STDIN>);
`stty echo`;
if ($::adminpassword =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
my $warning =
"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password.";
xCAT::MsgUtils->message("E", $warning);
exit 1;
}
}
}