summaryrefslogtreecommitdiff
path: root/bin/shadow.reimport
diff options
context:
space:
mode:
authorivan <ivan>2004-03-18 22:00:25 +0000
committerivan <ivan>2004-03-18 22:00:25 +0000
commit3b7030c2c7464c2a1b409cdc22fad4a593d4f231 (patch)
tree68f74b3fac3f0ed047b5496576df8499514a72b0 /bin/shadow.reimport
parentbb70dc0af47c15b8041ebc85b6eff234a26baa14 (diff)
add -b option
Diffstat (limited to 'bin/shadow.reimport')
-rwxr-xr-xbin/shadow.reimport10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/shadow.reimport b/bin/shadow.reimport
index 2fc90d7..7957011 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;
@@ -91,7 +93,9 @@ while (<SHADOW>) {
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';