X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fsvc_acct.import;h=795b853c0f4c808f489f54bd772cd1afd620460e;hp=85bc2f5ebbe7bc5cecbc6c1e190f8c02cf3f0196;hb=e5d8fd10937c98ef6bfe06ee745cba36d33a9dc5;hpb=fe1fe9e3c076c7e4f45a810d6cd07c9008cb2e5b diff --git a/bin/svc_acct.import b/bin/svc_acct.import index 85bc2f5eb..795b853c0 100755 --- a/bin/svc_acct.import +++ b/bin/svc_acct.import @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: svc_acct.import,v 1.6 1999-07-08 01:49:00 ivan Exp $ +# $Id: svc_acct.import,v 1.11 2000-06-29 12:27:01 ivan Exp $ # # ivan@sisd.com 98-mar-9 # @@ -17,7 +17,19 @@ # 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 +# Revision 1.11 2000-06-29 12:27:01 ivan +# s/password/_password/ for PostgreSQL wasn't done in the import. +# +# Revision 1.10 2000/06/28 12:32:30 ivan +# allow RADIUS lines with "Auth-Type = Local" too +# +# Revision 1.8 2000/02/03 05:16:52 ivan +# beginning of DNS and Apache support +# +# Revision 1.7 1999/07/08 02:32:26 ivan +# import fix, noticed by Ben Leibig and Joel Griffiths +# +# 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 @@ -115,14 +127,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 +151,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; @@ -207,15 +222,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 +256,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 +273,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"; }