X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Fsvc_acct.import;h=512572251618f99791df53c1f40dbe0f8ae86127;hb=f779b20addd7e1507b4f521cd462ea4de87ae926;hp=c4b8c5ec5111a34d721ddaec0b28d70d8018f911;hpb=b6240dad0a01e7495142193d4825fb9cf7963f3d;p=freeside.git diff --git a/bin/svc_acct.import b/bin/svc_acct.import index c4b8c5ec5..512572251 100755 --- a/bin/svc_acct.import +++ b/bin/svc_acct.import @@ -1,5 +1,7 @@ #!/usr/bin/perl -Tw # +# $Id: svc_acct.import,v 1.5 1999-03-25 08:42:19 ivan Exp $ +# # ivan@sisd.com 98-mar-9 # # changed 'password' field to '_password' because PgSQL 6.3 reserves this word @@ -13,19 +15,35 @@ # arbitrary radius attributes ivan@sisd.com 98-aug-9 # # don't import /var/spool/freeside/conf/shells! ivan@sisd.com 98-aug-13 +# +# $Log: svc_acct.import,v $ +# Revision 1.5 1999-03-25 08:42:19 ivan +# import stuff uses Term::Query and spits out (some kinds of) nonsensical input +# +# Revision 1.4 1999/03/24 00:43:38 ivan +# die if no relevant services +# +# Revision 1.3 1998/12/10 07:23:16 ivan +# use FS::Conf, need user (for datasrc) +# +# Revision 1.2 1998/10/13 12:07:51 ivan +# Assigns password from the shadow file for RADIUS password "UNIX" +# use strict; use vars qw(%part_svc); use Date::Parse; +use Term::Query qw(query); use FS::SSH qw(iscp); -use FS::UID qw(adminsuidsetup); +use FS::UID qw(adminsuidsetup datasrc); use FS::Record qw(qsearch); use FS::svc_acct; +use FS::part_svc; -adminsuidsetup; +my $user = shift or die &usage; +adminsuidsetup $user; -#my($spooldir)="/var/spool/freeside/export"; -my($spooldir)="unix/"; +my($spooldir)="/usr/local/etc/freeside/export.". datasrc; $FS::svc_acct::nossh_hack = 1; @@ -33,6 +51,8 @@ $FS::svc_acct::nossh_hack = 1; %part_svc=map { $_->svcpart, $_ } qsearch('part_svc',{'svcdb'=>'svc_acct'}); +die "No services with svcdb svc_acct!\n" unless %part_svc; + print "\n\n", &menu_svc, "\n", <svc, sort keys %part_svc ). "\n"; } sub getpart { - print "Enter part number, or 0 for none: "; - &getvalue; + $^W=0; # Term::Query isn't -w-safe + query "Enter part number:", 'irk', [ keys %part_svc ]; + $^W=1; } sub getvalue { - my($x)=scalar(); - chop $x; - $x; + my $prompt = shift; + $^W=0; # Term::Query isn't -w-safe + query $prompt, ''; + $^W=1; } print "\n\n"; @@ -122,6 +140,7 @@ while () { or die "1Unexpected line in users.import: $_"; my($password,$expiration); ($username,$password,$expiration)=(lc($1),$2,$4); + $password = '' if $password eq 'UNIX'; $upassword{$username}=$password; undef %param; } else { @@ -176,7 +195,7 @@ while () { $svcpart = $shell_svcpart; } - my($svc_acct) = create FS::svc_acct ({ + my($svc_acct) = new FS::svc_acct ({ 'svcpart' => $svcpart, 'username' => $username, 'password' => $password, @@ -210,7 +229,7 @@ foreach $username ( keys %upassword ) { die "Illegal Port-Limit in users!\n"; } - my($svc_acct) = create FS::svc_acct ({ + my($svc_acct) = new FS::svc_acct ({ 'svcpart' => $svcpart, 'username' => $username, 'password' => $password, @@ -225,3 +244,9 @@ foreach $username ( keys %upassword ) { delete $upassword{$username}; } +# + +sub usage { + die "Usage:\n\n svc_acct.export user\n"; +} +