diff options
author | ivan <ivan> | 1998-12-10 07:23:18 +0000 |
---|---|---|
committer | ivan <ivan> | 1998-12-10 07:23:18 +0000 |
commit | 7559cc8cb8e2ad57806462d22eedb1fb101816f0 (patch) | |
tree | 1798875ca932aeddce324ef544ac11b68e9e4a09 | |
parent | 320d43cc303284435bd94b5b283471609c4a8eac (diff) |
use FS::Conf, need user (for datasrc)
-rwxr-xr-x | bin/svc_acct.export | 89 | ||||
-rwxr-xr-x | bin/svc_acct.import | 22 | ||||
-rwxr-xr-x | bin/svc_acct_sm.export | 69 | ||||
-rwxr-xr-x | bin/svc_acct_sm.import | 23 |
4 files changed, 103 insertions, 100 deletions
diff --git a/bin/svc_acct.export b/bin/svc_acct.export index 3f65a08ba..d4ebe6bdc 100755 --- a/bin/svc_acct.export +++ b/bin/svc_acct.export @@ -1,5 +1,7 @@ #!/usr/bin/perl -Tw # +# $Id: svc_acct.export,v 1.2 1998-12-10 07:23:15 ivan Exp $ +# # Create and export password files: passwd, passwd.adjunct, shadow, # acp_passwd, acp_userinfo, acp_dialup, users # @@ -34,75 +36,46 @@ # # OOPS! added arbitrary radius fields (pry 98-aug-16) but forgot to say so. # ivan@sisd.com 98-sep-18 +# +# $Log: svc_acct.export,v $ +# Revision 1.2 1998-12-10 07:23:15 ivan +# use FS::Conf, need user (for datasrc) +# use strict; +use vars qw($conf); use Fcntl qw(:flock); +use FS::Conf; use FS::SSH qw(scp ssh); -use FS::UID qw(adminsuidsetup); +use FS::UID qw(adminsuidsetup datasrc); use FS::Record qw(qsearch fields); +use FS::svc_acct; -my($fshellmachines)="/var/spool/freeside/conf/shellmachines"; -my(@shellmachines); -if ( -e $fshellmachines ) { - open(SHELLMACHINES,$fshellmachines); - @shellmachines=map { - /^(.*)$/ or die "Illegal line in conf/shellmachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <SHELLMACHINES>; - close SHELLMACHINES; -} +my $user = shift or die &usage; +adminsuidsetup $user; -my($fbsdshellmachines)="/var/spool/freeside/conf/bsdshellmachines"; -my(@bsdshellmachines); -if ( -e $fbsdshellmachines ) { - open(BSDSHELLMACHINES,$fbsdshellmachines); - @bsdshellmachines=map { - /^(.*)$/ or die "Illegal line in conf/bsdshellmachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <BSDSHELLMACHINES>; - close BSDSHELLMACHINES; -} +$conf = new FS::Conf; -my($fnismachines)="/var/spool/freeside/conf/nismachines"; -my(@nismachines); -if ( -e $fnismachines ) { - open(NISMACHINES,$fnismachines); - @nismachines=map { - /^(.*)$/ or die "Illegal line in conf/nismachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <NISMACHINES>; - close NISMACHINES; -} +my @shellmachines = $conf->config('shellmachines') + if $conf->exists('shellmachines'); -my($ferpcdmachines)="/var/spool/freeside/conf/erpcdmachines"; -my(@erpcdmachines); -if ( -e $ferpcdmachines ) { - open(ERPCDMACHINES,$ferpcdmachines); - @erpcdmachines=map { - /^(.*)$/ or die "Illegal line in conf/erpcdmachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <ERPCDMACHINES>; - close ERPCDMACHINES; -} +my @bsdshellmachines = $conf->config('bsdshellmachines') + if $conf->exists('bsdshellmachines'); -my($fradiusmachines)="/var/spool/freeside/conf/radiusmachines"; -my(@radiusmachines); -if ( -e $fradiusmachines ) { - open(RADIUSMACHINES,$fradiusmachines); - @radiusmachines=map { - /^(.*)$/ or die "Illegal line in conf/radiusmachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <RADIUSMACHINES>; - close RADIUSMACHINES; -} +my @nismachines = $conf->config('nismachines') + if $conf->exists('nismachines'); -my($spooldir)="/var/spool/freeside/export"; -my($spoollock)="/var/spool/freeside/svc_acct.export.lock"; +my @erpcdmachines = $conf->config('erpcdmachines') + if $conf->exists('erpcdmachines'); -adminsuidsetup; +my @radiusmachines = $conf->config('radiusmachines') + if $conf->exists('radiusmachines'); my(@saltset)= ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' ); -srand(time|$$); +require 5.004; #srand(time|$$); + +my $spooldir = "/usr/local/etc/freeside/export.". datasrc; +my $spoollock = "/usr/local/etc/freeside/svc_acct.export.lock.". datasrc; open(EXPORT,"+>>$spoollock") or die "Can't open $spoollock: $!"; select(EXPORT); $|=1; select(STDOUT); @@ -349,3 +322,9 @@ unlink $spoollock; flock(EXPORT,LOCK_UN); close EXPORT; +# + +sub usage { + die "Usage:\n\n svc_acct.export user\n"; +} + diff --git a/bin/svc_acct.import b/bin/svc_acct.import index 60deac539..8343ce867 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.2 1998-10-13 12:07:51 ivan Exp $ +# $Id: svc_acct.import,v 1.3 1998-12-10 07:23:16 ivan Exp $ # # ivan@sisd.com 98-mar-9 # @@ -17,7 +17,10 @@ # don't import /var/spool/freeside/conf/shells! ivan@sisd.com 98-aug-13 # # $Log: svc_acct.import,v $ -# Revision 1.2 1998-10-13 12:07:51 ivan +# 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" # @@ -25,14 +28,15 @@ use strict; use vars qw(%part_svc); use Date::Parse; 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; @@ -233,3 +237,9 @@ foreach $username ( keys %upassword ) { delete $upassword{$username}; } +# + +sub usage { + die "Usage:\n\n svc_acct.export user\n"; +} + diff --git a/bin/svc_acct_sm.export b/bin/svc_acct_sm.export index c2ec1e53f..ce4900733 100755 --- a/bin/svc_acct_sm.export +++ b/bin/svc_acct_sm.export @@ -1,6 +1,10 @@ #!/usr/bin/perl -Tw # -# Create and export VoiceNet_quasar.m4 +# $Id: svc_acct_sm.export,v 1.2 1998-12-10 07:23:17 ivan Exp $ +# +# Create and export config files for sendmail, qmail +# +# (used to) Create and export VoiceNet_quasar.m4 # # ivan@voicenet.com late oct 96 # @@ -36,53 +40,42 @@ # put example $my_domain declaration in ivan@sisd.com 98-mar-23 # # /var/spool/freeside/conf and sendmail updates ivan@sisd.com 98-aug-14 +# +# $Log: svc_acct_sm.export,v $ +# Revision 1.2 1998-12-10 07:23:17 ivan +# use FS::Conf, need user (for datasrc) +# use strict; +use vars qw($conf); use Fcntl qw(:flock); use FS::SSH qw(ssh scp); -use FS::UID qw(adminsuidsetup); +use FS::UID qw(adminsuidsetup datasrc); use FS::Record qw(qsearch qsearchs); +use FS::svc_acct; +use FS::svc_acct_sm; +use FS::svc_domain; + +my $user = shift or die &usage; +adminsuidsetup $user; + +$conf = new FS::Conf; -my($conf_shellm)="/var/spool/freeside/conf/shellmachine"; -my($fqmailmachines)="/var/spool/freeside/conf/qmailmachines"; my($shellmachine); my(@qmailmachines); -if ( -e $fqmailmachines ) { - open(SHELLMACHINE,$conf_shellm) or die "Can't open $conf_shellm: $!"; - <SHELLMACHINE> =~ /^([\w\.\-]+)$/ or die "Illegal $conf_shellm"; - $shellmachine = $1; - close SHELLMACHINE; - open(QMAILMACHINES,$fqmailmachines); - @qmailmachines=map { - /^(.*)$/ or die "Illegal line in conf/qmailmachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <QMAILMACHINES>; - close QMAILMACHINES; +if ( $conf->exists('qmailmachines') ) { + $shellmachine = $conf->config('shellmachine'); + @qmailmachines = $conf->config('qmailmachines'); } -my($fsendmailmachines)="/var/spool/freeside/conf/sendmailmachines"; -my(@sendmailmachines); -if ( -e $fsendmailmachines ) { - open(SENDMAILMACHINES,$fsendmailmachines); - @sendmailmachines=map { - /^(.*)$/ or die "Illegal line in conf/sendmailmachines"; #we trust the file - $1; - } grep $_ !~ /^(#|$)/, <SENDMAILMACHINES>; - close SENDMAILMACHINES; -} +my @sendmailmachines = $conf->config('sendmailmachines') + if $conf->exists('sendmailmachines'); -my($conf_domain)="/var/spool/freeside/conf/domain"; -open(DOMAIN,$conf_domain) or die "Can't open $conf_domain: $!"; -my($mydomain)=map { - /^(.*)$/ or die "Illegal line in $conf_domain!"; #yes, we trust the file - $1 -} grep $_ !~ /^(#|$)/, <DOMAIN>; -close DOMAIN; +my $mydomain = $conf->config('domain'); -my($spooldir)="/var/spool/freeside/export"; -my($spoollock)="/var/spool/freeside/svc_acct_sm.export.lock"; +my $spooldir = "/usr/local/etc/freeside/export.". datasrc; +my $spoollock = "/usr/local/etc/freeside/svc_acct_sm.export.lock.". datasrc; -adminsuidsetup; umask 066; open(EXPORT,"+>>$spoollock") or die "Can't open $spoollock: $!"; @@ -219,3 +212,9 @@ unlink $spoollock; flock(EXPORT,LOCK_UN); close EXPORT; +# + +sub usage { + die "Usage:\n\n svc_acct.export user\n"; +} + diff --git a/bin/svc_acct_sm.import b/bin/svc_acct_sm.import index 10d7e4c20..f94bda637 100755 --- a/bin/svc_acct_sm.import +++ b/bin/svc_acct_sm.import @@ -1,5 +1,7 @@ #!/usr/bin/perl -Tw # +# $Id: svc_acct_sm.import,v 1.2 1998-12-10 07:23:18 ivan Exp $ +# # ivan@sisd.com 98-mar-9 # # generalized svcparts ivan@sisd.com 98-mar-23 @@ -12,19 +14,26 @@ # has an (untested) section for sendmail, s/warn/die/g and generates a program # to run on your mail machine _later_ instead of ssh'ing for each user # ivan@sisd.com 98-jul-13 +# +# $Log: svc_acct_sm.import,v $ +# Revision 1.2 1998-12-10 07:23:18 ivan +# use FS::Conf, need user (for datasrc) +# use strict; use vars qw(%d_part_svc %m_part_svc); use FS::SSH qw(iscp); -use FS::UID qw(adminsuidsetup); +use FS::UID qw(adminsuidsetup datasrc); use FS::Record qw(qsearch qsearchs); use FS::svc_acct_sm; use FS::svc_domain; +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; my(%mta) = ( 1 => "qmail", @@ -250,3 +259,9 @@ Don\'t forget to run $spooldir/virtualdomains.FIX before using $spooldir/virtualdomains ! END +# + +sub usage { + die "Usage:\n\n svc_acct_sm.export user\n"; +} + |