3 # quick'n'dirty hack of fs-setup to add radius attributes
4 # (i'm not sure this even works in the new world of schema changes - everyone
5 # uses attributes via groups now)
9 use FS::UID qw(adminsuidsetup);
13 map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib;
15 my $user = shift or die &usage;
16 my $dbh = adminsuidsetup $user;
20 print "\n\n", <<END, ":";
21 Enter the additional RADIUS check attributes you need to track for
22 each user, separated by whitespace.
24 my @attributes = map { $attrib2db{lc($_)} or die "unknown attribute $_"; }
28 my($x)=scalar(<STDIN>);
35 my($char_d) = 80; #default maxlength for text fields
39 foreach my $attribute ( @attributes ) {
42 "ALTER TABLE svc_acct ADD COLUMN rc_$attribute varchar($char_d) NULL";
43 my $sth = $dbh->prepare( $statement )
44 or warn "Error preparing $statement: ". $dbh->errstr;
45 my $rc = $sth->execute
46 or warn "Error executing $statement: ". $sth->errstr;
49 "ALTER TABLE h_svc_acct ADD COLUMN rc_$attribute varchar($char_d) NULL";
50 $sth = $dbh->prepare( $statement )
51 or warn "Error preparing $statement: ". $dbh->errstr;
53 or warn "Error executing $statement: ". $sth->errstr;
57 $dbh->commit or die $dbh->errstr;
59 $dbh->disconnect or die $dbh->errstr;
61 print "\n\n", "Now you must run dbdef-create.\n\n";
64 die "Usage:\n fs-radius-add-check user\n";