X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fsvc_acct.import;h=aff26b9433dbac1502e3418a4761213a5149f2c6;hp=85bc2f5ebbe7bc5cecbc6c1e190f8c02cf3f0196;hb=cf7e1d51019f20497aac630017d2c35b427369c9;hpb=fe1fe9e3c076c7e4f45a810d6cd07c9008cb2e5b diff --git a/bin/svc_acct.import b/bin/svc_acct.import index 85bc2f5eb..aff26b943 100755 --- a/bin/svc_acct.import +++ b/bin/svc_acct.import @@ -1,43 +1,10 @@ #!/usr/bin/perl -Tw -# -# $Id: svc_acct.import,v 1.6 1999-07-08 01:49:00 ivan Exp $ -# -# ivan@sisd.com 98-mar-9 -# -# changed 'password' field to '_password' because PgSQL 6.3 reserves this word -# bmccane@maxbaud.net 98-Apr-3 -# -# generalized svcparts (still needs radius import) ivan@sisd.com 98-mar-23 -# -# radius import, now an interactive script. still needs erpcd import? -# ivan@sisd.com 98-jun-24 -# -# 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.6 1999-07-08 01:49:00 ivan -# updates to avoid -w warnings from Joel Griffiths -# -# 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 Net::SCP qw(iscp); use FS::UID qw(adminsuidsetup datasrc); use FS::Record qw(qsearch); use FS::svc_acct; @@ -46,6 +13,8 @@ use FS::part_svc; my $user = shift or die &usage; adminsuidsetup $user; +push @FS::svc_acct::shells, qw(/bin/sync /sbin/shuddown /bin/halt); #others? + my($spooldir)="/usr/local/etc/freeside/export.". datasrc; $FS::svc_acct::nossh_hack = 1; @@ -115,14 +84,16 @@ sub menu_svc { } sub getpart { $^W=0; # Term::Query isn't -w-safe - query "Enter part number:", 'irk', [ keys %part_svc ]; + my $return = query "Enter part number:", 'irk', [ keys %part_svc ]; $^W=1; + $return; } sub getvalue { my $prompt = shift; $^W=0; # Term::Query isn't -w-safe - query $prompt, ''; + my $return = query $prompt, ''; $^W=1; + $return; } print "\n\n"; @@ -137,12 +108,13 @@ my(%upassword,%ip,%allparam); my(%param,$username); while () { chop; - next if /^$/; + next if /^\s*$/; + next if /^\s*#/; if ( /^\S/ ) { - /^(\w+)\s+Password\s+=\s+"([^"]+)"(,\s+Expiration\s+=\s+"([^"]*")\s*)?$/ + /^(\w+)\s+(Auth-Type\s+=\s+Local,\s+)?Password\s+=\s+"([^"]+)"(,\s+Expiration\s+=\s+"([^"]*")\s*)?$/ or die "1Unexpected line in users.import: $_"; my($password,$expiration); - ($username,$password,$expiration)=(lc($1),$2,$4); + ($username,$password,$expiration)=(lc($1),$3,$5); $password = '' if $password eq 'UNIX'; $upassword{$username}=$password; undef %param; @@ -182,6 +154,8 @@ my(%password); while () { chop; my($username,$password)=split(/:/); + #$password =~ s/^\!$/\*/; + #$password =~ s/\!+/\*SUSPENDED\* /; $password{$username}=$password; } @@ -207,15 +181,15 @@ while () { } my($svc_acct) = new FS::svc_acct ({ - 'svcpart' => $svcpart, - 'username' => $username, - 'password' => $password, - 'uid' => $uid, - 'gid' => $gid, - 'finger' => $finger, - 'dir' => $dir, - 'shell' => $shell, - 'slipip' => $ip{$username}, + 'svcpart' => $svcpart, + 'username' => $username, + '_password' => $password, + 'uid' => $uid, + 'gid' => $gid, + 'finger' => $finger, + 'dir' => $dir, + 'shell' => $shell, + 'slipip' => $ip{$username}, %{$allparam{$username}}, }); my($error); @@ -241,10 +215,10 @@ foreach $username ( keys %upassword ) { } my($svc_acct) = new FS::svc_acct ({ - 'svcpart' => $svcpart, - 'username' => $username, - 'password' => $password, - 'slipip' => $ip{$username}, + 'svcpart' => $svcpart, + 'username' => $username, + '_password' => $password, + 'slipip' => $ip{$username}, %{$allparam{$username}}, }); my($error); @@ -258,6 +232,6 @@ foreach $username ( keys %upassword ) { # sub usage { - die "Usage:\n\n svc_acct.export user\n"; + die "Usage:\n\n svc_acct.import user\n"; }