X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Ffs-radius-add-reply;h=c6c24e039cdaf0ae3acef748f57d893b211e9a2e;hp=6b9a39e49491960e7370a49ffe34e4188afb0561;hb=51f97ec141f77064ca020634e7eccd85d9ead753;hpb=c348097ed3e8864cfd7cc58c94c1457067a0bd2c diff --git a/bin/fs-radius-add-reply b/bin/fs-radius-add-reply index 6b9a39e49..c6c24e039 100755 --- a/bin/fs-radius-add-reply +++ b/bin/fs-radius-add-reply @@ -1,20 +1,18 @@ #!/usr/bin/perl -Tw # quick'n'dirty hack of fs-setup to add radius attributes +# (i'm not sure this even works in the new world of schema changes - everyone +# uses attributes via groups now) use strict; use DBI; -use FS::UID qw(adminsuidsetup checkeuid getsecrets); +use FS::UID qw(adminsuidsetup); use FS::raddb; -die "Not running uid freeside!" unless checkeuid(); - my %attrib2db = map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; my $user = shift or die &usage; -getsecrets($user); - my $dbh = adminsuidsetup $user; ### @@ -39,12 +37,21 @@ my($char_d) = 80; #default maxlength for text fields ### foreach my $attribute ( @attributes ) { + my $statement = "ALTER TABLE svc_acct ADD COLUMN radius_$attribute varchar($char_d) NULL"; my $sth = $dbh->prepare( $statement ) or warn "Error preparing $statement: ". $dbh->errstr; - $sth->execute + my $rc = $sth->execute or warn "Error executing $statement: ". $sth->errstr; + + $statement = + "ALTER TABLE h_svc_acct ADD COLUMN radius_$attribute varchar($char_d) NULL"; + $sth = $dbh->prepare( $statement ) + or warn "Error preparing $statement: ". $dbh->errstr; + $rc = $sth->execute + or warn "Error executing $statement: ". $sth->errstr; + } $dbh->commit or die $dbh->errstr;