[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] admin/web/build/mproxy ip.js,1.2,1.2.48.1
From:       svaidhya () helixcommunity ! org
Date:       2009-05-30 21:02:05
Message-ID: 20090530220646.347B130AD9E () pukcab ! korelogic ! com
[Download RAW message or body]

Update of /cvsroot/server/admin/web/build/mproxy
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv31560

Modified Files:
      Tag: SERVER_13_0
	ip.js 
Log Message:
Synopsis
========
Admin system needs to universally accept (and add) brackets around IPv6 addresses


Branches:  SERVER_CURRENT, SERVER_13_0
eviewer(s):  Chytanya


Description
===========

The server requires the IPv6 address to be enclosed within square brackets. But the \
admin system does not allow [] in any address.

There are 2 things to be taken care of:

1. If the IP Address is enclosed within [], the admin system should recognize it as a \
valid IP Address

   Made changes to a couple of places (common code used by all pages containing an IP \
Address input  field) to recognize [] as a valid IP v6 address.

2. If the an IPv6 address is not enclosed inside Sq bracket the admin system puts it \
within [] and  write to config file.

   Implementing this would take sometime. So for now if the user enters a valid IPv6 \
adress w/o  square bracktes, the admin sys would prompt the user to enclose IP \
Address within [].


Files Affected
==============
./server/admin/web/src/js/ip.js.wasm
./server/admin/web/src/js/client.js.wasm

HTML Files

./server/admin/web/build/(*)/ip.js
./server/admin/web/build/(*)/client.js


Testing Performed
=================
Unit Tests:
None.

Integration Tests:
- Verified the following

  - When an IPv6 Address WITH [] is entered, admin system accepts it and writes the \
address with []  in the config file.
  - When an IPv6 Address WITHOUT [] is entered, admin system  prompts the user to \
                enter it with []
  - When an IPv6 Address WITH MULTIPLE [] is entered, admin system complains about \
the IP being  invalid
  - When an IPv4 Address WITH [] is entered, admin system complains about the IP \
being  invalid
  - When an IPv4 Address WITHOUT [] is entered, admin system accepts it and writes \
the address  in the config file.

Leak Tests:
- None.

Performance Tests:
None.

Platforms Tested:  win32-i386-vc7
Build verified:    win32-i386-vc7 


Index: ip.js
===================================================================
RCS file: /cvsroot/server/admin/web/build/mproxy/ip.js,v
retrieving revision 1.2
retrieving revision 1.2.48.1
diff -u -d -r1.2 -r1.2.48.1
--- ip.js	25 May 2007 19:33:42 -0000	1.2
+++ ip.js	30 May 2009 21:02:03 -0000	1.2.48.1
@@ -6,8 +6,27 @@
 
 function IPAddress ( sIPAddress )
 {
+    this.hasBracket = false;
+
+    if (!(isBlank(sIPAddress)))
+    {
+	var trimIPAddr = sIPAddress.trim();
+	if (trimIPAddr.bSearch(/^\[.*\]$/))
+	{
+	    this.hasBracket = true;
+	    var len = trimIPAddr.length;
+	    this.sAddress = trimIPAddr.substring(1,len-1);
+	}
+	else
+	{
+	    this.sAddress = trimIPAddr;
+	}
+    }
+    else
+    {
 	this.sAddress = sIPAddress;
-    this.sAddressNoPrefix = sIPAddress;
+    }
+    this.sAddressNoPrefix = this.sAddress;
 
 	this.isValid = false;
 	this.errMsg = "";
@@ -38,7 +57,22 @@
 		    this.errMsg = "Invalid IPv6 Address.";
         }
 	}
-	    
+	else if (this.isValid )
+	{
+            //v6 addresses should be enclosed within the bracket
+	    if (this.isIPv6 && !(this.hasBracket))
+	    {
+		this.isValid = false;
+		this.errMsg = "Please enclose the IPv6 address within Square Brackets []";
+	    }
+            //v4 addresses should NOT be enclose within brackets
+	    if (this.isIPv4 && this.hasBracket)
+	    {
+		this.isValid = false;
+		this.errMsg = "Please remove brackets around the IP Address";
+	    }
+	}
+    
     return this;
     	
 }	// 


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic