cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] conga/luci cluster/resource_form_handlers.js c ...
@ 2008-02-05 19:32 rmccabe
  0 siblings, 0 replies; 3+ messages in thread
From: rmccabe @ 2008-02-05 19:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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.');
 	}
 



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Cluster-devel] conga/luci cluster/resource_form_handlers.js c ...
@ 2007-06-20 20:19 rmccabe
  0 siblings, 0 replies; 3+ messages in thread
From: rmccabe @ 2007-06-20 20:19 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-06-20 20:19:34

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

Log message:
	Fix bz245025: Conga does not accept '&' character in password field for Fence

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.7&r2=1.20.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2

--- conga/luci/cluster/resource_form_handlers.js	2007/06/18 18:39:31	1.20.2.7
+++ conga/luci/cluster/resource_form_handlers.js	2007/06/20 20:19:34	1.20.2.8
@@ -500,12 +500,12 @@
 			if (res_type == 'hidden' || res_type == 'text' ||
 				res_type == 'password')
 			{
-				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
+				temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '" value="' + escapeXML(input_elem[j].value) + '" />';
 			} else if (res_type == 'checkbox' || res_type == 'radio') {
 				if (input_elem[j].checked) {
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"';
+					temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '" checked="checked"';
 					if (res_type == 'radio')
-						temp += ' value="' + input_elem[j].value + '"';
+						temp += ' value="' + escapeXML(input_elem[j].value) + '"';
 					temp += ' />';
 				}
 			}
@@ -513,11 +513,11 @@
 
 		var select_elem = form[i].getElementsByTagName('select');
 		for (var j = 0 ; j < select_elem.length ; j++) {
-			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
+			temp += '<input type="text" name="' + escapeXML(select_elem[j].name) + '" value="' + escapeXML(select_elem[j].options[select_elem[j].options.selectedIndex].value) + '" />';
 		}
 
-		form_xml += '<form id="' + form[i].uuid.value + '" parent="' +
-					form[i].parent_uuid.value + '">' + temp + '</form>';
+		form_xml += '<form id="' + escapeXML(form[i].uuid.value) + '" parent="' +
+					escapeXML(form[i].parent_uuid.value) + '">' + temp + '</form>';
 	}
 
 	if (!svc_name)
--- conga/luci/cluster/validate_fence.js	2007/03/01 00:31:08	1.1.2.1
+++ conga/luci/cluster/validate_fence.js	2007/06/20 20:19:34	1.1.2.2
@@ -218,27 +218,27 @@
 			if (res_type == 'hidden' || res_type == 'text' ||
 				res_type == 'password')
 			{
-				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
+				temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '" value="' + escapeXML(input_elem[j].value) + '" />';
 			} else if (res_type == 'checkbox' || res_type == 'radio') {
 				if (input_elem[j].checked) {
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '"';
+					temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '"';
 					if (res_type == 'checkbox')
 						temp += ' value="1"';
 					else if (res_type == 'radio')
-						temp += ' value="' + input_elem[j].value + '"';
+						temp += ' value="' + escapeXML(input_elem[j].value) + '"';
 					temp += ' />';
 				} else if (res_type == 'checkbox') {
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="0" />';
+					temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '" value="0" />';
 				}
 			}
 		}
 
 		var select_elem = form[i].getElementsByTagName('select');
 		for (var j = 0 ; j < select_elem.length ; j++) {
-			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
+			temp += '<input type="text" name="' + escapeXML(select_elem[j].name) + '" value="' + escapeXML(select_elem[j].options[select_elem[j].options.selectedIndex].value) + '" />';
 		}
 
-		form_xml += '<form id="' + form[i].getAttribute('name') + '">' + temp + '</form>';
+		form_xml += '<form id="' + escapeXML(form[i].getAttribute('name')) + '">' + temp + '</form>';
 	}
 
 	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
--- conga/luci/plone-custom/conga.js	2006/11/16 19:34:53	1.3.2.1
+++ conga/luci/plone-custom/conga.js	2007/06/20 20:19:34	1.3.2.2
@@ -5,6 +5,12 @@
 	return (0);
 }
 
+function escapeXML(str) {
+	if (!str)
+		return '';
+	return str.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;').replace('\'', '&apos;');
+}
+
 function popup_window(url, width_percent, height_percent) {
 	var width = window.innerWidth * (width_percent / 100);
 	var height = window.innerHeight * (height_percent / 100);



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Cluster-devel] conga/luci cluster/resource_form_handlers.js c ...
@ 2006-10-04 17:24 rmccabe
  0 siblings, 0 replies; 3+ messages in thread
From: rmccabe @ 2006-10-04 17:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-10-04 17:24:58

Modified files:
	luci/cluster   : resource_form_handlers.js 
	                 validate_config_general.js 
	                 validate_config_multicast.js 
	                 validate_config_qdisk.js 
	luci/homebase  : homebase_common.js 

Log message:
	fix some javascript messiness

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_general.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.12&r2=1.13

--- conga/luci/cluster/resource_form_handlers.js	2006/10/04 16:42:05	1.18
+++ conga/luci/cluster/resource_form_handlers.js	2006/10/04 17:24:58	1.19
@@ -228,13 +228,13 @@
 	var errors = valfn(form);
 	if (form.type.value != 'ip') {
 		if (!form.resourceName || str_is_blank(form.resourceName.value)) {
-			errors.push('No resource name was given.')
+			errors.push('No resource name was given.');
 			set_form_err(form.resourceName);
 		} else
 			clr_form_err(form.resourceName);
 	}
 
-	return (errors)
+	return (errors);
 }
 
 function validate_form(form) {
@@ -396,7 +396,7 @@
 	}
 
 	if (!form_xml)
-		errors.push('No resource information was submitted.')
+		errors.push('No resource information was submitted.');
 
 	if (error_dialog(errors))
 		return (-1);
--- conga/luci/cluster/validate_config_general.js	2006/09/27 22:24:11	1.2
+++ conga/luci/cluster/validate_config_general.js	2006/10/04 17:24:58	1.3
@@ -14,7 +14,7 @@
 	if (!form.cfgver || str_is_blank(form.cfgver.value)) {
 		errors.push('You did not specify a configuration version.');
 		set_form_err(form.cfgver);
-	else
+	} else
 		ver = form.cfgver.value;
 
 	if (ver && !is_valid_int(ver, 0, null)) {
--- conga/luci/cluster/validate_config_multicast.js	2006/09/27 22:24:11	1.2
+++ conga/luci/cluster/validate_config_multicast.js	2006/10/04 17:24:58	1.3
@@ -39,7 +39,7 @@
 		set_form_err(form.mcast[1]);
 	}
 
-	if (mcast != null) {
+	if (mcast !== null) {
 		clr_form_err(form.mcast[0]);
 		clr_form_err(form.mcast[1]);
 		clr_form_err(form.mcast_address);
--- conga/luci/cluster/validate_config_qdisk.js	2006/09/27 22:24:11	1.3
+++ conga/luci/cluster/validate_config_qdisk.js	2006/10/04 17:24:58	1.4
@@ -44,8 +44,7 @@
 
 	if (!confirm('Delete qurorum disk heuristic ' + (hnum + 1) + '?'))
 		return (-1);
-
-	heur_body.deleteRow(hnum)
+	heur_body.deleteRow(hnum);
 
 	for (var i = hnum + 1 ; i <= num_heur ; i++) {
 		var tr = document.getElementById('heuristic' + i);
@@ -160,7 +159,7 @@
 
 	var qpart = null;
 	if (form.quorumd[0].checked)
-		qpart = 0
+		qpart = 0;
 	else if (form.quorumd[1].checked)
 		qpart = 1;
 	else {
@@ -170,7 +169,7 @@
 		return (error_dialog(errors));
 	}
 
-	if (qpart != null) {
+	if (qpart !== null) {
 		clr_form_err(form.quorumd[0]);
 		clr_form_err(form.quorumd[1]);
 	}
@@ -241,7 +240,7 @@
 		var hnum = document.getElementById('num_heuristics');
 		if (hnum) {
 			hnum = Number(hnum.value);
-			if (hnum == 0)
+			if (hnum === 0)
 				hnum++;
 			for (var i = 0 ; i < hnum ; i++) {
 				var err = check_heuristic(i, form);
@@ -254,7 +253,7 @@
 	if (error_dialog(errors))
 		return (-1);
 	if (confirm('Update quorum partition properties?'))
-		form.submit()
+		form.submit();
 }
 
 var oldInput = null;
--- conga/luci/homebase/homebase_common.js	2006/09/27 22:49:09	1.12
+++ conga/luci/homebase/homebase_common.js	2006/10/04 17:24:58	1.13
@@ -14,9 +14,9 @@
 	var val = parseInt(str, 10);
 	if (isNaN(val))
 		return (0);
-	if (min != null && val < min)
+	if (min !== null && val < min)
 		return (0);
-	if (max != null && val > max)
+	if (max !== null && val > max)
 		return (0);
 	return (1);
 }
@@ -51,9 +51,9 @@
 
 function checkChildren(parent_cont, parent_input) {
 	if (!parent_cont || !parent_input)
-		return
-	parent = document.getElementById(parent_cont);
-	children = parent.getElementsByTagName('input')
+		return;
+	var parent = document.getElementById(parent_cont);
+	var children = parent.getElementsByTagName('input');
 	for (var i = 0 ; i < children.length ; i++) {
 		if (children[i] == parent_input)
 			continue;
@@ -118,7 +118,7 @@
 		passwd = '';
 
 	for (var i = 1 ; i < num_systems ; i++) {
-		var element = document.getElementById('__SYSTEM' + i + ':Passwd')
+		var element = document.getElementById('__SYSTEM' + i + ':Passwd');
 		if (element && element.type == 'password') {
 			element.value = passwd;
 			element.disabled = state;
@@ -161,16 +161,16 @@
 
 	var newrow = document.createElement('tr');
 	newrow.className = 'systemsTable';
-	var hcol = document.createElement('td')
+	var hcol = document.createElement('td');
 	hcol.className = 'systemsTable';
-	var pcol = document.createElement('td')
+	var pcol = document.createElement('td');
 	pcol.className = 'systemsTable';
 
-	hcol.appendChild(newsys)
-	pcol.appendChild(newsysp)
-	newrow.appendChild(hcol)
-	newrow.appendChild(pcol)
-	sltab.appendChild(newrow)
+	hcol.appendChild(newsys);
+	pcol.appendChild(newsysp);
+	newrow.appendChild(hcol);
+	newrow.appendChild(pcol);
+	sltab.appendChild(newrow);
 
 	form.numStorage.value = ++num_systems;
 	if (num_systems == 2) {



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-05 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05 19:32 [Cluster-devel] conga/luci cluster/resource_form_handlers.js c rmccabe
  -- strict thread matches above, loose matches on Subject: below --
2007-06-20 20:19 rmccabe
2006-10-04 17:24 rmccabe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).