aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2014-10-21 12:09:31 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2014-10-21 12:09:31 +0200
commit959d0d72497870b56aedf5db7df534ff4f2ccef6 (patch)
tree9fc66ded6653493bae4380668b7693346d57a706
parentBug 1082887: comments made when setting a flag from the attachment details pa... (diff)
downloadbugzilla-959d0d72497870b56aedf5db7df534ff4f2ccef6.tar.gz
bugzilla-959d0d72497870b56aedf5db7df534ff4f2ccef6.tar.bz2
bugzilla-959d0d72497870b56aedf5db7df534ff4f2ccef6.zip
Bug 1083737: Validate the smtpserver parameter
r=dkl a=glob
-rw-r--r--Bugzilla/Config/Common.pm15
-rw-r--r--Bugzilla/Config/MTA.pm3
2 files changed, 16 insertions, 2 deletions
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index 0e3551d13..b69ccb543 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -23,7 +23,7 @@ use base qw(Exporter);
qw(check_multi check_numeric check_regexp check_url check_group
check_sslbase check_priority check_severity check_platform
check_opsys check_shadowdb check_urlbase check_webdotbase
- check_user_verify_class check_ip
+ check_user_verify_class check_ip check_smtp_server
check_mail_delivery_method check_notification check_utf8
check_bug_status check_smtp_auth check_theschwartz_available
check_maxattachmentsize check_email check_smtp_ssl
@@ -325,6 +325,19 @@ sub check_notification {
return "";
}
+sub check_smtp_server {
+ my $host = shift;
+ my $port;
+
+ if ($host =~ /:/) {
+ ($host, $port) = split(/:/, $host, 2);
+ unless ($port && detaint_natural($port)) {
+ return "Invalid port. It must be an integer (typically 25, 465 or 587)";
+ }
+ }
+ return "";
+}
+
sub check_smtp_auth {
my $username = shift;
if ($username and !Bugzilla->feature('smtp_auth')) {
diff --git a/Bugzilla/Config/MTA.pm b/Bugzilla/Config/MTA.pm
index 8184b9f5e..e6e9505a3 100644
--- a/Bugzilla/Config/MTA.pm
+++ b/Bugzilla/Config/MTA.pm
@@ -49,7 +49,8 @@ sub get_param_list {
{
name => 'smtpserver',
type => 't',
- default => 'localhost'
+ default => 'localhost',
+ checker => \&check_smtp_server
},
{
name => 'smtp_username',