From 2e301b9787ad03451d9ba3cead9ad7c082f6a4c7 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Mon, 20 Apr 2015 16:11:55 +0200
Subject: [PATCH] Move SimpleSAML_Utils_Net to SimpleSAML\Utils\Net.

---
 .../Metadata/MetaDataStorageSource.php        |  2 +-
 lib/SimpleSAML/Utilities.php                  |  4 +--
 lib/SimpleSAML/Utils/Net.php                  |  4 +--
 .../negotiate/lib/Auth/Source/Negotiate.php   |  2 +-
 tests/Utils/NetTest.php                       | 30 +++++++++----------
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php
index 9ee54bd1c..0ce412165 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php
@@ -152,7 +152,7 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource {
 			if(!is_array($entry['hint.cidr'])) continue;
 			
 			foreach ($entry['hint.cidr'] AS $hint_entry) {
-				if (SimpleSAML_Utils_Net::ipCIDRcheck($hint_entry, $ip)) {
+				if (SimpleSAML\Utils\Net::ipCIDRcheck($hint_entry, $ip)) {
 					if ($type === 'entityid') {
 						return $entry['entityid'];
 					} else {
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 6dff8e3fe..92b2fda3c 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -414,10 +414,10 @@ class SimpleSAML_Utilities {
 
 
 	/**
-	 * @deprecated This method will be removed in version 2.0. Use SimpleSAML_Utils_Net::ipCIDRcheck() instead.
+	 * @deprecated This method will be removed in version 2.0. Use SimpleSAML\Utils\Net::ipCIDRcheck() instead.
 	 */
 	static function ipCIDRcheck($cidr, $ip = null) {
-		return SimpleSAML_Utils_Net::ipCIDRcheck($cidr, $ip);
+		return SimpleSAML\Utils\Net::ipCIDRcheck($cidr, $ip);
 	}
 
 	/*
diff --git a/lib/SimpleSAML/Utils/Net.php b/lib/SimpleSAML/Utils/Net.php
index 4f9eb1061..22082b79d 100644
--- a/lib/SimpleSAML/Utils/Net.php
+++ b/lib/SimpleSAML/Utils/Net.php
@@ -1,12 +1,12 @@
 <?php
-
+namespace SimpleSAML\Utils;
 
 /**
  * Net-related utility methods.
  *
  * @package SimpleSAMLphp
  */
-class SimpleSAML_Utils_Net
+class Net
 {
 
     /**
diff --git a/modules/negotiate/lib/Auth/Source/Negotiate.php b/modules/negotiate/lib/Auth/Source/Negotiate.php
index 6feeb9edc..7a3302720 100644
--- a/modules/negotiate/lib/Auth/Source/Negotiate.php
+++ b/modules/negotiate/lib/Auth/Source/Negotiate.php
@@ -184,7 +184,7 @@ class sspmod_negotiate_Auth_Source_Negotiate extends SimpleSAML_Auth_Source {
 			return TRUE;
 		$ip = $_SERVER['REMOTE_ADDR'];
 		foreach ($this->subnet as $cidr) {
-			$ret = SimpleSAML_Utils_Net::ipCIDRcheck($cidr);
+			$ret = SimpleSAML\Utils\Net::ipCIDRcheck($cidr);
 			if ($ret) {
 				SimpleSAML_Logger::debug('Negotiate: Client "'.$ip.'" matched subnet.');
 				return TRUE;
diff --git a/tests/Utils/NetTest.php b/tests/Utils/NetTest.php
index 9d1b47e20..763280227 100644
--- a/tests/Utils/NetTest.php
+++ b/tests/Utils/NetTest.php
@@ -14,29 +14,29 @@ class Utils_Net_Test extends PHPUnit_Framework_TestCase
     public function testIpCIDRcheck()
     {
         // check CIDR w/o mask
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0', '127.0.0.1'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0', '127.0.0.1'));
 
         // check wrong CIDR w/ mask
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.256/24', '127.0.0.1'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.256/24', '127.0.0.1'));
 
         // check wrong IP
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/24', '127.0.0'));
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.*'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/24', '127.0.0'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.*'));
 
         // check limits for standard classes
-        $this->assertTrue(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.0'));
-        $this->assertTrue(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.255'));
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.256'));
+        $this->assertTrue(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.0'));
+        $this->assertTrue(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.255'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/24', '127.0.0.256'));
 
-        $this->assertTrue(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/16', '127.0.0.0'));
-        $this->assertTrue(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/16', '127.0.255.255'));
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/16', '127.0.255.256'));
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/16', '127.0.256.255'));
+        $this->assertTrue(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/16', '127.0.0.0'));
+        $this->assertTrue(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/16', '127.0.255.255'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/16', '127.0.255.256'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/16', '127.0.256.255'));
 
         // check limits for non-standard classes
-        $this->assertTrue(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/23', '127.0.0.0'));
-        $this->assertTrue(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/23', '127.0.1.255'));
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/23', '127.0.1.256'));
-        $this->assertFalse(SimpleSAML_Utils_Net::ipCIDRcheck('127.0.0.0/23', '127.0.2.0'));
+        $this->assertTrue(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/23', '127.0.0.0'));
+        $this->assertTrue(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/23', '127.0.1.255'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/23', '127.0.1.256'));
+        $this->assertFalse(SimpleSAML\Utils\Net::ipCIDRcheck('127.0.0.0/23', '127.0.2.0'));
     }
 }
\ No newline at end of file
-- 
GitLab