diff -r b82a656f784e -r 63b7c7fcd0cb shared.pm --- a/shared.pm Tue Apr 14 14:47:51 2015 +0200 +++ b/shared.pm Fri Feb 24 14:31:58 2017 +0100 @@ -14,6 +14,7 @@ #use Cyrus::IMAP::Admin; use Text::Wrap; use password; +use Common; my $Cf; my ( $ldap, $ubase, $abase ); @@ -204,7 +205,7 @@ $modified++; } - if ( my $pw = _mkpw( $Cf->password ) ) { + if ( my $pw = Common::mkpw( $Cf->password ) ) { $e->replace( userPassword => $pw ); $modified++; } @@ -298,23 +299,6 @@ return keys %x; } -{ - my @pw; - - sub _mkpw($) { - my $in = $_[0]; - - return $in unless $in and $in eq "{pwgen}"; - - if ( !@pw ) { - chomp( @pw = `pwgen 8 10 2>/dev/null|| mkpasswd` ); - die "pwgen/mkpasswd: $!" if $?; - } - return shift @pw; - - } -} - 1; # vim:sts=4 sw=4 aw ai sm nohlsearch: