Hi list,
just a small patch that creates INSERT statements for db use.
...if anyone needs it...
Cheers,
OoLee





--- create-users.pl.orig        2003-06-30 20:00:27.000000000 +0200
+++ create-users.pl     2003-07-17 15:02:57.000000000 +0200
@@ -3,12 +3,18 @@
 # Purpose:  create lots of random users and passes
 # for testing your radius server
 # Read doc/README.testing for more information
+# 2003-07: Added loop to create INSERTS for db-backends
+
+# Change here the name of the db table
+$authcheck_table = "radcheck";
 
 $passfile = "./passwd";
 $shadfile = "./shadow";
 $radfile = "./radius.test";
 $nocrypt = "./passwd.nocrypt";
 $users = "./radius.users";
+$sql = "./radius.users.sql";
+
 
 if($ARGV[0] eq "") {
        print "\n\tUsage:  $0  <number of users>\n\n";
@@ -24,6 +30,7 @@
 open(RAD, ">$radfile") || die "Can't open $radfile";
 open(NOCRYPT, ">$nocrypt") || die "Can't open $nocrypt";
 open(USERS, ">$users") || die "Can't open $users";
+open(SQL, ">$sql") || die "Can't open $sql";
 
 for ($num=0; $num<$numusers; $num++) {
        # generate username
@@ -51,6 +58,7 @@
        printf RAD  "User-Name=$username,
User-Password=$password,NAS-IP-Address=127.0.0.1,NAS-Port-Id=0\n\n";
        print NOCRYPT "$username:$password\n";
        print USERS "$username  Auth-Type:=Local,
User-Password==\"$password\"\n\tClass=\"0x$num\"\n\n";
+       print SQL "INSERT INTO $authcheck_table (username,attribute,op,value)
VALUES ('$username','User-Password','==','$password');\n";
 } 
        
 close(PASS);
@@ -58,4 +66,6 @@
 close(RAD);
 close(NOCRYPT);
 close(USERS);
+close(SQL);
+
 print "\nCreated $numusers random users and passwords\n\n";





- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to