Sophie

Sophie

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

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

use vars qw(%attributes);

# 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;    
}