From 8480441446b2f311d1dca0482deca20fb57d2781 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 26 Jan 2014 01:27:36 -0800 Subject: [PATCH] *.cgi: replace hard-coded use of /usr/bin/mail with mailer_pipe Using /usr/bin/mail is undesirable as it limits control over header lines etc. Additionally using a single mailer everywhere allows changes to be made more easily. Replace direct use of /usr/bin/mail with a call to mailer_pipe. --- cgi/delproj.cgi | 8 ++++---- cgi/deluser.cgi | 6 +++--- cgi/edituser.cgi | 6 +++--- cgi/pwproj.cgi | 9 +++++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cgi/delproj.cgi b/cgi/delproj.cgi index d4cb44a..590b3e3 100755 --- a/cgi/delproj.cgi +++ b/cgi/delproj.cgi @@ -53,12 +53,12 @@ if ($y0 && $cgi->request_method eq 'POST' && $proj->authenticate($gcgi)) { my $auth = $proj->gen_auth; # Send auth mail - open(MAIL, '|-', '/usr/bin/mail', '-s', "[$Girocco::Config::name] Project removal authorization", $proj->{email}) or + defined(my $MAIL = mailer_pipe '-s', "[$Girocco::Config::name] Project removal authorization", $proj->{email}) or die "Sorry, could not send authorization code: $!"; - print MAIL <The project admin should shortly receive an e-mail containing a project diff --git a/cgi/deluser.cgi b/cgi/deluser.cgi index 2fff089..71003f6 100755 --- a/cgi/deluser.cgi +++ b/cgi/deluser.cgi @@ -68,9 +68,9 @@ if ($cgi->param('name') && $y0 && $cgi->request_method eq 'POST') { my $auth = $user->gen_auth('DEL'); # Send auth mail - open(MAIL, '|-', '/usr/bin/mail', '-s', "[$Girocco::Config::name] Account removal authorization", $user->{email}) or + defined(my $MAIL = mailer_pipe '-s', "[$Girocco::Config::name] Account removal authorization", $user->{email}) or die "Sorry, could not send authorization code: $!"; - print MAIL <You should shortly receive an e-mail containing an authorization code. Please enter this code below to remove your account. diff --git a/cgi/edituser.cgi b/cgi/edituser.cgi index 2e20172..17c4e9e 100755 --- a/cgi/edituser.cgi +++ b/cgi/edituser.cgi @@ -70,9 +70,9 @@ if ($cgi->param('name') && $y0 && $cgi->request_method eq 'POST') { my $auth = $user->gen_auth; # Send auth mail - open(MAIL, '|-', '/usr/bin/mail', '-s', "[$Girocco::Config::name] Account update authorization", $user->{email}) or + defined(my $MAIL = mailer_pipe '-s', "[$Girocco::Config::name] Account update authorization", $user->{email}) or die "Sorry, could not send authorization code: $!"; - print MAIL <You should shortly receive an e-mail containing an authorization code. Please enter this code below to update your SSH keys. diff --git a/cgi/pwproj.cgi b/cgi/pwproj.cgi index e3cc1a7..8c5f40e 100755 --- a/cgi/pwproj.cgi +++ b/cgi/pwproj.cgi @@ -49,11 +49,12 @@ if ($y0 eq 'Reset Password' && $cgi->request_method eq 'POST') { my $newpwd = genpwd(); - open (M, '|-', 'mail', '-s', "[$Girocco::Config::name] New password for project $name", $mail) or die "Cannot spawn mail: $!"; - print M <update_password($newpwd); -- 2.11.4.GIT