#!/usr/bin/perl -T

use strict;
use warnings;
use esmith::ConfigDB;
use esmith::util;

our $db = esmith::ConfigDB->open or
    die "Couldn't open configuration database (permissions problems?)";

my $strength = $db->get_prop('passwordstrength', 'Users');
my $password = <>;
chomp $password;

my $reason = esmith::util::validatePassword($password, $strength);

exit 0 if (lc($reason) eq "ok");
exit 1;
