Noam Slomianko has uploaded a new change for review.

Change subject: tools: notifier - add validation to mail type properties
......................................................................

tools: notifier - add validation to mail type properties

Creating smtp requests with FROM/USER properties set to values not in the format
user@domain will fail, so we now enforce it the the bash script

Change-Id: I652d6b7aa9ca34192d6892174bf57b11335cb98a
Bug-Url: https://bugzilla.redhat.com/885436
Signed-off-by: Noam Slomianko <[email protected]>
---
M 
backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/10775/1

diff --git 
a/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh
 
b/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh
index 60c970a..4acb836 100755
--- 
a/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh
+++ 
b/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh
@@ -21,6 +21,13 @@
     die "Error: $1 if defined can not be empty, please check for this in 
configuration file $CONF_FILE\n" 6
 }
 
+check_email_format() {
+       #exit with a message if the property is not in user@domain format
+       if [[ ! ${!1} == *@* ]] ;  then
+       die "Error: $1 must be of the form user@domain"
+    fi
+}
+
 if [ "$1" == "--help" -o "$1" == "-h" ]; then
     usage
     exit 0
@@ -78,6 +85,7 @@
     if [ -z "$MAIL_USER" ]; then
         die_no_propset \$MAIL_USER
     fi
+    check_email_format "MAIL_USER"
 fi
 
 # MAIL_PASSWORD if defined can not be empty
@@ -115,6 +123,7 @@
     if [ -z "$MAIL_FROM" ]; then
         die_no_propset \$MAIL_FROM
     fi
+    check_email_format "MAIL_FROM"
 fi
 
 # MAIL_REPLY_TO if defined can not be empty


--
To view, visit http://gerrit.ovirt.org/10775
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I652d6b7aa9ca34192d6892174bf57b11335cb98a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Noam Slomianko <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to