Fixed DH error

added to DHRequest a validation for g parameter ( > 1 )

Change-Id: If436ff7a558028043bb7a52e31c81b7fd3b6eb44
This commit is contained in:
Sebastian Marcet 2016-03-16 11:57:12 -03:00
parent 1df67dc90a
commit d6068a8c29
3 changed files with 14 additions and 12 deletions

View File

@ -44,23 +44,23 @@ final class OpenIdSessionAssociationRequestHandler extends OpenIdMessageHandler
} catch (InvalidSessionTypeException $inv_session_ex) {
$this->checkpoint_service->trackException($inv_session_ex);
$response = new OpenIdAssociationSessionUnsuccessfulResponse($inv_session_ex->getMessage());
$this->log_service->error($inv_session_ex);
$this->log_service->warning($inv_session_ex);
if(!is_null($this->current_request))
$this->log_service->error_msg("current request: ".$this->current_request->toString());
$this->log_service->warning_msg("current request: ".$this->current_request->toString());
return $response;
} catch (InvalidAssociationTypeException $inv_assoc_ex) {
$this->checkpoint_service->trackException($inv_assoc_ex);
$response = new OpenIdAssociationSessionUnsuccessfulResponse($inv_assoc_ex->getMessage());
$this->log_service->error($inv_assoc_ex);
$this->log_service->warning($inv_assoc_ex);
if(!is_null($this->current_request))
$this->log_service->error_msg("current request: ".$this->current_request->toString());
$this->log_service->warning_msg("current request: ".$this->current_request->toString());
return $response;
} catch (InvalidOpenIdMessageException $inv_msg_ex) {
$response = new OpenIdDirectGenericErrorResponse($inv_msg_ex->getMessage());
$this->checkpoint_service->trackException($inv_msg_ex);
$this->log_service->error($inv_msg_ex);
$this->log_service->warning($inv_msg_ex);
if(!is_null($this->current_request))
$this->log_service->error_msg("current request: ".$this->current_request->toString());
$this->log_service->warning_msg("current request: ".$this->current_request->toString());
return $response;
} catch (Exception $ex) {
$this->checkpoint_service->trackException($ex);

View File

@ -28,8 +28,8 @@ class OpenIdDHAssociationSessionRequest extends OpenIdAssociationSessionRequest
public function __construct(OpenIdMessage $message)
{
parent::__construct($message);
$this->g_number = null;
$this->p_number = null;
$this->g_number = null;
$this->p_number = null;
$this->rp_pub_key = null;
}
@ -57,11 +57,13 @@ class OpenIdDHAssociationSessionRequest extends OpenIdAssociationSessionRequest
{
$res = parent::isValid();
if (!$res) return false;
$dh_modulus = $this->getDHModulus();
$dh_gen = $this->getDHGen();
$dh_modulus = $this->getDHModulus();
$dh_gen = $this->getDHGen();
$dh_consumer_public = $this->getDHConsumerPublic();
if (!empty($dh_modulus) && !empty($dh_gen) && !empty($dh_consumer_public))
return true;
// not a positive natural number greater than 1 ...
if($dh_gen <= 1) return false;
return true;
}

View File

@ -39,7 +39,7 @@ ClassLoader::addDirectories(array(
$logFile = 'log-' . php_sapi_name() . '.txt';
Log::useDailyFiles(storage_path() . '/logs/' . $logFile,$days = 0, $level = 'debug');
Log::useDailyFiles(storage_path() . '/logs/' . $logFile, $days = 0, $level = 'debug');
//set email log
$to = Config::get('log.to_email');
@ -48,7 +48,7 @@ $from = Config::get('log.from_email');
if(!empty($to) && !empty($from)){
$subject = 'openstackid error';
$mono_log = Log::getMonolog();
$handler = new NativeMailerHandler($to, $subject, $from,$level = Logger::WARNING);
$handler = new NativeMailerHandler($to, $subject, $from, $level = Logger::ERROR);
$mono_log->pushHandler($handler);
}