freeside/FS/FS svc_acct.pm,1.175,1.176
ivan
ivan at pouncequick.420.am
Tue Apr 19 23:41:45 PDT 2005
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv24208/FS/FS
Modified Files:
svc_acct.pm
Log Message:
add vpopmail defaults to acct_sql export
Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- svc_acct.pm 13 Apr 2005 10:54:54 -0000 1.175
+++ svc_acct.pm 20 Apr 2005 06:41:39 -0000 1.176
@@ -15,7 +15,7 @@
@saltset @pw_set );
use Carp;
use Fcntl qw(:flock);
-use Crypt::PasswdMD5;
+use Crypt::PasswdMD5 1.2;
use FS::UID qw( datasrc );
use FS::Conf;
use FS::Record qw( qsearch qsearchs fields dbh dbdef );
@@ -1273,11 +1273,18 @@
}
-=item crypt_password
+=item crypt_password [ DEFAULT_ENCRYPTION_TYPE ]
Returns an encrypted password, either by passing through an encrypted password
in the database or by encrypting a plaintext password from the database.
+The optional DEFAULT_ENCRYPTION_TYPE parameter can be set to I<crypt> (classic
+UNIX DES crypt), I<md5> (md5 crypt supported by most modern Linux and BSD
+distrubtions), or (eventually) I<blowfish> (blowfish hashing supported by
+OpenBSD, SuSE, other Linux distibutions with pam_unix2, etc.). The default
+encryption type is only used if the password is not already encrypted in the
+database.
+
=cut
sub crypt_password {
@@ -1288,10 +1295,19 @@
|| $self->_password =~ /^\$(1|2a?)\$/ ) {
$self->_password;
} else {
- crypt(
- $self->_password,
- $saltset[int(rand(64))].$saltset[int(rand(64))]
- );
+ my $encryption = scalar(@_) ? shift : 'crypt';
+ if ( $encryption eq 'crypt' ) {
+ crypt(
+ $self->_password,
+ $saltset[int(rand(64))].$saltset[int(rand(64))]
+ );
+ } elsif ( $encryption eq 'md5' ) {
+ unix_md5_crypt( $self->_password );
+ } elsif ( $encryption eq 'blowfish' ) {
+ die "unknown encryption method $encryption";
+ } else {
+ die "unknown encryption method $encryption";
+ }
}
}
More information about the freeside-commits
mailing list