Commit 959d0d72 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 1083737: Validate the smtpserver parameter

r=dkl a=glob
parent bad9ac71
......@@ -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')) {
......
......@@ -49,7 +49,8 @@ sub get_param_list {
{
name => 'smtpserver',
type => 't',
default => 'localhost'
default => 'localhost',
checker => \&check_smtp_server
},
{
name => 'smtp_username',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment