From 544d8d9cefcf95a0e53c7a630c193bf860b91f83 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" Date: Mon, 14 Jun 1999 17:33:52 +0000 Subject: [PATCH] Added the ability to configure bugzilla so that we only allow local usernames for email addresses. git-svn-id: svn://10.0.0.236/trunk@35141 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/CGI.pl | 12 ++++++------ mozilla/webtools/bugzilla/defparams.pl | 16 ++++++++++++++++ mozilla/webtools/bugzilla/processmail | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mozilla/webtools/bugzilla/CGI.pl b/mozilla/webtools/bugzilla/CGI.pl index 20e813c98d3..ad15503bf8a 100644 --- a/mozilla/webtools/bugzilla/CGI.pl +++ b/mozilla/webtools/bugzilla/CGI.pl @@ -316,16 +316,15 @@ sub quietly_check_login() { sub CheckEmailSyntax { my ($addr) = (@_); - if ($addr !~ /^[^@, ]*@[^@, ]*\.[^@, ]*$/) { + my $match = Param('emailregexp'); + if ($addr !~ /$match/) { print "Content-type: text/html\n\n"; print "

Invalid e-mail address entered.

\n"; print "The e-mail address you entered\n"; print "($addr) didn't match our minimal\n"; - print "syntax checking for a legal email address. A legal\n"; - print "address must contain exactly one '\@', and at least one\n"; - print "'.' after the \@, and may not contain any commas or.\n"; - print "spaces.\n"; + print "syntax checking for a legal email address.\n"; + print Param('emailregexpdesc'); print "

Please click back and try again.\n"; exit; } @@ -351,7 +350,8 @@ To use the wonders of bugzilla, you can use the following: (Your bugzilla and CVS password, if any, are not currently synchronized. Top hackers are working around the clock to fix this, as you read this.) "; - my $msg = sprintf($template, $login, $login, $password); + my $msg = sprintf($template, $login . Param('emailsuffix'), + $login, $password); open SENDMAIL, "|/usr/lib/sendmail -t"; print SENDMAIL $msg; diff --git a/mozilla/webtools/bugzilla/defparams.pl b/mozilla/webtools/bugzilla/defparams.pl index c471ebd6219..2f4bef52e84 100644 --- a/mozilla/webtools/bugzilla/defparams.pl +++ b/mozilla/webtools/bugzilla/defparams.pl @@ -307,5 +307,21 @@ DefParam("expectbigqueries", "b", 0); +DefParam("emailregexp", + 'This defines the regexp to use for legal email addresses. The default tries to match fully qualified email addresses. Another popular value to put here is ^[^@, ]$, which means "local usernames, no @ allowed.', + "t", + q:^[^@, ]*@[^@, ]*\\.[^@, ]*$:); + +DefParam("emailregexpdesc", + "This describes in english words what kinds of legal addresses are allowed by the emailregexp param.", + "l", + "A legal address must contain exactly one '\@', and at least one '.' after the \@, and may not contain any commas or spaces."); + +DefParam("emailsuffix", + "This is a string to append to any email addresses when actually sending mail to that address. It is useful if you have changed the emailregexp param to only allow local usernames, but you want the mail to be delivered to username\@my.local.hostname.", + "t", + ""); + + 1; diff --git a/mozilla/webtools/bugzilla/processmail b/mozilla/webtools/bugzilla/processmail index a04bed6ab39..a0a080b16a4 100755 --- a/mozilla/webtools/bugzilla/processmail +++ b/mozilla/webtools/bugzilla/processmail @@ -239,7 +239,7 @@ sub fixaddresses { } if (!defined $::nomail{$i} && !defined $seen{$i}) { - push @result, $i; + push(@result, $i . Param('emailsuffix')); $seen{$i} = 1; } }