--- formmail.cgi.orig Wed May 10 23:34:09 2000
+++ formmail.cgi Thu May 11 00:14:22 2000
@@ -34,6 +34,13 @@
@referers = ('worldwidemart.com','206.31.72.203');
+# @validrecipients limits what email addresses can receive form submissions;
+# this should be an array of regular expressions. Note that the recipient
+# value should contain only one Internet email address; use an alias or
+# hack the script more if you need/want multiple recipients for one form
+
+@validrecipients = ( '^[a-z]{1,}\@goodguys\.example\.com$' );
+
# Done #
##############################################################################
@@ -175,10 +182,16 @@
# names or environment variables. #
$Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
+ # required fields should have alphanumeric names; this
+ # helps combat cross-site scripting probs in &error()
+ $Config{'required'} =~ s/[^a-zA-Z0-9\_]//gs;
$Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
+ # missing_fields_redirect should not be used to add arbitrary server
+ # headers, etc.; scrub its contents
+ $Config{'missing_fields_redirect'} =~ s/[^a-zA-Z0-9\_\:\/\-]//gs;
# Split the configuration variables into individual field names. #
@Required = split(/,/,$Config{'required'});
@@ -194,6 +207,18 @@
if (!$Config{'recipient'}) {
if (!defined(%Form)) { &error('bad_referer') }
else { &error('no_recipient') }
+ } else {
+ # have recipient; is it OK?
+ $recipientOK = 0;
+ foreach $possibleRecipient ( @validrecipients ) {
+ if ( $Config{'recipient'} =~ /$possibleRecipient/i ) {
+ $recipientOK = 1;
+ last;
+ }
+ }
+ if ( $recipientOK != 1 ) {
+ &error('no_recipient');
+ }
}
# For each require field defined in the form: #
@@ -570,10 +595,10 @@
- | Error: No Recipient |
+ | Error: No Valid Recipient |
- | No Recipient was specified in the data sent to FormMail. Please
+ |
No Valid Recipient was specified in the data sent to FormMail. Please
make sure you have filled in the 'recipient' form field with an e-mail
address. More information on filling in recipient form fields can be
found in the README file.
|