3 # Convert old-style "clients" file to new "clients.conf" format.
5 # Usage: clients.pl clients [naslist] new-clients.conf
6 # The "new-clients.conf" will be created if it does not exist.
7 # If it does exist, it will be over-written.
12 if (($#ARGV < 1) || ($#ARGV > 2)) {
13 print "Usage: clients.pl clients [naslist] new-clients.conf\n";
14 print " The \"new-clients.conf\" will be created if it does not exist.\n";
15 print " If it does exist, it will be over-written.\n";
22 if ($new =~ /naslist/) {
27 open OLD, "< $old" or die "Failed to open $old: $!\n";
35 $clients{$_[0]}{"secret"} = $_[1];
39 if (defined $naslist) {
40 open OLD, "< $naslist" or die "Failed to open $naslist: $!\n";
48 if (!defined $clients{$_[0]}) {
49 print "WARNING! client $_[0] is defined in naslist, but not in clients!";
53 $clients{$_[0]}{"shortname"} = $_[1];
54 $clients{$_[0]}{"nastype"} = $_[2];
58 open NEW, "> $new" or die "Failed to open $new: $!\n";
59 foreach $client (keys %clients) {
60 print NEW "client $client {\n";
61 print NEW "\tsecret = ", $clients{$client}{"secret"}, "\n";
62 if (defined $clients{$client}{"shortname"}) {
63 print NEW "\tshortname = ", $clients{$client}{"shortname"}, "\n";
64 print NEW "\tnastype = ", $clients{$client}{"nastype"}, "\n";