From be056ae2d087cd18a9ea73e17d435e211649e744 Mon Sep 17 00:00:00 2001 From: sjing Date: Tue, 24 Apr 2012 02:03:10 +0000 Subject: [PATCH] the fix for bug 3364300 - not display passwords in xcat commands or logs. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12319 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/pgsqlsetup | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xCAT-client/bin/pgsqlsetup b/xCAT-client/bin/pgsqlsetup index c1d10039e..c21093156 100755 --- a/xCAT-client/bin/pgsqlsetup +++ b/xCAT-client/bin/pgsqlsetup @@ -486,13 +486,18 @@ sub mkpgusers # set xcatadm id password $cmd = qq~echo "xcatadm:$::adminpassword" | /bin/chpasswd -c~; + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("E", " $cmd failed."); + xCAT::MsgUtils->message("E", " command failed."); exit(1); } + $::VERBOSE = $tmpv; } # @@ -841,14 +846,19 @@ sub createcfgloc } my $pgentry = "Pg:dbname=xcatdb;host=$::MN|xcatadm|$::adminpassword"; $cmd = "echo \"$pgentry\" > $cfgloc"; + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { - $message = "$cmd failed. Could not setup cfgloc"; + $message = "command failed. Could not setup cfgloc"; xCAT::MsgUtils->message("E", "$message"); exit(1); } + $::VERBOSE = $tmpv; # allow readonly by root chmod 0600, $cfgloc;