X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Fshadow.reimport;h=7957011eb7bda839e92074cd73645cce00fd1273;hb=0d88ae3b3b809b79dfcead9479c47fe43b8558fa;hp=4c0b8e50f272317efb3f5cee3372639736c10772;hpb=91afc5dc28aba2dd6a56ca57dc0c0ff1f3e1a710;p=freeside.git diff --git a/bin/shadow.reimport b/bin/shadow.reimport index 4c0b8e50f..7957011eb 100755 --- a/bin/shadow.reimport +++ b/bin/shadow.reimport @@ -3,9 +3,12 @@ # -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); +use Getopt::Std; use Term::Query qw(query); use Net::SCP qw(iscp); use FS::UID qw(adminsuidsetup datasrc); @@ -13,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; @@ -35,7 +38,7 @@ die "No services with svcdb svc_acct!\n" unless %part_svc; print "\n\n", &menu_svc, "\n", <) { 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\*/;