summaryrefslogtreecommitdiff
path: root/bin/fs-radius-add-reply
diff options
context:
space:
mode:
authorivan <ivan>2000-07-06 08:57:28 +0000
committerivan <ivan>2000-07-06 08:57:28 +0000
commit61fc4e61c6644d2e0abdffe8cbdfafd4b092e84b (patch)
tree8945c8d68f503da4f9fe6952d31b983c11b72a1d /bin/fs-radius-add-reply
parentab67932df5b5999bcc0a94b3020bba7f57dd4980 (diff)
support for radius check attributes (except importing). poorly documented.
Diffstat (limited to 'bin/fs-radius-add-reply')
-rwxr-xr-xbin/fs-radius-add-reply53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/fs-radius-add-reply b/bin/fs-radius-add-reply
new file mode 100755
index 000000000..23a8d78a3
--- /dev/null
+++ b/bin/fs-radius-add-reply
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -Tw
+
+# quick'n'dirty hack of fs-setup to add radius attributes
+
+use strict;
+use DBI;
+use FS::UID qw(adminsuidsetup checkeuid getsecrets);
+die "Not running uid freeside!" unless checkeuid();
+
+my $user = shift or die &usage;
+getsecrets($user);
+
+my $dbh = adminsuidsetup $user;
+
+###
+
+print "\n\n", <<END, ":";
+Enter the additional RADIUS reply attributes you need to track for
+each user, separated by whitespace.
+END
+my @attributes = map { s/\-/_/g; $_; } split(" ",&getvalue);
+
+sub getvalue {
+ my($x)=scalar(<STDIN>);
+ chop $x;
+ $x;
+}
+
+###
+
+my($char_d) = 80; #default maxlength for text fields
+
+###
+
+foreach my $attribute ( @attributes ) {
+ foreach my $statement (
+ "ALTER TABLE svc_acct ADD radius_$attribute varchar($char_d) NULL",
+ "ALTER TABLE svc_acct ADD radius_$attribute varchar($char_d) NULL",
+ "ALTER TABLE part_svc ADD svc_acct__radius_$attribute varchar($char_d) NULL;",
+ "ALTER TABLE part_svc ADD svc_acct__radius_${attribute}_flag char(1) NULL;",
+ ) {
+ $dbh->do( $statement ) or warn "Error executing $statement: ". $dbh->errstr; }
+}
+
+$dbh->disconnect or die $dbh->errstr;
+
+print "\n\n", "Now you must run dbdef-create.\n\n";
+
+sub usage {
+ die "Usage:\n fs-radius-add user\n";
+}
+
+