diff options
author | ivan <ivan> | 2008-10-06 22:19:57 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-10-06 22:19:57 +0000 |
commit | bf7d40fce014b207d9f402c00f8088812b9c86ec (patch) | |
tree | d688c5ab6ebeea58a047afd2d8f6e710f098cef6 /FS | |
parent | cf99c427a62bc9bf870032d75d55dbe851acd8d7 (diff) |
make RADIUS password exports _password_encoding-aware so we export Password-With-Header when necessary
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/svc_acct.pm | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 554cd5e2e..41fe1ea51 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1426,8 +1426,9 @@ sub radius_check { ( $FS::raddb::attrib{lc($attrib)}, $self->getfield($column) ); } grep { /^rc_/ && $self->getfield($_) } fields( $self->table ); - my $password = $self->_password; - my $pw_attrib = length($password) <= 12 ? $radius_password : 'Crypt-Password'; $check{$pw_attrib} = $password; + + my($pw_attrib, $password) = $self->radius_password; + $check{$pw_attrib} = $password; my $cust_svc = $self->cust_svc; die "FATAL: no cust_svc record for svc_acct.svcnum ". $self->svcnum. "\n" @@ -1441,6 +1442,42 @@ sub radius_check { } +=item radius_password + +Returns a key/value pair containing the RADIUS attribute name and value +for the password. + +=cut + +sub radius_password { + my $self = shift; + + my($pw_attrib, $password); + if ( $self->_password_encoding eq 'ldap' ) { + + $pw_attrib = 'Password-With-Header'; + $password = $self->_password; + + } elsif ( $self->_password_encoding eq 'crypt' ) { + + $pw_attrib = 'Crypt-Password'; + $password = $self->_password; + + } elsif ( $self->_password_encoding eq 'plain' ) { + + $pw_attrib = $radius_password; #Cleartext-Password? man rlm_pap + + } else { + + $pw_attrib = length($password) <= 12 ? $radius_password : 'Crypt-Password'; + $password = $self->_password; + + } + + ($pw_attrib, $password); + +} + =item snapshot This method instructs the object to "snapshot" or freeze RADIUS check and |