Exemplo n.º 1
0
 /**
  * Returns true if the username and password work and false if they are
  * wrong or don't exist.
  *
  * @param string $username The username (with system magic quotes)
  * @param string $password The password (with system magic quotes)
  * @return bool Authentication success or failure.
  */
 function user_login($username, $password)
 {
     require_once 'Auth/RADIUS.php';
     // Added by Clive on 7th May for test purposes
     // printf("Username: $username <br/>");
     // printf("Password: $password <br/>");
     // printf("host: $this->config->host <br/>");
     // printf("nasport: $this->config->nasport <br/>");
     // printf("secret: $this->config->secret <br/>");
     $rauth = new Auth_RADIUS_PAP(stripslashes($username), stripslashes($password));
     $rauth->addServer($this->config->host, $this->config->nasport, $this->config->secret);
     if (!$rauth->start()) {
         printf("Radius start: %s<br/>\n", $rauth->getError());
         exit;
     }
     $result = $rauth->send();
     if (PEAR::isError($result)) {
         printf("Radius send failed: %s<br/>\n", $result->getMessage());
         exit;
     } else {
         if ($result === true) {
             // printf("Radius Auth succeeded<br/>\n");
             return true;
         } else {
             // printf("Radius Auth rejected<br/>\n");
             return false;
         }
     }
     // get attributes, even if auth failed
     if (!$rauth->getAttributes()) {
         printf("Radius getAttributes: %s<br/>\n", $rauth->getError());
     } else {
         $rauth->dumpAttributes();
     }
     $rauth->close();
 }
Exemplo n.º 2
0
 /**
  * Frees resources.
  *
  * Calling this method is always a good idea, because all security relevant
  * attributes are filled with Nullbytes to leave nothing in the mem.
  *
  * @access public
  */
 function close()
 {
     Auth_RADIUS_PAP::close();
     $this->challenge = str_repeat("", strlen($this->challenge));
     $this->response = str_repeat("", strlen($this->response));
 }
Exemplo n.º 3
0
 /**
  * Frees resources.
  *
  * Calling this method is always a good idea, because all security relevant
  * attributes are filled with Nullbytes to leave nothing in the mem.
  */
 public function close()
 {
     parent::close();
     $this->challenge = str_repeat("", strlen($this->challenge));
     $this->response = str_repeat("", strlen($this->response));
 }