[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 7b4022b9ca7443fe12c1a21d354d9b329d84ee54
Mark Wells
mark at 420.am
Thu Aug 2 15:02:27 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via 7b4022b9ca7443fe12c1a21d354d9b329d84ee54 (commit)
from 7be7470ff6f590cb2c53c0e3d4b51fee60da900c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7b4022b9ca7443fe12c1a21d354d9b329d84ee54
Author: Mark Wells <mark at freeside.biz>
Date: Thu Aug 2 15:02:10 2012 -0700
fix some illegal RADIUS attributes during import, #18751
diff --git a/FS/FS/part_export/sqlradius.pm b/FS/FS/part_export/sqlradius.pm
index d7cd459..7213966 100644
--- a/FS/FS/part_export/sqlradius.pm
+++ b/FS/FS/part_export/sqlradius.pm
@@ -1160,6 +1160,7 @@ sub import_attrs {
SELECT groupname, attribute, op, value, \'C\' FROM radgroupcheck
UNION
SELECT groupname, attribute, op, value, \'R\' FROM radgroupreply';
+ my @fixes; # things that need to be changed on the radius db
foreach my $row ( @{ $dbh->selectall_arrayref($sql) } ) {
my ($groupname, $attrname, $op, $value, $attrtype) = @$row;
warn "$groupname.$attrname\n";
@@ -1181,6 +1182,20 @@ SELECT groupname, attribute, op, value, \'R\' FROM radgroupreply';
my $old = $a->{$attrname};
my $new;
+ if ( $attrtype eq 'R' ) {
+ # Freeradius tolerates illegal operators in reply attributes. We don't.
+ if ( !grep ($_ eq $op, FS::radius_attr->ops('R')) ) {
+ warn "$groupname.$attrname: changing $op to +=\n";
+ # Make a note to change it in the db
+ push @fixes, [
+ 'UPDATE radgroupreply SET op = \'+=\' WHERE groupname = ? AND attribute = ? AND op = ? AND VALUE = ?',
+ $groupname, $attrname, $op, $value
+ ];
+ # and import it correctly.
+ $op = '+=';
+ }
+ }
+
if ( defined $old ) {
# replace
$new = new FS::radius_attr {
@@ -1210,6 +1225,13 @@ SELECT groupname, attribute, op, value, \'R\' FROM radgroupreply';
}
$attrs_of{$groupname}->{$attrname} = $new;
} #foreach $row
+
+ foreach (@fixes) {
+ my ($sql, @args) = @$_;
+ my $sth = $dbh->prepare($sql);
+ $sth->execute(@args) or warn $sth->errstr;
+ }
+
return;
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_export/sqlradius.pm | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
More information about the freeside-commits
mailing list