web/wp-admin/includes/class-ftp.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
   276 		} else {
   276 		} else {
   277 			$ip=@gethostbyname($host);
   277 			$ip=@gethostbyname($host);
   278 	        $dns=@gethostbyaddr($host);
   278 	        $dns=@gethostbyaddr($host);
   279 	        if(!$ip) $ip=$host;
   279 	        if(!$ip) $ip=$host;
   280 	        if(!$dns) $dns=$host;
   280 	        if(!$dns) $dns=$host;
   281 			if(ip2long($ip) === -1) {
   281 	        // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false
       
   282 	        // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid
       
   283 	        $ipaslong = ip2long($ip);
       
   284 			if ( ($ipaslong == false) || ($ipaslong === -1) ) {
   282 				$this->SendMSG("Wrong host name/address \"".$host."\"");
   285 				$this->SendMSG("Wrong host name/address \"".$host."\"");
   283 				return FALSE;
   286 				return FALSE;
   284 			}
   287 			}
   285 	        $this->_host=$ip;
   288 	        $this->_host=$ip;
   286 	        $this->_fullhost=$dns;
   289 	        $this->_fullhost=$dns;