Commit bac3ee00 authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

[OPENBUS-2215] Tratamento do caso 'LoginRegistry::subscribeObserver(null)' que...

[OPENBUS-2215] Tratamento do caso 'LoginRegistry::subscribeObserver(null)' que corrompe o estado do 'busservice' e pode fazer com que sua execução aborte com erro

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@139424 ae0415b3-e90b-0410-900d-d0be9363c56b
parent b82b461f
......@@ -24,9 +24,6 @@ local schedule = cothread.schedule
local unschedule = cothread.unschedule
local waituntil = cothread.defer
local giop = require "oil.corba.giop"
local sysex = giop.SystemExceptionIDs
local uuid = require "uuid"
local newid = uuid.new
......@@ -37,9 +34,10 @@ local decodepublickey = pubkey.decodepublic
local x509 = require "lce.x509"
local decodecertificate = x509.decode
local log = require "openbus.util.logger"
local oo = require "openbus.util.oo"
local class = oo.class
local log = require "openbus.util.logger"
local sysex = require "openbus.util.sysex"
local idl = require "openbus.core.idl"
local assert = idl.serviceAssertion
......@@ -573,6 +571,9 @@ function LoginRegistry:getLoginValidity(id)
end
function LoginRegistry:subscribeObserver(callback)
if callback == nil then
sysex.BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
end
local logins = AccessControl.activeLogins
local caller = self.access:getCallerChain().caller
local login = logins:getLogin(caller.id)
......
......@@ -162,6 +162,15 @@ function InvalidParamCase.testGetValidity(self)
Check.assertEquals(0, validity)
end
function InvalidParamCase.testSubscribeNullObserver(self)
local logins = self.logins
local ok, result = pcall(logins.subscribeObserver, logins, nil)
Check.assertFalse(ok)
Check.assertEquals(result._repid, "IDL:omg.org/CORBA/BAD_PARAM:1.0")
Check.assertEquals(result.completed, "COMPLETED_NO")
Check.assertEquals(result.minor, 0)
end
function InvalidParamCase.testSubscribeInvalidObserver(self)
local logins = self.logins
local ok, observer = pcall(logins.subscribeObserver, logins, {})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment