From: ivan Date: Mon, 6 Oct 2008 22:19:57 +0000 (+0000) Subject: make RADIUS password exports _password_encoding-aware so we export Password-With... X-Git-Tag: root_of_webpay_support~334 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=bf7d40fce014b207d9f402c00f8088812b9c86ec make RADIUS password exports _password_encoding-aware so we export Password-With-Header when necessary --- 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