File: 001_plus-in-emailaddress.dpatch

package info (click to toggle)
libmail-sendeasy-perl 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 104 kB
  • ctags: 77
  • sloc: perl: 805; makefile: 45; sh: 32
file content (36 lines) | stat: -rw-r--r-- 1,102 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh /usr/share/dpatch/dpatch-run
## 001_plus-in-emailaddress.dpatch by Michael Mende <debian@menole.net>
## 
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: The e-mail syntax checker does not handle plus signs in usernames.
## DP: Let Mail::RFC822::Address do the address syntax check.

diff -urNad /tmp/SendEasy.pm libmail-sendeasy-perl-1.2/lib/Mail/SendEasy.pm
--- /tmp/SendEasy.pm	2004-04-09 07:48:46.000000000 +0000
+++ libmail-sendeasy-perl-1.2/lib/Mail/SendEasy.pm	2008-02-05 10:12:12.000000000 +0000
@@ -17,6 +17,7 @@
 no warnings ;
 
 use vars qw($VERSION @ISA) ;
+use Mail::RFC822::Address qw(valid);
 
 $VERSION = '1.2' ;
 
@@ -444,15 +446,7 @@
   
   my ( $mail ) = @_ ;
   
-  my $stat = 1 ;
-  
-  if ($mail !~ /^[\w\.-]+\@localhost$/gsi) {
-    if ($mail !~ /^[\w\.-]+\@(?:[\w-]+\.)*?(?:\w+(?:-\w+)*)(?:\.\w+)+$/ ) { $stat = undef ;}
-  }
-  elsif ($mail !~ /^[\w\.-]+\@[\w-]+$/ ) { $stat = undef ;}
-  
-  return 1 if $stat ;
-  return undef ;
+  return Mail::RFC822::Address::valid($mail) ? 1 : undef;
 }
 
 ################