#! /usr/bin/perl # fixscript will replace this line with require innshellvars.pl # Example wrapper nnrpd_access.pl for support of old perl authentication # scripts, by Erik Klavon. # This file contains a sample perl script which can be used to # duplicate the behavior of the old nnrpperlauth functionality. This # script only supports access control. # How to use this wrapper: # - append your old script to this file with two changes: # - rename the old "auth_init" sub to "old_auth_init" # - rename the old "authenticate" sub to "old_authenticate" # access # This sub modifies the global hash attributes so that it has all the # entries required in the old way of doing things, calls # old_authenticate, and creates a return hash with the right attributes. sub access { # Comment this out if you don't need auth_init. old_auth_init(); $attributes{type} = "connect"; my @connect_array = old_authenticate(); my %hash; # handle max rate if ($connect_array[4]) { # Force perl to make a C string out of this integer, # or else bad things will happen. Sigh. $hash{"max_rate"} = $connect_array[4] . "\0"; } # handle read boolean, set to wildmat if ($connect_array[1]) { $hash{"read"} = $connect_array[3]; } # handle post boolean, set to wildmat if ($connect_array[2]) { $hash{"post"} = $connect_array[3]; } return %hash; }