summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-03-14 06:05:34 +0100
committerlpsolit%gmail.com <>2008-03-14 06:05:34 +0100
commit05a0cfc3eeb0b738c7e00840df7b49e162692044 (patch)
tree277eb6b7d9583963dcb0ecee1150efc4bb1f77cf
parent7c6954f9189af00752c59112b79c79d8bef49390 (diff)
downloadbugzilla-05a0cfc3eeb0b738c7e00840df7b49e162692044.tar.gz
bugzilla-05a0cfc3eeb0b738c7e00840df7b49e162692044.tar.xz
Bug 304005: Implement SMTP authentication support for email notifications - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
-rw-r--r--Bugzilla/Config/Common.pm12
-rw-r--r--Bugzilla/Config/MTA.pm11
-rw-r--r--Bugzilla/Install/Requirements.pm6
-rw-r--r--Bugzilla/Mailer.pm2
-rw-r--r--template/en/default/admin/params/common.html.tmpl5
-rw-r--r--template/en/default/admin/params/mta.html.tmpl6
6 files changed, 40 insertions, 2 deletions
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index 03e97d6a1..f5f5a3fb2 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -50,7 +50,7 @@ use base qw(Exporter);
check_opsys check_shadowdb check_urlbase check_webdotbase
check_netmask check_user_verify_class check_image_converter
check_mail_delivery_method check_notification check_timezone check_utf8
- check_bug_status
+ check_bug_status check_smtp_auth
);
# Checking functions for the various values
@@ -337,6 +337,14 @@ sub check_timezone {
return "";
}
+sub check_smtp_auth {
+ my $username = shift;
+ if ($username) {
+ eval "require Authen::SASL";
+ return "Error requiring Authen::SASL: '$@'" if $@;
+ }
+ return "";
+}
# OK, here are the parameter definitions themselves.
#
@@ -354,6 +362,8 @@ sub check_timezone {
# The type value can be one of the following:
#
# t -- A short text entry field (suitable for a single line)
+# p -- A short text entry field (as with type = 't'), but the string is
+# replaced by asterisks (appropriate for passwords)
# l -- A long text field (suitable for many lines)
# b -- A boolean value (either 1 or 0)
# m -- A list of values, with many selectable (shows up as a select box)
diff --git a/Bugzilla/Config/MTA.pm b/Bugzilla/Config/MTA.pm
index 686d5b3e4..37d99d967 100644
--- a/Bugzilla/Config/MTA.pm
+++ b/Bugzilla/Config/MTA.pm
@@ -69,6 +69,17 @@ sub get_param_list {
default => 'localhost'
},
{
+ name => 'smtp_username',
+ type => 't',
+ default => '',
+ checker => \&check_smtp_auth
+ },
+ {
+ name => 'smtp_password',
+ type => 'p',
+ default => ''
+ },
+ {
name => 'smtp_debug',
type => 'b',
default => 0
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 293740e3f..65df716bc 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -170,6 +170,12 @@ sub OPTIONAL_MODULES {
feature => 'LDAP Authentication'
},
{
+ package => 'SASL-Authen',
+ module => 'Authen::SASL',
+ version => 0,
+ feature => 'SMTP Authentication'
+ },
+ {
package => 'RadiusPerl',
module => 'Authen::Radius',
version => 0,
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index 2702b8ff1..c002fb3db 100644
--- a/Bugzilla/Mailer.pm
+++ b/Bugzilla/Mailer.pm
@@ -124,6 +124,8 @@ sub MessageToMTA {
if ($method eq "SMTP") {
push @args, Host => Bugzilla->params->{"smtpserver"},
+ username => Bugzilla->params->{"smtp_username"},
+ password => Bugzilla->params->{"smtp_password"},
Hello => $hostname,
Debug => Bugzilla->params->{'smtp_debug'};
}
diff --git a/template/en/default/admin/params/common.html.tmpl b/template/en/default/admin/params/common.html.tmpl
index 7502c909d..4fd792194 100644
--- a/template/en/default/admin/params/common.html.tmpl
+++ b/template/en/default/admin/params/common.html.tmpl
@@ -30,8 +30,11 @@
<dd>[% panel.param_descs.${param.name} FILTER none %]
<p>
[% IF param.type == "t" %]
- <input size="80" name="[% param.name FILTER html %]"
+ <input type="text" size="80" name="[% param.name FILTER html %]"
value="[% Param(param.name) FILTER html %]">
+ [% ELSIF param.type == "p" %]
+ <input type="password" size="80" name="[% param.name FILTER html %]"
+ value="[% Param(param.name) FILTER html %]" autocomplete="off">
[% ELSIF param.type == "l" %]
<textarea name="[% param.name FILTER html %]" rows="10" cols="80">
[% Param(param.name) FILTER html %]</textarea>
diff --git a/template/en/default/admin/params/mta.html.tmpl b/template/en/default/admin/params/mta.html.tmpl
index 904aa2a1c..800fbad9b 100644
--- a/template/en/default/admin/params/mta.html.tmpl
+++ b/template/en/default/admin/params/mta.html.tmpl
@@ -55,6 +55,12 @@
smtpserver => "The SMTP server address (if using SMTP for mail delivery).",
+ smtp_username => "The username to pass to the SMTP server for SMTP authentication. " _
+ "Leave this field empty if your SMTP server doesn't require authentication.",
+
+ smtp_password => "The password to pass to the SMTP server for SMTP authentication. " _
+ "This field has no effect if the smtp_username parameter is left empty.",
+
smtp_debug => "If enabled, this will print detailed information to your" _
" web server's error log about the communication between" _
" $terms.Bugzilla and your SMTP server. You can use this to" _