projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6361e71
)
add sha1_base64 password encryption option to acct_sql export
author
ivan
<ivan>
Fri, 10 Jun 2011 18:46:55 +0000
(18:46 +0000)
committer
ivan
<ivan>
Fri, 10 Jun 2011 18:46:55 +0000
(18:46 +0000)
FS/FS/part_export/acct_sql.pm
patch
|
blob
|
history
FS/FS/svc_acct.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_export/acct_sql.pm
b/FS/FS/part_export/acct_sql.pm
index
9f1ae7b
..
d561c80
100644
(file)
--- a/
FS/FS/part_export/acct_sql.pm
+++ b/
FS/FS/part_export/acct_sql.pm
@@
-23,7
+23,7
@@
tie my %options, 'Tie::IxHash',
},
'primary_key' => { label => 'Database primary key' },
'crypt' => { label => 'Password encryption',
},
'primary_key' => { label => 'Database primary key' },
'crypt' => { label => 'Password encryption',
- type=>'select', options=>[qw(crypt md5)],
+ type=>'select', options=>[qw(crypt md5
sha1_base64
)],
default=>'crypt',
},
;
default=>'crypt',
},
;
diff --git
a/FS/FS/svc_acct.pm
b/FS/FS/svc_acct.pm
index
a901f3b
..
8e58315
100644
(file)
--- a/
FS/FS/svc_acct.pm
+++ b/
FS/FS/svc_acct.pm
@@
-2676,12
+2676,12
@@
sub crypt_password {
my $encryption = ( scalar(@_) && $_[0] ) ? shift : 'crypt';
if ( $encryption eq 'crypt' ) {
my $encryption = ( scalar(@_) && $_[0] ) ? shift : 'crypt';
if ( $encryption eq 'crypt' ) {
- crypt(
+
return
crypt(
$self->_password,
$saltset[int(rand(64))].$saltset[int(rand(64))]
);
} elsif ( $encryption eq 'md5' ) {
$self->_password,
$saltset[int(rand(64))].$saltset[int(rand(64))]
);
} elsif ( $encryption eq 'md5' ) {
- unix_md5_crypt( $self->_password );
+
return
unix_md5_crypt( $self->_password );
} elsif ( $encryption eq 'blowfish' ) {
croak "unknown encryption method $encryption";
} else {
} elsif ( $encryption eq 'blowfish' ) {
croak "unknown encryption method $encryption";
} else {
@@
-2689,7
+2689,7
@@
sub crypt_password {
}
} elsif ( $self->_password =~ /^\{CRYPT\}(.+)$/ ) {
}
} elsif ( $self->_password =~ /^\{CRYPT\}(.+)$/ ) {
- $1;
+
return
$1;
}
} elsif ( $self->_password_encoding eq 'crypt' ) {
}
} elsif ( $self->_password_encoding eq 'crypt' ) {
@@
-2702,12
+2702,16
@@
sub crypt_password {
my $encryption = ( scalar(@_) && $_[0] ) ? shift : 'crypt';
if ( $encryption eq 'crypt' ) {
my $encryption = ( scalar(@_) && $_[0] ) ? shift : 'crypt';
if ( $encryption eq 'crypt' ) {
- crypt(
+
return
crypt(
$self->_password,
$saltset[int(rand(64))].$saltset[int(rand(64))]
);
} elsif ( $encryption eq 'md5' ) {
$self->_password,
$saltset[int(rand(64))].$saltset[int(rand(64))]
);
} elsif ( $encryption eq 'md5' ) {
- unix_md5_crypt( $self->_password );
+ return unix_md5_crypt( $self->_password );
+ } elsif ( $encryption eq 'sha1_base64' ) { #for acct_sql
+ my $pass = sha1_base64( $self->_password );
+ $pass .= '=' x (4 - length($pass) % 4); #properly padded base64
+ return $pass;
} elsif ( $encryption eq 'blowfish' ) {
croak "unknown encryption method $encryption";
} else {
} elsif ( $encryption eq 'blowfish' ) {
croak "unknown encryption method $encryption";
} else {
@@
-2728,12
+2732,12
@@
sub crypt_password {
my $encryption = ( scalar(@_) && $_[0] ) ? shift : 'crypt';
if ( $encryption eq 'crypt' ) {
my $encryption = ( scalar(@_) && $_[0] ) ? shift : 'crypt';
if ( $encryption eq 'crypt' ) {
- crypt(
+
return
crypt(
$self->_password,
$saltset[int(rand(64))].$saltset[int(rand(64))]
);
} elsif ( $encryption eq 'md5' ) {
$self->_password,
$saltset[int(rand(64))].$saltset[int(rand(64))]
);
} elsif ( $encryption eq 'md5' ) {
- unix_md5_crypt( $self->_password );
+
return
unix_md5_crypt( $self->_password );
} elsif ( $encryption eq 'blowfish' ) {
croak "unknown encryption method $encryption";
} else {
} elsif ( $encryption eq 'blowfish' ) {
croak "unknown encryption method $encryption";
} else {