BUG12070: Its not possible to use the underscore in emailaddresses

Message ID 20190618075535.18313-1-alexander.marx@ipfire.org
State Accepted
Commit cc724c142aa71d9e33d923599f31ec19bd2072e2
Headers
Series BUG12070: Its not possible to use the underscore in emailaddresses |

Commit Message

Alexander Marx June 18, 2019, 5:55 p.m. UTC
  Using IPFire's Mailservice does not allow to enter a senders mail address with the underscore.
The function used to verify that is used from general-functions.pl.
Now the function 'validemail' allows the underscore in the address.

Fixes: #12070
---
 config/cfgroot/general-functions.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tim FitzGeorge June 21, 2019, 8:13 a.m. UTC | #1
On checking with RFC 3696, I think there are many more characters that
are legal in an email address local part.  This includes '@' (although
it has to be quoted), which would completely break validemail if used. 
It's apparently difficult to fully validate the local part of an email
address.

On 18/06/2019 08:55, Alexander Marx wrote:
> Using IPFire's Mailservice does not allow to enter a senders mail address with the underscore.
> The function used to verify that is used from general-functions.pl.
> Now the function 'validemail' allows the underscore in the address.
>
> Fixes: #12070
> ---
>  config/cfgroot/general-functions.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
> index 04e36969c..aefcfb687 100644
> --- a/config/cfgroot/general-functions.pl
> +++ b/config/cfgroot/general-functions.pl
> @@ -784,7 +784,7 @@ sub validemail {
>      return 0 if ( substr($parts[1],-1,1) eq '.' );
>  
>      #check first addresspart (before '@' sign)
> -    return 0 if  ( $parts[0] !~ m/^[a-zA-Z0-9\.!\-\+#]+$/ );
> +    return 0 if  ( $parts[0] !~ m/^[a-zA-Z0-9\.!\-\_\+#]+$/ );
>  
>      #check second addresspart (after '@' sign)
>      return 0 if  ( $parts[1] !~ m/^[a-zA-Z0-9\.\-]+$/ );
  

Patch

diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index 04e36969c..aefcfb687 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -784,7 +784,7 @@  sub validemail {
     return 0 if ( substr($parts[1],-1,1) eq '.' );
 
     #check first addresspart (before '@' sign)
-    return 0 if  ( $parts[0] !~ m/^[a-zA-Z0-9\.!\-\+#]+$/ );
+    return 0 if  ( $parts[0] !~ m/^[a-zA-Z0-9\.!\-\_\+#]+$/ );
 
     #check second addresspart (after '@' sign)
     return 0 if  ( $parts[1] !~ m/^[a-zA-Z0-9\.\-]+$/ );