Bug 1109169

Summary: [Admin Portal] root@localhost is not accepted as valid mail for event notifications
Product: [Retired] oVirt Reporter: Jiri Belka <jbelka>
Component: ovirt-engine-webadminAssignee: Mooli Tayer <mtayer>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.5CC: ecohen, gklein, iheim, mgoldboi, mtayer, obasan, oourfali, rbalakri, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: ovirt-engine-3.5.0_beta Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 12:24:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Belka 2014-06-13 11:52:42 UTC
Description of problem:
root@localhost is not accepted as valid mail for event notifications. sorry but this is wrong. engine is too clever where it should not be.

it works via `mail' command:

>N  1 PostgreSQL Server     Fri Jun 13 13:47  18/763   "testovic"
& 1
Message  1:
From postgres.lab.eng.brq.redhat.com  Fri Jun 13 13:47:34 2014
Return-Path: <postgres.lab.eng.brq.redhat.com>
X-Original-To: root@localhost
Delivered-To: root.lab.eng.brq.redhat.com
Date: Fri, 13 Jun 2014 13:47:34 +0200
To: root.lab.eng.brq.redhat.com
Subject: testovic
User-Agent: Heirloom mailx 12.4 7/29/08
Content-Type: text/plain; charset=us-ascii
From: postgres.lab.eng.brq.redhat.com (PostgreSQL Server)
Status: R

cus bus autobus

Thus, re-think if being too clever makes sense while checking mail address.

Version-Release number of selected component (if applicable):
ovirt-engine-webadmin-portal-3.5.0-0.0.master.20140605145557.git3ddd2de.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. root@localhost for a event, click OK
2. not saved in the DB, not visible in UI
3.

Actual results:
root@localhost not accepted

Expected results:
should work

Additional info:

Comment 1 Mooli Tayer 2014-06-15 07:19:00 UTC
When a user attempts to register in the UI,
in EventSubscriptionCommandBase we use this ad hook regexp:
^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$

when emails are registered through config files we do 
new InternetAddress(recipient) and we do that only upon send attempt
and not registration. 

I think we should validate in the UI using more then what InternetAddress() gives (even when using the strict form this does not enforce domain according to javadoc) Maybe we can use:

^[\w-]+(?:\.[\w-]+)*@[\w-]+(?:\.[a-zA-Z]{2,7})?$

Comment 2 Mooli Tayer 2014-06-15 08:12:48 UTC
After testing I see that InternetAddress("kuku", true) does validate a domain:
Missing final '@domain' in string ``kuku'' 

So that should be enough.

Comment 3 Mooli Tayer 2014-06-26 12:51:41 UTC
In constrast to my previous comment strict InternetAddress validation does
not allow simple names so that was used here.

'root@localhost' should now be accepted through the UI.
'root' should not.

Comment 4 Jiri Belka 2014-07-14 12:12:29 UTC
ok, ovirt-engine-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch

engine=# select * from event_subscriber ;
            subscriber_id             | event_up_name | method_address | tag_name | notification_method 
--------------------------------------+---------------+----------------+----------+---------------------
 fdfc627c-d875-11e0-90f0-83df133b58cc | VDS_FAILURE   | root@localhost |          | smtp
(1 row)

Comment 5 Sandro Bonazzola 2014-10-17 12:24:28 UTC
oVirt 3.5 has been released and should include the fix for this issue.