X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=fs_selfadmin%2FFS-MailAdminServer%2Ffs_mailadmind;fp=fs_selfadmin%2FFS-MailAdminServer%2Ffs_mailadmind;h=0000000000000000000000000000000000000000;hp=746d7822eb2136f005960f0c535bd41509a49d91;hb=daaed904d115c94aab3651c22f0ca7d3920c930d;hpb=444d079fa0fb2f09c080b58f6b1a5fed37ffd7c1 diff --git a/fs_selfadmin/FS-MailAdminServer/fs_mailadmind b/fs_selfadmin/FS-MailAdminServer/fs_mailadmind deleted file mode 100755 index 746d7822e..000000000 --- a/fs_selfadmin/FS-MailAdminServer/fs_mailadmind +++ /dev/null @@ -1,366 +0,0 @@ -#!/usr/bin/perl -Tw - -eval 'exec /usr/bin/perl -Tw -S $0 ${1+"$@"}' - if 0; # not running under some shell -# -# fs_mailadmind -# -# This is run REMOTELY over ssh by fs_mailadmin_server. -# - -use strict; -use Socket; - -use vars qw( $Debug ); - -$Debug = 0; - -my($fs_mailadmind_socket)="/usr/local/freeside/fs_mailadmind_socket"; - -$ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin'; -$ENV{'SHELL'} = '/bin/sh'; -$ENV{'IFS'} = " \t\n"; -$ENV{'CDPATH'} = ''; -$ENV{'ENV'} = ''; -$ENV{'BASH_ENV'} = ''; - -$|=1; - -warn "[fs_mailadmind] Reading locales...\n" if $Debug; -chomp( my $n_cust_main_county = ); -my @cust_main_county = map { - chomp( my $taxnum = ); - chomp( my $state = ); - chomp( my $county = ); - chomp( my $country = ); - { - 'taxnum' => $taxnum, - 'state' => $state, - 'county' => $county, - 'country' => $country, - }; -} ( 1 .. $n_cust_main_county ); - -warn "[fs_mailadmind] Reading package definitions...\n" if $Debug; -chomp( my $n_part_pkg = ); -my @part_pkg = map { - chomp( my $pkgpart = ); - chomp( my $pkg = ); - { - 'pkgpart' => $pkgpart, - 'pkg' => $pkg, - }; -} ( 1 .. $n_part_pkg ); - -warn "[fs_mailadmind] Reading POPs...\n" if $Debug; -chomp( my $n_svc_acct_pop = ); -my @svc_acct_pop = map { - chomp( my $popnum = ); - chomp( my $city = ); - chomp( my $state = ); - chomp( my $ac = ); - chomp( my $exch = ); - chomp( my $loc = ); - { - 'popnum' => $popnum, - 'city' => $city, - 'state' => $state, - 'ac' => $ac, - 'exch' => $exch, - 'loc' => $loc, - }; -} ( 1 .. $n_svc_acct_pop ); - -warn "[fs_mailadmind] Creating $fs_mailadmind_socket\n" if $Debug; -my $uaddr = sockaddr_un($fs_mailadmind_socket); -my $proto = getprotobyname('tcp'); -socket(Server,PF_UNIX,SOCK_STREAM,0) or die "socket: $!"; -unlink($fs_mailadmind_socket); -bind(Server, $uaddr) or die "bind: $!"; -listen(Server,SOMAXCONN) or die "listen: $!"; - -warn "[fs_mailadmind] Entering main loop...\n" if $Debug; -my $paddr; -for ( ; $paddr = accept(Client,Server); close Client) { - - chop( my $command = ); - - if ( $command eq "signup_info" ) { - warn "[fs_mailadmind] sending signup info...\n" if $Debug; - print Client join("\n", $n_cust_main_county, - map { - $_->{taxnum}, - $_->{state}, - $_->{county}, - $_->{country}, - } @cust_main_county - ), "\n"; - - print Client join("\n", $n_part_pkg, - map { - $_->{pkgpart}, - $_->{pkg}, - } @part_pkg - ), "\n"; - - print Client join("\n", $n_svc_acct_pop, - map { - $_->{popnum}, - $_->{city}, - $_->{state}, - $_->{ac}, - $_->{exch}, - $_->{loc}, - } @svc_acct_pop - ), "\n"; - - } elsif ( $command eq "new_customer" ) { - warn "[fs_mailadmind] reading customer signup...\n" if $Debug; - my( - $first, $last, $ss, $company, $address1, $address2, $city, $county, - $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, - $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, - $popnum, - ) = map { scalar() } ( 1 .. 23 ); - - warn "[fs_mailadmind] sending customer data to remote server...\n" if $Debug; - print - $first, $last, $ss, $company, $address1, $address2, $city, $county, - $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, - $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, - $popnum, - ; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "authenticate" ) { - warn "[fs_mailadmind] reading user information to auth...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading authentication material...\n" if $Debug; - chop( my $password = ); - warn "[fs_mailadmind] sending information to remote server...\n" if $Debug; - print "authenticate\n", $user, "\n", $password, "\n"; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "list_packages" ) { - warn "[fs_mailadmind] reading user information to list_packages...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] sending user information to remote server...\n" if $Debug; - print "list_packages\n", $user, "\n"; - - warn "[fs_mailadmind] reading data from remote server...\n" if $Debug; - chomp( my $n_packages = ); - my @packages = map { - chomp( my $pkgnum = ); - chomp( my $domain = ); - chomp( my $account = ); - { - 'pkgnum' => $pkgnum, - 'domain' => $domain, - 'account' => $account, - }; - } ( 1 .. $n_packages ); - - warn "[fs_mailadmind] sending data to local client...\n" if $Debug; - - print Client join("\n", $n_packages, - map { - $_->{pkgnum}, - $_->{domain}, - $_->{account}, - } @packages - ), "\n"; - - } elsif ( $command eq "list_mailboxes" ) { - warn "[fs_mailadmind] reading user information to list_mailboxes...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading package number to list_mailboxes...\n" if $Debug; - chop( my $package = ); - warn "[fs_mailadmind] sending user information to remote server...\n" if $Debug; - print "list_mailboxes\n", $user, "\n", $package, "\n"; - - warn "[fs_mailadmind] reading data from remote server...\n" if $Debug; - chomp( my $n_svc_acct = ); - my @svc_acct = map { - chomp( my $svcnum = ); - chomp( my $username = ); - chomp( my $_password = ); - { - 'svcnum' => $svcnum, - 'username' => $username, - '_password' => $_password, - }; - } ( 1 .. $n_svc_acct ); - - warn "[fs_mailadmind] sending data to local client...\n" if $Debug; - - print Client join("\n", $n_svc_acct, - map { - $_->{svcnum}, - $_->{username}, - $_->{_password}, - } @svc_acct - ), "\n"; - - } elsif ( $command eq "delete_mailbox" ) { - warn "[fs_mailadmind] reading user information to auth...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading account information to delete...\n" if $Debug; - chop( my $account = ); - warn "[fs_mailadmind] sending information to remote server...\n" if $Debug; - print "delete_mailbox\n", $user, "\n", $account, "\n"; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "password_mailbox" ) { - warn "[fs_mailadmind] reading user information to auth...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading account information to password...\n" if $Debug; - my( - $account, $_password, - ) = map { scalar() } ( 1 .. 2 ); - - warn "[fs_mailadmind] sending password data to remote server...\n" if $Debug; - print "password_mailbox", "\n"; - print - $user, "\n", $account, $_password, - ; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "add_mailbox" ) { - warn "[fs_mailadmind] reading user information to auth...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading account information to create...\n" if $Debug; - my( - $package, $account, $_password, - ) = map { scalar() } ( 1 .. 3 ); - - warn "[fs_mailadmind] sending service data to remote server...\n" if $Debug; - print "add_mailbox", "\n"; - print - $user, "\n", $package, $account, $_password, - ; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "add_forward" ) { - warn "[fs_mailadmind] reading user information to auth...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading forward information to create...\n" if $Debug; - my( - $package, $source, $dest, - ) = map { scalar() } ( 1 .. 3 ); - - warn "[fs_mailadmind] sending service data to remote server...\n" if $Debug; - print "add_forward", "\n"; - print - $user, "\n", $package, $source, $dest, - ; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "delete_forward" ) { - warn "[fs_mailadmind] reading user information to auth...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading forward information to delete...\n" if $Debug; - chop( my $service = ); - warn "[fs_mailadmind] sending information to remote server...\n" if $Debug; - print "delete_forward\n", $user, "\n", $service, "\n"; - - warn "[fs_mailadmind] reading error from remote server...\n" if $Debug; - my $error = ; - - warn "[fs_mailadmind] sending error to local client...\n" if $Debug; - print Client $error; - - } elsif ( $command eq "list_forwards" ) { - warn "[fs_mailadmind] reading user information to list_forwards...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading service number to list_forwards...\n" if $Debug; - chop( my $service = ); - warn "[fs_mailadmind] sending user information to remote server...\n" if $Debug; - print "list_forwards\n", $user, "\n", $service, "\n"; - - warn "[fs_mailadmind] reading data from remote server...\n" if $Debug; - chomp( my $n_svc_forward = ); - my @svc_forward = map { - chomp( my $svcnum = ); - chomp( my $dest = ); - { - 'svcnum' => $svcnum, - 'dest' => $dest, - }; - } ( 1 .. $n_svc_forward ); - - warn "[fs_mailadmind] sending data to local client...\n" if $Debug; - - print Client join("\n", $n_svc_forward, - map { - $_->{svcnum}, - $_->{dest}, - } @svc_forward - ), "\n"; - - } elsif ( $command eq "list_pkg_forwards" ) { - warn "[fs_mailadmind] reading user information to list_pkg_forwards...\n" if $Debug; - chop( my $user = ); - warn "[fs_mailadmind] reading service number to list_forwards...\n" if $Debug; - chop( my $package = ); - warn "[fs_mailadmind] sending user information to remote server...\n" if $Debug; - print "list_pkg_forwards\n", $user, "\n", $package, "\n"; - - warn "[fs_mailadmind] reading data from remote server...\n" if $Debug; - chomp( my $n_svc_forward = ); - my @svc_forward = map { - chomp( my $svcnum = ); - chomp( my $srcsvc = ); - chomp( my $dest = ); - { - 'svcnum' => $svcnum, - 'srcsvc' => $srcsvc, - 'dest' => $dest, - }; - } ( 1 .. $n_svc_forward ); - - warn "[fs_mailadmind] sending data to local client...\n" if $Debug; - - print Client join("\n", $n_svc_forward, - map { - $_->{svcnum}, - $_->{srcsvc}, - $_->{dest}, - } @svc_forward - ), "\n"; - - } else { - die "unexpected command from client: $command"; - } - -} -