Martin Peřina has uploaded a new change for review. Change subject: tools: Adds more validations to MAIL_PORT in notifier ......................................................................
tools: Adds more validations to MAIL_PORT in notifier Adds more validations to MAIL_PORT option in notifier's configuration. MAIL_PORT has to be an integer from 1 to 65535 inclusively. Change-Id: I770d1636dc25c0c9b0076a92dcac20ddec551acf Bug-Url: https://bugzilla.redhat.com/1051061 Bug-Url: https://bugzilla.redhat.com/1051048 Signed-off-by: Martin Perina <[email protected]> --- M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java 1 file changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/04/23504/1 diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java index 5142ab7..a47688d 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java @@ -147,6 +147,21 @@ )); } + boolean mailPortValid = false; + try { + int port = new Integer(getProperty(MAIL_PORT)); + if (port > 0 && port < 65536) { + mailPortValid = true; + } + } catch (NumberFormatException ex) { + } + if (!mailPortValid) { + throw new IllegalArgumentException( + String.format("Check configuration file, MAIL_PORT value has to be in range from 1 to 65535," + + " currently '%s'", + getProperty(MAIL_PORT))); + } + // try to resolve MAIL_SERVER host try { InetAddress.getAllByName(getProperty(NotificationProperties.MAIL_SERVER)); -- To view, visit http://gerrit.ovirt.org/23504 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I770d1636dc25c0c9b0076a92dcac20ddec551acf Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Martin Peřina <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
