1#! /usr/bin/perl -w 2# fixscript will replace this line with code to load INN::Config 3 4# Example wrapper nnrpd_auth.pl for support of old perl authentication 5# scripts, by Erik Klavon. 6 7# This file contains a sample perl script which can be used to 8# duplicate the behavior of the old nnrpperlauth functionality. This 9# script only supports authentication. 10 11# How to use this wrapper: 12# - append your old script to this file with two changes: 13# - rename the old "auth_init" sub to "old_auth_init" 14# - rename the old "authenticate" sub to "old_authenticate" 15 16use vars qw(%attributes); 17 18# auth_init 19# This sub simply calls old_auth_init 20# Comment this out if you don't need auth_init 21 22sub auth_init { 23 old_auth_init(); 24} 25 26 27# authenticate 28# This sub modifies the global hash attributes so that it has all the 29# entries required in the old way of doing things, calls 30# old_authenticate, and transforms the return array into the new 31# format. 32 33sub authenticate { 34 $attributes{type} = "authenticate"; 35 my @auth_array = old_authenticate(); 36 my @return_array; 37 38 # copy return code 39 $return_array[0] = $auth_array[0]; 40 41 # simple error report 42 if ($auth_array[0] != 281) { 43 $return_array[1] = "Perl authentication error!"; 44 return @return_array; 45 } else { 46 $return_array[1] = ""; 47 } 48 49 return @return_array; 50} 51