-Provide missing password generation function
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5519 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -615,4 +615,19 @@ sub sendmsg { | ||||
| #        waitforack($outfd); | ||||
|     $callback->($msg); | ||||
| } | ||||
| sub genpassword | ||||
| { | ||||
|  | ||||
|     #Generate a pseudo-random password of specified length | ||||
|     my $length     = shift; | ||||
|     my $password   = ''; | ||||
|     my $characters = | ||||
|       'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'; | ||||
|     srand;    #have to reseed, rand is not rand otherwise | ||||
|     while (length($password) < $length) | ||||
|     { | ||||
|         $password .= substr($characters, int(rand 63), 1); | ||||
|     } | ||||
|     return $password; | ||||
| } | ||||
| 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user