From 5df49c99a8c9cb241910b2cf262d19bdbae1f612 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 7 Dec 2011 21:35:13 +0000 Subject: [PATCH] delimited MAC addresses, #15478 --- FS/FS/part_export/broadband_sqlradius.pm | 11 +++++++++-- FS/FS/svc_broadband.pm | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/FS/FS/part_export/broadband_sqlradius.pm b/FS/FS/part_export/broadband_sqlradius.pm index 9b6fbecbc..dc117b05c 100644 --- a/FS/FS/part_export/broadband_sqlradius.pm +++ b/FS/FS/part_export/broadband_sqlradius.pm @@ -26,6 +26,10 @@ tie %options, 'Tie::IxHash', # type => 'checkbox', # label => 'Hide IP address on session reports', # }, + 'mac_delimiter' => { + label => 'Separate MAC address octets with', + default => '-', + }, 'mac_as_password' => { type => 'checkbox', default => '1', @@ -69,7 +73,8 @@ sub rebless { shift; } sub export_username { my($self, $svc_broadband) = (shift, shift); - $svc_broadband->mac_addr; + my $mac_addr = $svc_broadband->mac_addr; + join( ($self->option('mac_delimiter',1) || ''), $mac_addr =~ /../g ); } sub radius_reply { @@ -87,7 +92,9 @@ sub radius_check { my $password_attrib = $conf->config('radius-password') || 'Password'; my %check; if ( $self->option('mac_as_password') ) { - $check{$password_attrib} = $svc_broadband->mac_addr; #formatting? + my $mac_addr = $svc_broadband->mac_addr; + $check{$password_attrib} = + join( ($self->option('mac_delimiter',1) || ''), $mac_addr =~ /../g ); } elsif ( length( $self->option('radius_password',1)) ) { $check{$password_attrib} = $self->option('radius_password'); diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm index 5469a66e3..2ac24e55b 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -347,6 +347,11 @@ sub check { my $lat_lower = $nw_coords ? 1 : -90; my $lon_upper = $nw_coords ? -1 : 180; + # remove delimiters + my $mac_addr = uc($self->get('mac_addr')); + $mac_addr =~ s/[-: ]//g; + $self->set('mac_addr', $mac_addr); + my $error = $self->ut_numbern('svcnum') || $self->ut_numbern('blocknum') -- 2.11.0