Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 32475a9030649d9e117f48680c154208 > files > 330

inn-2.6.3-1.mga7.armv7hl.rpm

#! /usr/bin/perl -w
use lib '/usr/share/perl5/vendor_perl'; use INN::Config;

# Example wrapper nnrpd_auth.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 authentication.

# 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"

use vars qw(%attributes);

# auth_init
# This sub simply calls old_auth_init
# Comment this out if you don't need auth_init

sub auth_init {
    old_auth_init();
}


# authenticate
# 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 transforms the return array into the new
# format.

sub authenticate {
    $attributes{type} = "authenticate";
    my @auth_array = old_authenticate();
    my @return_array;

    # copy return code
    $return_array[0] = $auth_array[0];

    # simple error report
    if ($auth_array[0] != 281) {
        $return_array[1] = "Perl authentication error!";
        return @return_array;
    } else {
        $return_array[1] = "";
    }

    return @return_array;
}