Exemplo n.º 1
0
         $allowDeny_forbidden = true;
         if (PMA_allowDeny('allow')) {
             $allowDeny_forbidden = false;
         }
         if (PMA_allowDeny('deny')) {
             $allowDeny_forbidden = true;
         }
     } elseif ($cfg['Server']['AllowDeny']['order'] == 'deny,allow') {
         if (PMA_allowDeny('deny')) {
             $allowDeny_forbidden = true;
         }
         if (PMA_allowDeny('allow')) {
             $allowDeny_forbidden = false;
         }
     } elseif ($cfg['Server']['AllowDeny']['order'] == 'explicit') {
         if (PMA_allowDeny('allow') && !PMA_allowDeny('deny')) {
             $allowDeny_forbidden = false;
         } else {
             $allowDeny_forbidden = true;
         }
     }
     // end if ... elseif ... elseif
     // Ejects the user if banished
     if ($allowDeny_forbidden) {
         PMA_logUser($cfg['Server']['user'], 'allow-denied');
         $auth_plugin->authFails();
     }
 }
 // end if
 // is root allowed?
 if (!$cfg['Server']['AllowRoot'] && $cfg['Server']['user'] == 'root') {
 /**
  * Test for PMA_allowDeny
  *
  * @return void
  */
 public function testPMA_allowDeny()
 {
     $_SERVER['REMOTE_ADDR'] = "";
     $this->assertEquals(false, PMA_allowDeny("allow"));
     $_SERVER['REMOTE_ADDR'] = "255.0.1.0";
     $this->assertEquals(true, PMA_allowDeny("allow"));
     $_SERVER['REMOTE_ADDR'] = "10.0.0.0";
     $this->assertEquals(false, PMA_allowDeny("allow"));
     $_SERVER['REMOTE_ADDR'] = "255.255.0.1";
     $this->assertEquals(true, PMA_allowDeny("deny"));
     $_SERVER['REMOTE_ADDR'] = "255.124.0.5";
     $this->assertEquals(true, PMA_allowDeny("deny"));
     $_SERVER['REMOTE_ADDR'] = "122.124.0.5";
     $this->assertEquals(false, PMA_allowDeny("deny"));
     //IPV6
     $_SERVER['REMOTE_ADDR'] = "2001:4998:c:a0d:0000:0000:4998:1020";
     $this->assertEquals(true, PMA_allowDeny("allow"));
     $_SERVER['REMOTE_ADDR'] = "2001:4998:c:a0d:0000:0000:4998:1000";
     $this->assertEquals(false, PMA_allowDeny("allow"));
     $_SERVER['REMOTE_ADDR'] = "2001:4998:c:a0d:0000:0000:4998:1020";
     $this->assertEquals(true, PMA_allowDeny("allow"));
 }