Lib-PWQuality

 view release on metacpan or  search on metacpan

lib/Lib/PWQuality.pm  view on Meta::CPAN

package Lib::PWQuality;
our $AUTHORITY = 'cpan:XSAWYERX';
# ABSTRACT: Perl interface to the libpwquality C library
$Lib::PWQuality::VERSION = '0.002';
## no critic

use strict;
use warnings;
use experimental qw< signatures >;
use Ref::Util qw< is_ref is_hashref >;
use FFI::CheckLib 0.06 qw< find_lib_or_die >;
use FFI::Platypus;
use FFI::C;
use Carp ();

use constant {
   'SETTINGS_INT' => {
        'DIFF_OK'          => undef,
        'MIN_LENGTH'       => undef,
        'DIG_CREDIT'       => undef,
        'UP_CREDIT'        => undef,
        'LOW_CREDIT'       => undef,
        'OTH_CREDIT'       => undef,
        'MIN_CLASS'        => undef,
        'MAX_REPEAT'       => undef,
        'MAX_CLASS_REPEAT' => undef,
        'MAX_SEQUENCE'     => undef,
        'GECOS_CHECK'      => undef,
        'DICT_CHECK'       => undef,
        'USER_CHECK'       => undef,
        'USER_SUBSTR'      => undef,
        'ENFORCING'        => undef,
        'RETRY_TIMES'      => undef,
        'ENFORCE_ROOT'     => undef,
        'LOCAL_USERS'      => undef,
    },

    'SETTINGS_STR' => {
        'BAD_WORDS' => undef,
        'DICT_PATH' => undef,
    },

    'SETTINGS_ALL' => {
        'difok'            => undef,
        'minlen'           => undef,
        'dcredit'          => undef,
        'ucredit'          => undef,
        'lcredit'          => undef,
        'ocredit'          => undef,
        'minclass'         => undef,
        'maxrepeat'        => undef,
        'maxclassrepeat'   => undef,
        'maxsequence'      => undef,
        'gecoscheck'       => undef,
        'dictcheck'        => undef,
        'usercheck'        => undef,
        'usersubstr'       => undef,
        'enforcing'        => undef,
        'badwords'         => undef,
        'dictpath'         => undef,
        'retry'            => undef,
        'enforce_for_root' => undef,
        'local_users_only' => undef,
    },
};

my $ffi = FFI::Platypus->new( 'api' => 1 );
FFI::C->ffi($ffi);

$ffi->lib( find_lib_or_die( 'lib' => 'pwquality' ) );



( run in 2.454 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )