]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 304005: Implement SMTP authentication support for email notifications - Patch...
authorlpsolit%gmail.com <>
Fri, 14 Mar 2008 05:05:34 +0000 (05:05 +0000)
committerlpsolit%gmail.com <>
Fri, 14 Mar 2008 05:05:34 +0000 (05:05 +0000)
Bugzilla/Config/Common.pm
Bugzilla/Config/MTA.pm
Bugzilla/Install/Requirements.pm
Bugzilla/Mailer.pm
template/en/default/admin/params/common.html.tmpl
template/en/default/admin/params/mta.html.tmpl

index 03e97d6a19ab59e5add5d7934ea509d6462894e2..f5f5a3fb264e4c747a02574990ba420b0133326b 100644 (file)
@@ -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)
index 686d5b3e426f2a9db9eb1bb3b3edc42b1f929c3a..37d99d967714c13f93b59f7bffb0add22ef924a9 100644 (file)
@@ -68,6 +68,17 @@ sub get_param_list {
    type => 't',
    default => 'localhost'
   },
+  {
+   name => 'smtp_username',
+   type => 't',
+   default => '',
+   checker => \&check_smtp_auth
+  },
+  {
+   name => 'smtp_password',
+   type => 'p',
+   default => ''
+  },
   {
    name => 'smtp_debug',
    type => 'b',
index 293740e3fabd48f345fb986332968fd4ecee927b..65df716bc60ceee9242adce064fbdccaec0864e0 100644 (file)
@@ -169,6 +169,12 @@ sub OPTIONAL_MODULES {
         version => 0,
         feature => 'LDAP Authentication'
     },
+    {
+        package => 'SASL-Authen',
+        module  => 'Authen::SASL',
+        version => 0,
+        feature => 'SMTP Authentication'
+    },
     {
         package => 'RadiusPerl',
         module  => 'Authen::Radius',
index 2702b8ff160c3dbb0a71b0775a8a941234718a05..c002fb3db3792cd1c8bb1a01c5baacaa29208498 100644 (file)
@@ -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'};
     }
index 7502c909df80a60f184edec748642e96776dc107..4fd79219494fb56b49e4d0412f259323e947461c 100644 (file)
     <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>
index 904aa2a1cb68c7ccd4c15328d5a9b0bb19d4c38f..800fbad9b047d648f968e25f6bc42a1f93b3081f 100644 (file)
 
   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" _