I have a mailing list script I wrote and some idiot tried to screw things up by adding their name as
xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: Hog(DA913529,email) JmW yB Q eoP . => xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: Yq(DA913529,name)RiatdJ VoyY41ILqAdOjfxkvfKaH8JMobcYw . ::xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: 9joI(DA913529,add1)e6WS1maM J . ::xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: U84QoU(DA913529,add2)wIfhxuNg 97ob4Cn3k0VauKEoM74hIYt . ::xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: qI6(DA913529,city) XN8s Akd xjLmZqTf0s15E4688jkblKj . ::xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: (DA913529,zip)Pxia 3i HvHE0tfDHxxSf0CF6W Kyi0WHeieL BZBAFcszbJGEgO1ha::
Okay, maybe I'm the idiot for not preparing for such attacks. Anyway, I need some regexes to prevent this from happening again.
Can someone help me write a regex that for the email address field will substitute anything after a SPACE or a COMMA will be removed before it gets stored to file? I figure if I remove both of these, it doesn't matter what the person tries to put in as their email address, it'll simply be lost. (unless you know of better ways?)
Another problem is, I'm using your basic sendmail mail script To: $adminmail From: $usermail Subject: $subject.. print mail "$message".... Since each of these fields are being processed through the mail script, I have the feeling they could screw up the script with ANY one of these fields. I can't break on SPACES for the name and address fields as they require spaces between the first and last name. Any ideas on what to do about these? I have -t on with sendmail, so hopeully that is doing something.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.