summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-15 11:14:36 -0200
committerRenato Botelho <renato@netgate.com>2016-01-15 11:14:36 -0200
commit89b7a21d679fdecfb0660facdb798b85834d677c (patch)
tree671d3617098dd84b316cc0431696e5f93fc5dab1 /src
parentb97c7ee5f88658195fc29ce02ea0e9b8e72d4ca6 (diff)
downloadpfsense-89b7a21d679fdecfb0660facdb798b85834d677c.zip
pfsense-89b7a21d679fdecfb0660facdb798b85834d677c.tar.gz
Update sasl classes to last version and remove all style customizations - http://www.phpclasses.org/package/1888-PHP-Single-API-for-standard-authentication-mechanisms.html
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/basic_sasl_client.inc8
-rw-r--r--src/etc/inc/login_sasl_client.inc6
-rw-r--r--src/etc/inc/ntlm_sasl_client.inc26
-rw-r--r--src/etc/inc/plain_sasl_client.inc10
-rw-r--r--src/etc/inc/sasl.inc4
5 files changed, 26 insertions, 28 deletions
diff --git a/src/etc/inc/basic_sasl_client.inc b/src/etc/inc/basic_sasl_client.inc
index c817664..b2972b5 100644
--- a/src/etc/inc/basic_sasl_client.inc
+++ b/src/etc/inc/basic_sasl_client.inc
@@ -21,7 +21,7 @@ class basic_sasl_client_class
Function Start(&$client, &$message, &$interactions)
{
- if ($this->state!=SASL_BASIC_STATE_START)
+ if($this->state!=SASL_BASIC_STATE_START)
{
$client->error="Basic authentication state is not at the start";
return(SASL_FAIL);
@@ -33,21 +33,19 @@ class basic_sasl_client_class
$defaults=array(
);
$status=$client->GetCredentials($this->credentials,$defaults,$interactions);
- if ($status==SASL_CONTINUE)
+ if($status==SASL_CONTINUE)
{
$message=$this->credentials["user"].":".$this->credentials["password"];
$this->state=SASL_BASIC_STATE_DONE;
}
else
- {
Unset($message);
- }
return($status);
}
Function Step(&$client, $response, &$message, &$interactions)
{
- switch ($this->state)
+ switch($this->state)
{
case SASL_BASIC_STATE_DONE:
$client->error="Basic authentication was finished without success";
diff --git a/src/etc/inc/login_sasl_client.inc b/src/etc/inc/login_sasl_client.inc
index f5cc050..923d16e 100644
--- a/src/etc/inc/login_sasl_client.inc
+++ b/src/etc/inc/login_sasl_client.inc
@@ -23,7 +23,7 @@ class login_sasl_client_class
Function Start(&$client, &$message, &$interactions)
{
- if ($this->state!=SASL_LOGIN_STATE_START)
+ if($this->state!=SASL_LOGIN_STATE_START)
{
$client->error="LOGIN authentication state is not at the start";
return(SASL_FAIL);
@@ -37,7 +37,7 @@ class login_sasl_client_class
"realm"=>""
);
$status=$client->GetCredentials($this->credentials,$defaults,$interactions);
- if ($status==SASL_CONTINUE)
+ if($status==SASL_CONTINUE)
$this->state=SASL_LOGIN_STATE_IDENTIFY_USER;
Unset($message);
return($status);
@@ -45,7 +45,7 @@ class login_sasl_client_class
Function Step(&$client, $response, &$message, &$interactions)
{
- switch ($this->state)
+ switch($this->state)
{
case SASL_LOGIN_STATE_IDENTIFY_USER:
$message=$this->credentials["user"].(strlen($this->credentials["realm"]) ? "@".$this->credentials["realm"] : "");
diff --git a/src/etc/inc/ntlm_sasl_client.inc b/src/etc/inc/ntlm_sasl_client.inc
index 18e5658..406edf2 100644
--- a/src/etc/inc/ntlm_sasl_client.inc
+++ b/src/etc/inc/ntlm_sasl_client.inc
@@ -18,12 +18,12 @@ class ntlm_sasl_client_class
Function Initialize(&$client)
{
- if (!function_exists($function="mcrypt_encrypt") ||
- !function_exists($function="hash"))
+ if(!function_exists($function="mcrypt_encrypt")
+ || !function_exists($function="mhash"))
{
$extensions=array(
"mcrypt_encrypt"=>"mcrypt",
- "hash"=>"hash"
+ "mhash"=>"mhash"
);
$client->error="the extension ".$extensions[$function]." required by the NTLM SASL client class is not available in this PHP configuration";
return(0);
@@ -33,7 +33,7 @@ class ntlm_sasl_client_class
Function ASCIIToUnicode($ascii)
{
- for ($unicode="",$a=0;$a<strlen($ascii);$a++)
+ for($unicode="",$a=0;$a<strlen($ascii);$a++)
$unicode.=substr($ascii,$a,1).chr(0);
return($unicode);
}
@@ -62,15 +62,15 @@ class ntlm_sasl_client_class
Function NTLMResponse($challenge,$password)
{
$unicode=$this->ASCIIToUnicode($password);
- $md4=hash("md4", $unicode);
+ $md4=mhash(MHASH_MD4,$unicode);
$padded=$md4.str_repeat(chr(0),21-strlen($md4));
$iv_size=mcrypt_get_iv_size(MCRYPT_DES,MCRYPT_MODE_ECB);
$iv=mcrypt_create_iv($iv_size,MCRYPT_RAND);
- for ($response="",$third=0;$third<21;$third+=7)
+ for($response="",$third=0;$third<21;$third+=7)
{
- for ($packed="",$p=$third;$p<$third+7;$p++)
- $packed.=str_pad(decbin(ord(substr($padded,$p,1))),8,"0",STR_PAD_LEFT);
- for ($key="",$p=0;$p<strlen($packed);$p+=7)
+ for($packed="",$p=$third;$p<$third+7;$p++)
+ $packed.=str_pad(decbin(ord(substr($padded,$p,1))),8,"0",STR_PAD_LEFT);
+ for($key="",$p=0;$p<strlen($packed);$p+=7)
{
$s=substr($packed,$p,7);
$b=$s.((substr_count($s,"1") % 2) ? "0" : "1");
@@ -134,7 +134,7 @@ class ntlm_sasl_client_class
Function Start(&$client, &$message, &$interactions)
{
- if ($this->state!=SASL_NTLM_STATE_START)
+ if($this->state!=SASL_NTLM_STATE_START)
{
$client->error="NTLM authentication state is not at the start";
return(SASL_FAIL);
@@ -147,7 +147,7 @@ class ntlm_sasl_client_class
);
$defaults=array();
$status=$client->GetCredentials($this->credentials,$defaults,$interactions);
- if ($status==SASL_CONTINUE)
+ if($status==SASL_CONTINUE)
$this->state=SASL_NTLM_STATE_IDENTIFY_DOMAIN;
Unset($message);
return($status);
@@ -155,7 +155,7 @@ class ntlm_sasl_client_class
Function Step(&$client, $response, &$message, &$interactions)
{
- switch ($this->state)
+ switch($this->state)
{
case SASL_NTLM_STATE_IDENTIFY_DOMAIN:
$message=$this->TypeMsg1($this->credentials["realm"],$this->credentials["workstation"]);
@@ -177,4 +177,4 @@ class ntlm_sasl_client_class
}
};
-?>
+?> \ No newline at end of file
diff --git a/src/etc/inc/plain_sasl_client.inc b/src/etc/inc/plain_sasl_client.inc
index 691580c..c7feed0 100644
--- a/src/etc/inc/plain_sasl_client.inc
+++ b/src/etc/inc/plain_sasl_client.inc
@@ -26,7 +26,7 @@ class plain_sasl_client_class
Function Start(&$client, &$message, &$interactions)
{
- if ($this->state!=SASL_PLAIN_STATE_START)
+ if($this->state!=SASL_PLAIN_STATE_START)
{
$client->error="PLAIN authentication state is not at the start";
return(SASL_FAIL);
@@ -42,9 +42,9 @@ class plain_sasl_client_class
"mode"=>""
);
$status=$client->GetCredentials($this->credentials,$defaults,$interactions);
- if ($status==SASL_CONTINUE)
+ if($status==SASL_CONTINUE)
{
- switch ($this->credentials["mode"])
+ switch($this->credentials["mode"])
{
case SASL_PLAIN_EXIM_MODE:
$message=$this->credentials["user"]."\0".$this->credentials["password"]."\0";
@@ -65,11 +65,11 @@ class plain_sasl_client_class
Function Step(&$client, $response, &$message, &$interactions)
{
- switch ($this->state)
+ switch($this->state)
{
/*
case SASL_PLAIN_STATE_IDENTIFY:
- switch ($this->credentials["mode"])
+ switch($this->credentials["mode"])
{
case SASL_PLAIN_EXIM_MODE:
$message=$this->credentials["user"]."\0".$this->credentials["password"]."\0";
diff --git a/src/etc/inc/sasl.inc b/src/etc/inc/sasl.inc
index a9582da..f6a8d0b 100644
--- a/src/etc/inc/sasl.inc
+++ b/src/etc/inc/sasl.inc
@@ -178,7 +178,7 @@ class sasl_client_class
<purpose>Retrieve the values of one or more credentials to be used by
the authentication mechanism classes.</purpose>
<usage>This is meant to be used by authentication mechanism driver
- classes to retrieve the credentials that may be needed.</usage>
+ classes to retrieve the credentials that may be neede.</usage>
<returnvalue>The function may return <tt>SASL_CONTINUE</tt> if it
succeeded, or <tt>SASL_NOMECH</tt> if it was not possible to
retrieve one of the requested credentials.</returnvalue>
@@ -359,7 +359,7 @@ class sasl_client_class
<type>INTEGER</type>
<documentation>
<purpose>Process the authentication steps after the initial step,
- until the authentication iteration dialog is complete.</purpose>
+ until the authetication iteration dialog is complete.</purpose>
<usage>Call this function iteratively after a successful initial
step calling the <functionlink>Start</functionlink> function.</usage>
<returnvalue>The function returns <tt>SASL_CONTINUE</tt> if step was
OpenPOWER on IntegriCloud