X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fshadow.reimport;h=7957011eb7bda839e92074cd73645cce00fd1273;hp=4cb68a58302f69ad6084405456077612756a7cb3;hb=2c112f32561f23f9c538ace00db46659ce16da32;hpb=44a98d88974faf787ba4f4264ee9532c86e19f1f diff --git a/bin/shadow.reimport b/bin/shadow.reimport index 4cb68a583..7957011eb 100755 --- a/bin/shadow.reimport +++ b/bin/shadow.reimport @@ -3,6 +3,8 @@ # -d: dry-run: make no changes # -r: replace: overwrite existing passwords (otherwise only "*" passwords will # be changed) +# -b: blowfish replace: overwrite existing passwords only if they are +# blowfish-encrypted use strict; use vars qw(%part_svc); @@ -14,8 +16,8 @@ use FS::Record qw(qsearch qsearchs); use FS::svc_acct; use FS::part_svc; -use vars qw($opt_d $opt_r); -getopts("dr"); +use vars qw($opt_d $opt_r $opt_b); +getopts("drb"); my $user = shift or die &usage; adminsuidsetup $user; @@ -34,17 +36,17 @@ $FS::svc_Common::noexport_hack = 1; die "No services with svcdb svc_acct!\n" unless %part_svc; print "\n\n", &menu_svc, "\n", <svc, sort keys %part_svc ). "\n"; @@ -75,8 +77,12 @@ while () { chop; my($username,$password)=split(/:/); - my @svc_acct = grep { $_->cust_svc->svcpart == $shell_svcpart } - qsearch('svc_acct', { 'username' => $username } ); +# my @svc_acct = grep { $_->cust_svc->svcpart == $shell_svcpart } +# qsearch('svc_acct', { 'username' => $username } ); + my @svc_acct = grep { + my $svcpart = $_->cust_svc->svcpart; + grep { $_ == $svcpart } @shell_svcpart; + } qsearch('svc_acct', { 'username' => $username } ); next unless @svc_acct; @@ -87,7 +93,13 @@ while () { my $svc_acct = shift @svc_acct; - next unless $svc_acct->_password eq '*' || $opt_r; + next unless $svc_acct->_password eq '*' + || $opt_r + || ( $opt_b && $svc_acct->_password =~ /^\$2a?\$/ ); + + next if $svc_acct->username eq 'root'; + + next if $password eq 'NP' || $password eq '*LK*'; next if $svc_acct->_password eq $password; next if $svc_acct->_password =~ /^\*SUSPENDED\*/;