You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2014/11/18 22:30:32 UTC

svn commit: r1640430 - in /vcl/trunk/managementnode/lib/VCL: Module/OS/Linux.pm utils.pm

Author: fapeeler
Date: Tue Nov 18 21:30:31 2014
New Revision: 1640430

URL: http://svn.apache.org/r1640430
Log:
VCL-797

some chars were causing issues, especially if in certain sequence, for now if special char is enabled - tacking one on the end

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1640430&r1=1640429&r2=1640430&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Tue Nov 18 21:30:31 2014
@@ -1248,7 +1248,9 @@ sub changepasswd {
 		$password = getpw(15);
 	}
 	
-	my $command = "echo $password \| /usr/bin/passwd -f $username --stdin";
+	my $command = "echo -e '";
+	$command .= qq[$password];
+	$command .= "' \| /usr/bin/passwd -f $username --stdin";
 	my ($exit_status, $output) = $self->execute($command);
 	if (!defined($output)) {
 		notify($ERRORS{'WARNING'}, 0, "failed to run SSH command to set password for $username");

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1640430&r1=1640429&r2=1640430&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Tue Nov 18 21:30:31 2014
@@ -2380,20 +2380,21 @@ sub getpw {
 	$length = 6 if (!(defined($length)));
 
 	#Skip certain confusing chars like: iI1lL,0Oo Zz2
-	my @chars = ("A" .. "H", "J" .. "N", "P" .. "Y", "a" .. "h", "j" .."n","p" .. "y", "3" .. "9");
-	my @spchars = ("A" .. "H", "J" .. "N", "P" .. "Y", "a" .. "h", "j" .."n","p" .. "y", "3" .. "9","-","_","!","%","#","\$","@","+","=","{","}","<",">","?","&");
-	my @a = @chars;;
+	my @a = ("A" .. "H", "J" .. "N", "P" .. "Y", "a" .. "h", "j" .."n","p" .. "y", "3" .. "9");
+	my @spchars = ("-","_","\!","\%","\#","\$","\@","+","=","{","}","\?");
 
 	my $include_special_chars = $ENV{management_node_info}{INCLUDE_SPECIAL_CHARS};
-	if($include_special_chars) {
-		@a = @spchars;
-	}
 
 	my $b;
 	srand;
 	for (1 .. $length) {
 		$b .= $a[rand @a ];
 	}
+
+	if($include_special_chars) {
+		$b .= $spchars[rand @spchars];
+	}
+
 	return $b;
 
 } ## end sub getpw