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:
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})?$
After testing I see that InternetAddress("kuku", true) does validate a domain: Missing final '@domain' in string ``kuku'' So that should be enough.
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.
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)
oVirt 3.5 has been released and should include the fix for this issue.