For Heimdal, you may use either the external password quality check
tool, installed as heimdal-strength, or the plugin as you choose. It
has been tested with Heimdal 1.2.1 and later, but has not recently been
- tested with versions prior to 1.5.
+ tested with versions prior to 7.0.
For MIT Kerberos, version 1.9 or higher is required for the password
quality plugin interface. MIT Kerberos does not support an external
For building a CDB or SQLite dictionary, use the provided
krb5-strength-wordlist program. For CDB dictionries, the cdb utility
must be on your PATH. For SQLite, the DBI and DBD::SQLite Perl modules
- are required. krb5-strength-wordlist requires Perl 5.006 or later.
+ are required. krb5-strength-wordlist requires Perl 5.010 or later.
For a word list to use as source for the dictionary, you can use
/usr/share/dict/words if it's available on your system, but it would be
For Heimdal, you may use either the external password quality check tool,
installed as heimdal-strength, or the plugin as you choose. It has been
tested with Heimdal 1.2.1 and later, but has not recently been tested with
-versions prior to 1.5.
+versions prior to 7.0.
For MIT Kerberos, version 1.9 or higher is required for the password
quality plugin interface. MIT Kerberos does not support an external
For building a CDB or SQLite dictionary, use the provided
`krb5-strength-wordlist` program. For CDB dictionries, the `cdb` utility
must be on your `PATH`. For SQLite, the DBI and DBD::SQLite Perl modules
-are required. `krb5-strength-wordlist` requires Perl 5.006 or later.
+are required. `krb5-strength-wordlist` requires Perl 5.010 or later.
For a word list to use as source for the dictionary, you can use
`/usr/share/dict/words` if it's available on your system, but it would be
For Heimdal, you may use either the external password quality check tool,
installed as heimdal-strength, or the plugin as you choose. It has been
tested with Heimdal 1.2.1 and later, but has not recently been tested with
-versions prior to 1.5.
+versions prior to 7.0.
For MIT Kerberos, version 1.9 or higher is required for the password
quality plugin interface. MIT Kerberos does not support an external
For building a CDB or SQLite dictionary, use the provided
`krb5-strength-wordlist` program. For CDB dictionries, the `cdb` utility
must be on your `PATH`. For SQLite, the DBI and DBD::SQLite Perl modules
-are required. `krb5-strength-wordlist` requires Perl 5.006 or later.
+are required. `krb5-strength-wordlist` requires Perl 5.010 or later.
For a word list to use as source for the dictionary, you can use
`/usr/share/dict/words` if it's available on your system, but it would be
# Declarations and configuration
##############################################################################
-require 5.006;
+require 5.010;
+use autodie;
use strict;
use warnings;
# Utility functions
##############################################################################
-# print with error checking and an explicit file handle.
+# say with error checking and an explicit file handle.
#
# $fh - Output file handle
# @args - Remaining arguments to print
#
# Returns: undef
# Throws: Text exception on output failure
-sub print_fh {
+sub say_fh {
my ($fh, @args) = @_;
- print {$fh} @args or croak('print failed');
+ say {$fh} @args or croak("say failed: $!");
return;
}
if (-f $tmp) {
die "$0: temporary output file $tmp already exists\n";
}
- open(my $tmp_fh, '>', $tmp)
- or die "$0: cannot create output file $tmp: $!\n";
+ open(my $tmp_fh, '>', $tmp);
# Walk through the input word list and write each word that passes the
# filter to the output file handle as CDB data.
chomp($word);
next if !$filter->($word);
my $length = length($word);
- print_fh($tmp_fh, "+$length,1:$word->1\n");
+ say_fh($tmp_fh, "+$length,1:$word->1");
}
# Add a trailing newline, required by the CDB data format, and close.
- print_fh($tmp_fh, "\n");
- close($tmp_fh) or die "$0: cannot write to temporary file $tmp: $!\n";
+ say_fh($tmp_fh, q{});
+ close($tmp_fh);
# Run cdb to turn the result into a CDB database. Ignore duplicate keys.
system($CDB, '-c', '-u', $output, $tmp) == 0
or die "$0: cdb -c failed\n";
# Remove the temporary file and return.
- unlink($tmp) or die "$0: cannot remove temporary file $tmp: $!\n";
+ unlink($tmp);
return;
}
# Throws: Text exception on output failure
sub write_wordlist {
my ($in_fh, $output, $filter) = @_;
- open(my $out_fh, '>', $output)
- or die "$0: cannot create output file $output: $!\n";
+ open(my $out_fh, '>', $output);
# Walk through the input word list and write each word that passes the
# filter to the output file handle.
while (defined(my $word = <$in_fh>)) {
chomp($word);
next if !$filter->($word);
- print_fh($out_fh, "$word\n");
+ say_fh($out_fh, $word);
}
# All done.
- close($out_fh) or die "$0: cannot write to output file $output: $!\n";
+ close($out_fh);
return;
}
Getopt::Long::config('bundling', 'no_ignore_case');
GetOptions(\%config, @options);
if ($config{manual}) {
- print_fh(\*STDOUT, "Feeding myself to perldoc, please wait...\n");
+ say_fh(\*STDOUT, 'Feeding myself to perldoc, please wait...');
exec('perldoc', '-t', $fullpath);
}
if (@ARGV != 1) {
my $filter = build_filter(\%config);
# Process the input file into either wordlist output or a CDB file.
-open(my $in_fh, '<', $input)
- or die "$0: cannot open input file $input: $!\n";
+open(my $in_fh, '<', $input);
if ($config{output}) {
write_wordlist($in_fh, $config{output}, $filter);
} elsif ($config{cdb}) {
} elsif ($config{sqlite}) {
write_sqlite($in_fh, $config{sqlite}, $filter);
}
-close($in_fh) or die "$0: cannot read all of input file $input: $!\n";
+close($in_fh);
# All done.
exit(0);