X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Fgenerate-raddb;h=c8843abcf224d14b8b5853aa8aaf02b9eb4d5af1;hb=6e3d4bcc2f5d193bc157ffcaa5c634cd475cebe7;hp=e9580d64570c97841bedb1b252126db0e83b9beb;hpb=3beb58199322355f8caa166000bb94e9419b4232;p=freeside.git diff --git a/bin/generate-raddb b/bin/generate-raddb index e9580d645..c8843abcf 100755 --- a/bin/generate-raddb +++ b/bin/generate-raddb @@ -1,8 +1,7 @@ #!/usr/bin/perl # usage: generate-raddb radius-server/raddb/dictionary* >raddb.pm -# i.e.: generate-raddb ~/src/freeradius-0.2/raddb/dictionary* >FS/raddb.pm - +# i.e.: generate-raddb ~/freeradius/freeradius-1.0.4/share/dictionary* /home/ivan/wirelessoceans/dictionary.ip3networks >raddb.pm.new print <) { next if /^(#|\s*$|\$INCLUDE\s+)/; next if /^(VALUE|VENDOR|BEGIN\-VENDOR|END\-VENDOR)\s+/; - /^(ATTRIBUTE|ATTRIB_NMC)\s+([\w\-]+)\s+/ or die $_; + /^(ATTRIBUTE|ATTRIB_NMC)\s+([\w\-\/]+)\s+/ or die $_; $attrib = $2; $dbname = lc($2); - $dbname =~ s/\-/_/g; + $dbname =~ s/[\-\/]/_/g; + $dbname = substr($dbname,0,24); + while ( exists $hash{$dbname} ) { + #warn $dbname; + $dbname =~ s/(.)$//; + my $w = $1; + $w =~ tr/_a-z0-9/a-z0-9_/; + $dbname = "$dbname$w"; + } $hash{$dbname} = $attrib; #print "$2\n"; } @@ -25,11 +32,15 @@ foreach ( keys %hash ) { # print "$_\n" if length($_)>24; # print substr($_,0,24),"\n" if length($_)>24; # $max = length($_) if length($_)>$max; -#everything >24 is still unique, at least with freeradius comprehensive dataset - print " '". substr($_,0,24). "' => '$hash{$_}'\n"; +# have to fudge things since everything >24 is *not* unique + + #print " '". substr($_,0,24). "' => '$hash{$_}',\n"; + print " '$_' => '$hash{$_}',\n"; } print <