diff options
author | ivan <ivan> | 2001-09-11 22:20:28 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-09-11 22:20:28 +0000 |
commit | cf7ca698138c8708c68cb969cc843311e385a7a8 (patch) | |
tree | c157eacef4b8974980a404d0cb8c3c70adc07849 /bin | |
parent | cb69afd435095144bea83565973561045e28c6a6 (diff) |
fix radius attribute adding
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fs-radius-add-check | 17 | ||||
-rwxr-xr-x | bin/fs-radius-add-reply | 16 | ||||
-rwxr-xr-x | bin/fs-setup | 4 | ||||
-rwxr-xr-x | bin/svc_acct.export | 4 |
4 files changed, 22 insertions, 19 deletions
diff --git a/bin/fs-radius-add-check b/bin/fs-radius-add-check index eedd9b699..ca0492f4c 100755 --- a/bin/fs-radius-add-check +++ b/bin/fs-radius-add-check @@ -10,7 +10,7 @@ use FS::raddb; die "Not running uid freeside!" unless checkeuid(); my %attrib2db = - map { $FS::raddb::attrib{lc($_)} => $_ } keys %FS::raddb::attrib; + map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; my $user = shift or die &usage; getsecrets($user); @@ -39,14 +39,16 @@ my($char_d) = 80; #default maxlength for text fields ### foreach my $attribute ( @attributes ) { - foreach my $statement ( - "ALTER TABLE svc_acct ADD rc_$attribute varchar($char_d) NULL", -# "ALTER TABLE part_svc ADD svc_acct__rc_$attribute varchar($char_d) NULL;", -# "ALTER TABLE part_svc ADD svc_acct__rc_${attribute}_flag char(1) NULL;", - ) { - $dbh->do( $statement ) or warn "Error executing $statement: ". $dbh->errstr; } + my $statement = + "ALTER TABLE svc_acct ADD COLUMN rc_$attribute varchar($char_d) NULL"; + my $sth = $dbh->prepare( $statement ) + or warn "Error preparing $statement: ". $dbh->errstr; + my $rc = $sth->execute + or warn "Error executing $statement: ". $sth->errstr; } +$dbh->commit or die $dbh->errstr; + $dbh->disconnect or die $dbh->errstr; print "\n\n", "Now you must run dbdef-create.\n\n"; @@ -55,4 +57,3 @@ sub usage { die "Usage:\n fs-radius-add user\n"; } - diff --git a/bin/fs-radius-add-reply b/bin/fs-radius-add-reply index d2f2e11f0..2f38fbcf7 100755 --- a/bin/fs-radius-add-reply +++ b/bin/fs-radius-add-reply @@ -10,7 +10,7 @@ use FS::raddb; die "Not running uid freeside!" unless checkeuid(); my %attrib2db = - map { $FS::raddb::attrib{lc($_)} => $_ } keys %FS::raddb::attrib; + map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; my $user = shift or die &usage; getsecrets($user); @@ -39,14 +39,16 @@ 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 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; } + 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 + or warn "Error executing $statement: ". $sth->errstr; } +$dbh->commit or die $dbh->errstr; + $dbh->disconnect or die $dbh->errstr; print "\n\n", "Now you must run dbdef-create.\n\n"; diff --git a/bin/fs-setup b/bin/fs-setup index 9534eb23f..e7dda8ed7 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.57 2001-09-11 00:07:30 ivan Exp $ +# $Id: fs-setup,v 1.58 2001-09-11 22:20:28 ivan Exp $ #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } @@ -20,7 +20,7 @@ use FS::raddb; die "Not running uid freeside!" unless checkeuid(); my %attrib2db = - map { $FS::raddb::attrib{lc($_)} => $_ } keys %FS::raddb::attrib; + map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; my $user = shift or die &usage; getsecrets($user); diff --git a/bin/svc_acct.export b/bin/svc_acct.export index a5ec45d48..3b8853bb0 100755 --- a/bin/svc_acct.export +++ b/bin/svc_acct.export @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# $Id: svc_acct.export,v 1.23 2001-08-17 10:57:40 ivan Exp $ +# $Id: svc_acct.export,v 1.24 2001-09-11 22:20:28 ivan Exp $ # # Create and export password, radius and vpopmail password files: # passwd, passwd.adjunct, shadow, acp_passwd, acp_userinfo, acp_dialup @@ -56,7 +56,7 @@ my $icradius_mysqlsource = my $icradius_dbh; if ( $icradiusmachines && $conf->exists('icradius_secrets') ) { $icradius_dbh = DBI->connect($conf->config('icradius_secrets')) - or die $DBI::errstr;; + or die $DBI::errstr; } else { $icradius_dbh = dbh; } |