All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/resource_form_handlers.js c ...
Date: 5 Feb 2008 19:32:04 -0000	[thread overview]
Message-ID: <20080205193204.31921.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2008-02-05 19:32:04

Modified files:
	luci/cluster   : resource_form_handlers.js 
	                 validate_config_multicast.js 
	luci/plone-custom: conga.js 

Log message:
	Fix 431105

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga.js.diff?cvsroot=cluster&r1=1.12&r2=1.13

--- conga/luci/cluster/resource_form_handlers.js	2008/01/02 20:52:22	1.42
+++ conga/luci/cluster/resource_form_handlers.js	2008/02/05 19:32:04	1.43
@@ -101,12 +101,13 @@
 	}
 
 	var ipstr =	form.ip_address.value;
-	var err = isValidHost(ipstr);
+	var err = isValidHost(ipstr, true);
 	if (err) {
 		errors.push('Error: \"' + ipstr + '\": ' + err);
 		set_form_err(form.ip_address);
-	} else
+	} else {
 		clr_form_err(form.ip_address);
+	}
 
 	return (errors);
 }
--- conga/luci/cluster/validate_config_multicast.js	2008/01/02 20:52:22	1.9
+++ conga/luci/cluster/validate_config_multicast.js	2008/02/05 19:32:04	1.10
@@ -74,9 +74,9 @@
 			errors.push('No multicast address was given.');
 			set_form_err(form.mcast_address);
 		} else {
-			var err = isValidHost(form.mcast_address.value);
+			var err = isValidHost(form.mcast_address.value, true);
 			if (err) {
-				errors.push(err);
+				errors.push('Error: \"' + form.mcast_address.value + '\": ' + err);
 				set_form_err(form.mcast_address);
 			}
 			clr_form_err(form.mcast_address);
--- conga/luci/plone-custom/conga.js	2008/01/22 15:02:33	1.12
+++ conga/luci/plone-custom/conga.js	2008/02/05 19:32:04	1.13
@@ -196,18 +196,22 @@
 	}
 }
 
-function isValidHost(str) {
+function isValidHost(str, iponly) {
 	var i = str.split('.');
 
 	if (i.length === 1) {
-		return ('Hostnames must be fully qualified.');
+		if (iponly) {
+			return ('You must enter an IP address in quad-dot notation.');
+		} else {
+			return ('Hostnames must be fully qualified.');
+		}
 	}
 
-	if (i.length === 4 && !isNaN(parseInt(i[3]))) {
-		var o1 = parseInt(i[0]);
-		var o2 = parseInt(i[1]);
-		var o3 = parseInt(i[2]);
-		var o4 = parseInt(i[3]);
+	if (i.length === 4 && !isNaN(parseInt(i[3], 10))) {
+		var o1 = parseInt(i[0], 10);
+		var o2 = parseInt(i[1], 10);
+		var o3 = parseInt(i[2], 10);
+		var o4 = parseInt(i[3], 10);
 
 		if (isNaN(o1) || isNaN(o2) || isNaN(o3) ||
 			((o1 & 0xff) !== o1) ||
@@ -215,17 +219,21 @@
 			((o3 & 0xff) !== o3) ||
 			((o4 & 0xff) !== o4))
 		{
-			return ('Invalid IP Address.');
+			return ('Invalid IP address.');
 		}
 
 		return (null);
 	}
 
-	if (!isNaN(parseInt(i[i.length - 1]))) {
-		return ('Invalid IP Address.');
+	if (!isNaN(parseInt(i[i.length - 1], 10))) {
+		return ('Invalid IP address.');
+	}
+
+	if (iponly) {
+		return ('You must enter an IP address in quad-dot notation.');
 	}
 
-	if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.-]*$/)) {
+	if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.\-]*$/)) {
 		return ('Hostnames can contain only alphanumeric characters and hyphens.');
 	}
 



             reply	other threads:[~2008-02-05 19:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 19:32 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-20 20:19 [Cluster-devel] conga/luci cluster/resource_form_handlers.js c rmccabe
2006-10-04 17:24 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080205193204.31921.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.