Fix passwords to have even length
authorAlan T. DeKok <aland@freeradius.org>
Fri, 2 Oct 2009 08:52:44 +0000 (10:52 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 2 Oct 2009 08:52:44 +0000 (10:52 +0200)
scripts/create-users.pl

index c3f681a..36d6f8a 100755 (executable)
@@ -46,6 +46,9 @@ for ($num=0; $num<$numusers; $num++) {
                $password .= $char;
        }
 
+       if (length($num)%2==1) {
+           $num="0".$num;
+       }
        printf PASS "$username:%s:1001:1001:Name:/dev/null:/dev/null\n", crypt($password, $password);
        printf SHAD "$username:%s:1000:0:99999:7:::\n", crypt($password, $password);
        printf RAD  "User-Name=$username, User-Password=$password,NAS-IP-Address=127.0.0.1,NAS-Port-Id=0\n\n";