bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Thank you all!#!/usr/bin/perl print "Content-type: text/plain\n\n"; use strict; use warnings; use Validate; use CGI qw(:standard); my @errors; my $sendto = Validate->alphanum (param('sendto')); push @errors, "Missing or invalid addressee\n" unless $sendto; my $email = Validate->email (param('email')); push @errors, "Missing or invalid e-mail address\n" unless $email; # similar untainting for all other user input here, then... if (@errors) { &printerrors; exit; } #-----------send email --------- $sendto .= "\@somewebsite.org"; open(MAIL,"| /usr/lib/sendmail -t") or die "Could not open sendmai +l: $!"; print MAIL "From: $name\n"; print MAIL "To: $sendto\n"; print MAIL "Subject: $subject\n\n"; print MAIL "E-mail: $email\n\n"; print MAIL "Message: $message\n\n"; print MAIL "\n\n"; close MAIL or die "Could not close sendmail: $!"; print "Thanks for your message."; exit; sub printerrors { for (@errors) { print $_."\n" } } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Security of Sendmail and -T error
by shenme (Priest) on Dec 14, 2003 at 04:32 UTC | |
|
Re: Security of Sendmail and -T error
by grinder (Bishop) on Dec 14, 2003 at 11:57 UTC | |
by bradcathey (Prior) on Dec 14, 2003 at 14:10 UTC | |
|
Re: Security of Sendmail and -T error
by liz (Monsignor) on Dec 14, 2003 at 13:04 UTC | |
by bradcathey (Prior) on Dec 14, 2003 at 14:12 UTC | |
|
Re: Security of Sendmail and -T error
by skazat (Chaplain) on Dec 14, 2003 at 06:58 UTC | |
by Thelonius (Priest) on Dec 14, 2003 at 13:37 UTC | |
|
Re: Security of Sendmail and -T error
by Abigail-II (Bishop) on Dec 14, 2003 at 11:31 UTC |