#!/usr/bin/perl

($username, $dn, $credname, $retriever_policy, $renewer_policy) = @ARGV;
chomp($passphrase = <STDIN>);

use Crypt::Cracklib; # if missing, install with:
                     #   perl -MCPAN -e 'install Crypt::Cracklib'
$Crypt::Cracklib::DICT = '/usr/lib/cracklib_dict';

if ($renewer_policy && $passphrase eq "") {
    exit(0);			# allow empty passphrase for renewable creds
}

$reason = fascist_check($passphrase);
if ($reason ne "ok") {
    print $reason, "\n";
    exit(1);
}

exit(0);
