1 package FS::part_export::broadband_sqlradius;
4 use vars qw($DEBUG @ISA %options %info $conf);
7 use FS::Record qw( dbh str2time_sql ); #qsearch qsearchs );
8 use FS::part_export::sqlradius qw(sqlradius_connect);
10 FS::UID->install_callback(sub { $conf = new FS::Conf });
12 @ISA = qw(FS::part_export::sqlradius);
16 tie %options, 'Tie::IxHash',
17 'datasrc' => { label=>'DBI data source ' },
18 'username' => { label=>'Database username' },
19 'password' => { label=>'Database password' },
20 'usergroup'=> { label => 'Group table',
22 options => [qw( radusergroup usergroup )],
24 # session report doesn't currently know about this export anyway
27 # label => 'Hide IP address on session reports',
29 'mac_as_password' => {
32 label => 'Use MAC address as password',
34 'radius_password' => { label=>'Fixed password' },
35 'ip_addr_as' => { label => 'Send IP address as',
36 default => 'Framed-IP-Address' },
39 label => 'Export RADIUS group attributes to this database',
44 'svc' => 'svc_broadband',
45 'desc' => 'Real-time export to SQL-backed RADIUS (such as FreeRadius) for broadband services',
46 'options' => \%options,
49 Real-time export of <b>radcheck</b>, <b>radreply</b>, and <b>usergroup</b>
50 tables to any SQL database for
51 <a href="http://www.freeradius.org/">FreeRADIUS</a>
52 or <a href="http://radius.innercite.com/">ICRADIUS</a>.
55 This export is for broadband service access control based on MAC address.
56 For a more typical RADIUS export, see sqlradius.
60 <a href="http://search.cpan.org/dist/DBI/DBI.pm#connect">DBI documentation</a>
62 <a href="http://search.cpan.org/search?mode=module&query=DBD%3A%3A">documentation for your DBD</a>
63 for the exact syntax of a DBI data source.
68 sub rebless { shift; }
71 my($self, $svc_broadband) = (shift, shift);
72 $svc_broadband->mac_addr;
76 my($self, $svc_broadband) = (shift, shift);
78 if ( length($self->option('ip_addr_as',1))
79 and length($svc_broadband->ip_addr) ) {
80 $reply{$self->option('ip_addr_as')} = $svc_broadband->ip_addr;
86 my($self, $svc_broadband) = (shift, shift);
87 my $password_attrib = $conf->config('radius-password') || 'Password';
89 if ( $self->option('mac_as_password') ) {
90 $check{$password_attrib} = $svc_broadband->mac_addr; #formatting?
92 elsif ( length( $self->option('radius_password',1)) ) {
93 $check{$password_attrib} = $self->option('radius_password');
98 sub _export_suspend {}
99 sub _export_unsuspend {}
101 sub update_svc {} #do nothing