From b0011320cc2c33233ee694c61903667d2d3d8e5b Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Mar 2004 22:32:02 +0000 Subject: [PATCH] don't re-encrypt password on replace also --- FS/FS/part_export/shellcommands.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index a4eb0a052..1eb0d8367 100644 --- a/FS/FS/part_export/shellcommands.pm +++ b/FS/FS/part_export/shellcommands.pm @@ -65,8 +65,10 @@ sub _export_command { || $svc_acct->_password =~ /^\$(1|2a?)\$/ ) { $crypt_password = $svc_acct->_password; } else { - $crypt_password = crypt( $svc_acct->_password, - $saltset[int(rand(64))].$saltset[int(rand(64))] ); + $crypt_password = crypt( + $svc_acct->_password, + $saltset[int(rand(64))].$saltset[int(rand(64))] + ); } $self->shellcommands_queue( $svc_acct->svcnum, @@ -92,9 +94,17 @@ sub _export_replace { $new_quoted_password = shell_quote $new__password; #new, better? $old_domain = $old->domain; $new_domain = $new->domain; - $new_crypt_password = ''; #surpress "used only once" warnings - $new_crypt_password = crypt( $new->_password, - $saltset[int(rand(64))].$saltset[int(rand(64))]); + + #eventuall should check a "password-encoding" field + if ( length($new->_password) == 13 + || $new->_password =~ /^\$(1|2a?)\$/ ) { + $new_crypt_password = $new->_password; + } else { + $new_crypt_password = + crypt( $new->_password, $saltset[int(rand(64))].$saltset[int(rand(64))] + ); + } + if ( $self->option('usermod_pwonly') ) { my $error = ''; if ( $old_username ne $new_username ) { -- 2.11.0