Fix defect 2832802 mkhwconn not properly working with password authentication
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4121 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
b0083d8d81
commit
78075854cc
@ -412,11 +412,17 @@ sub mkhwconn
|
||||
my ($user, $passwd);
|
||||
if ( exists $opt->{P})
|
||||
{
|
||||
($user, $passwd) = ('admin', $opt->{P});
|
||||
($user, $passwd) = ('HMC', $opt->{P});
|
||||
}
|
||||
else
|
||||
{
|
||||
($user, $passwd) = xCAT::PPCdb::credentials( $node_name, $type);
|
||||
($user, $passwd) = xCAT::PPCdb::credentials( $node_name, $type,'HMC');
|
||||
if ( !$passwd)
|
||||
{
|
||||
push @value, [$node_name, "Cannot get password of userid 'HMC'. Please check table 'passwd' or 'ppcdirect'.",1];
|
||||
next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $res = xCAT::PPCcli::mksysconn( $exp, $node_ip, $type, $passwd);
|
||||
|
@ -300,15 +300,29 @@ sub credentials {
|
||||
|
||||
my $server = shift;
|
||||
my $hwtype = shift;
|
||||
my $user = @{$logon{$hwtype}}[0];
|
||||
my $pass = @{$logon{$hwtype}}[1];
|
||||
my $user = shift;
|
||||
my $pass = undef;
|
||||
my $user_specified = $user;
|
||||
if ( !$user_specified or $user eq @{$logon{$hwtype}}[0])
|
||||
{
|
||||
$user = @{$logon{$hwtype}}[0];
|
||||
$pass = @{$logon{$hwtype}}[1];
|
||||
}
|
||||
|
||||
###########################################
|
||||
# Check passwd tab
|
||||
###########################################
|
||||
my $tab = xCAT::Table->new( 'passwd' );
|
||||
if ( $tab ) {
|
||||
my ($ent) = $tab->getAttribs( {key=>$hwtype}, qw(username password));
|
||||
my $ent;
|
||||
if ( $user_specified)
|
||||
{
|
||||
($ent) = $tab->getAttribs( {key=>$hwtype,username=>$user},qw(password));
|
||||
}
|
||||
else
|
||||
{
|
||||
($ent) = $tab->getAttribs( {key=>$hwtype}, qw(username password));
|
||||
}
|
||||
if ( $ent ) {
|
||||
if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
@ -319,7 +333,15 @@ sub credentials {
|
||||
##########################################
|
||||
$tab = xCAT::Table->new( $hcptab{$hwtype} );
|
||||
if ( $tab ) {
|
||||
my ($ent) = $tab->getAttribs( {hcp=>$server}, qw(username password));
|
||||
my $ent;
|
||||
if ( $user_specified)
|
||||
{
|
||||
($ent) = $tab->getAttribs( {hcp=>$server,username=>$user},qw(password));
|
||||
}
|
||||
else
|
||||
{
|
||||
($ent) = $tab->getAttribs( {hcp=>$server}, qw(username password));
|
||||
}
|
||||
if ( $ent){
|
||||
if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
@ -329,8 +351,18 @@ sub credentials {
|
||||
##############################################################
|
||||
elsif( ($ent) = $tab->getAttribs( {hcp=>$defaultgrp{$hwtype}}, qw(username password)))
|
||||
{
|
||||
if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
if ( $user_specified)
|
||||
{
|
||||
($ent) = $tab->getAttribs( {hcp=>$defaultgrp{$hwtype},username=>$user},qw(password));
|
||||
}
|
||||
else
|
||||
{
|
||||
($ent) = $tab->getAttribs( {hcp=>$defaultgrp{$hwtype}}, qw(username password));
|
||||
}
|
||||
if ( $ent){
|
||||
if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
}
|
||||
}
|
||||
}
|
||||
return( $user,$pass );
|
||||
|
Loading…
x
Reference in New Issue
Block a user