From e53cf6b04ea8c6f10c331d46372c486128478df0 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Mar 2004 08:55:09 +0000 Subject: [PATCH] first pass at ISPMan integration --- FS/FS/part_export/domain_shellcommands.pm | 7 ++++++- FS/FS/part_export/forward_shellcommands.pm | 6 ++++++ FS/FS/part_export/shellcommands.pm | 10 +++++++++ FS/FS/part_export/shellcommands_withdomain.pm | 16 ++++++++++++-- FS/FS/part_export/www_shellcommands.pm | 30 +++++++++++++++++++++------ 5 files changed, 60 insertions(+), 9 deletions(-) diff --git a/FS/FS/part_export/domain_shellcommands.pm b/FS/FS/part_export/domain_shellcommands.pm index d8ae0c376..914589529 100644 --- a/FS/FS/part_export/domain_shellcommands.pm +++ b/FS/FS/part_export/domain_shellcommands.pm @@ -22,7 +22,7 @@ tie my %options, 'Tie::IxHash', %info = ( 'svc' => 'svc_domain', - 'desc' => 'Run remote commands via SSH, for domains.', + 'desc' => 'Run remote commands via SSH, for domains (qmail, ISPMan).', 'options' => \%options, 'notes' => <<'END' Run remote commands via SSH, for domains. You will need to @@ -34,6 +34,11 @@ Run remote commands via SSH, for domains. You will need to this.form.useradd.value = "[ \"$uid\" -a \"$gid\" -a \"$dir\" -a \"$qdomain\" ] && [ -e $dir/.qmail-$qdomain-default ] || { touch $dir/.qmail-$qdomain-default; chown $uid:$gid $dir/.qmail-$qdomain-default; }"; this.form.userdel.value = ""; this.form.usermod.value = ""; +
  • + The following variables are available for interpolation (prefixed with new_ or old_ for replace operations): diff --git a/FS/FS/part_export/forward_shellcommands.pm b/FS/FS/part_export/forward_shellcommands.pm index 6908214d5..fe304350c 100644 --- a/FS/FS/part_export/forward_shellcommands.pm +++ b/FS/FS/part_export/forward_shellcommands.pm @@ -35,6 +35,12 @@ Run remote commands via SSH, for forwards. You will need to this.form.userdel.value = "rm /home/vpopmail/domains/$domain/$username/.qmail"; this.form.usermod.value = "mv /home/vpopmail/domains/$old_domain/$old_username/.qmail /home/vpopmail/domains/$new_domain/$new_username; [ \"$old_destination\" != \"$new_destination\" ] && { echo \"$new_destination\" > /home/vpopmail/domains/$new_domain/$new_username/.qmail; chown vpopmail:vchkpw /home/vpopmail/domains/$new_domain/$new_username/.qmail; }"; '> +
  • + The following variables are available for interpolation (prefixed with new_ or old_ for replace operations): diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index 0fc0cc9c6..1af5bb348 100644 --- a/FS/FS/part_export/shellcommands.pm +++ b/FS/FS/part_export/shellcommands.pm @@ -148,6 +148,8 @@ old_ for replace operations):
  • $uid
  • $gid
  • $finger - GECOS, already quoted for the shell (do not add additional quotes) +
  • $first - First name of GECOS, already quoted for the shell (do not add additional quotes) +
  • $last - Last name of GECOS, already quoted for the shell (do not add additional quotes)
  • $dir - home directory
  • $shell
  • $quota @@ -206,6 +208,10 @@ sub _export_command { $email = ''; } + $finger =~ /^(.*)\s+(\S+)$/ or $finger =~ /^((.*))$/; + ($first, $last ) = ( $1, $2 ); + $first = shell_quote $first; + $last = shell_quote $last; $finger = shell_quote $finger; $quoted_password = shell_quote $_password; $domain = $svc_acct->domain; @@ -239,6 +245,10 @@ sub _export_replace { ${"old_$_"} = $old->getfield($_) foreach $old->fields; ${"new_$_"} = $new->getfield($_) foreach $new->fields; } + $new_finger =~ /^(.*)\s+(\S+)$/ or $finger =~ /^((.*))$/; + ($new_first, $new_last ) = ( $1, $2 ); + $new_first = shell_quote $new_first; + $new_last = shell_quote $new_last; $new_finger = shell_quote $new_finger; $quoted_new__password = shell_quote $new__password; #old, wrong? $new_quoted_password = shell_quote $new__password; #new, better? diff --git a/FS/FS/part_export/shellcommands_withdomain.pm b/FS/FS/part_export/shellcommands_withdomain.pm index 9dab281fc..8a56bab1c 100644 --- a/FS/FS/part_export/shellcommands_withdomain.pm +++ b/FS/FS/part_export/shellcommands_withdomain.pm @@ -48,7 +48,7 @@ tie my %options, 'Tie::IxHash', %info = ( 'svc' => 'svc_acct', - 'desc' => 'Real-time export via remote SSH (vpopmail, etc.)', + 'desc' => 'Real-time export via remote SSH (vpopmail, ISPMan)', 'options' => \%options, 'notes' => <<'END' Run remote commands via SSH. username@domain (rather than just usernames) are @@ -62,11 +62,21 @@ the same username with different domains. You will need to
  • +
  • The following variables are available for interpolation (prefixed with @@ -80,6 +90,8 @@ The following variables are available for interpolation (prefixed with
  • $uid
  • $gid
  • $finger - GECOS, already quoted for the shell (do not add additional quotes) +
  • $first - First name of GECOS, already quoted for the shell (do not add additional quotes) +
  • $last - Last name of GECOS, already quoted for the shell (do not add additional quotes)
  • $dir - home directory
  • $shell
  • $quota diff --git a/FS/FS/part_export/www_shellcommands.pm b/FS/FS/part_export/www_shellcommands.pm index cc1983bf2..a272edab0 100644 --- a/FS/FS/part_export/www_shellcommands.pm +++ b/FS/FS/part_export/www_shellcommands.pm @@ -27,10 +27,28 @@ tie my %options, 'Tie::IxHash', 'notes' => <<'END' Run remote commands via SSH, for virtual web sites. You will need to setup SSH for unattended operation. -

    The following variables are available for interpolation (prefixed with +

    Use these buttons for some useful presets: + +The following variables are available for interpolation (prefixed with new_ or old_ for replace operations):