Commit e89e66c7 authored by Renato Figueiro Maia's avatar Renato Figueiro Maia

[OPENBUS-2664] Correção de bug ao fazer uma chamada sem credencial num...

[OPENBUS-2664] Correção de bug ao fazer uma chamada sem credencial num servidor com a callback de 'onCallDispatch' definida

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/02_00_00@158271 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 4fbfc161
......@@ -27,4 +27,8 @@ done
echo -n "Executing test '$2' ... "
$CONSOLE client.lua $2
echo "OK"
cd ..
cd ../../test
echo -n "Test protocol with server of test '$2' ... "
$CONSOLE openbus/test/Protocol.lua
echo "OK"
cd ../interop
......@@ -456,28 +456,23 @@ function Connection:receivereply(request)
end
end
function Connection:receiverequest(request)
function Connection:receiverequest(request, ...)
if self.login ~= nil then
local ok, ex = pcall(receiveBusRequest, self, request)
if ok then
if request.success == nil and self.context:getCallerChain() == nil then
log:exception(msg.DeniedOrdinaryCall:tag{
local ok, ex = pcall(receiveBusRequest, self, request, ...)
if not ok then
if is_NO_PERMISSION(ex, NoLoginCode) then
log:exception(msg.LostLoginDuringCallDispatch:tag{
operation = request.operation.name,
})
setNoPermSysEx(request, NoCredentialCode)
setNoPermSysEx(request, UnknownBusCode)
elseif is_TRANSIENT(ex) or is_COMM_FAILURE(ex) then
log:exception(msg.UnableToVerifyLoginDueToCoreServicesUnaccessible:tag{
operation = request.operation.name,
})
setNoPermSysEx(request, UnverifiedLoginCode)
else
error(ex)
end
elseif is_NO_PERMISSION(ex, NoLoginCode) then
log:exception(msg.LostLoginDuringCallDispatch:tag{
operation = request.operation.name,
})
setNoPermSysEx(request, UnknownBusCode)
elseif is_TRANSIENT(ex) or is_COMM_FAILURE(ex) then
log:exception(msg.UnableToVerifyLoginDueToCoreServicesUnaccessible:tag{
operation = request.operation.name,
})
setNoPermSysEx(request, UnverifiedLoginCode)
else
error(ex)
end
else
log:exception(msg.GotCallWhileNotLoggedIn:tag{
......@@ -648,17 +643,24 @@ end
function Context:receiverequest(request)
local credential = unmarshalCredential(self, request.service_context)
local conn = getDispatcherFor(self, request, credential)
or self.defaultConnection
if conn ~= nil then
request[self] = conn
self:setCurrentConnection(conn)
conn:receiverequest(request, credential)
if credential ~= nil then
local conn = getDispatcherFor(self, request, credential)
or self.defaultConnection
if conn ~= nil then
request[self] = conn
self:setCurrentConnection(conn)
conn:receiverequest(request, credential)
else
log:exception(msg.GotCallWhileDisconnected:tag{
operation = request.operation_name,
})
setNoPermSysEx(request, UnknownBusCode)
end
else
log:exception(msg.GotCallWhileDisconnected:tag{
operation = request.operation_name,
log:exception(msg.DeniedOrdinaryCall:tag{
operation = request.operation.name,
})
setNoPermSysEx(request, UnknownBusCode)
setNoPermSysEx(request, NoCredentialCode)
end
end
......
......@@ -455,6 +455,7 @@ function Interceptor:receiverequest(request, credential)
entity = caller.entity,
delegate = credential.delegate,
})
setNoPermSysEx(request, loginconst.InvalidCredentialCode)
else
-- invalid credential, try to reset credetial session
local sessions = self.incomingSessions
......@@ -488,19 +489,15 @@ function Interceptor:receiverequest(request, credential)
setNoPermSysEx(request, loginconst.InvalidPublicKeyCode)
end
end
elseif busid ~= nil then
else
-- credential with invalid login
log:exception(msg.GotCallWithInvalidLogin:tag{
local logmessage = (busid == nil) and msg.GotLegacyCallWithInvalidLogin
or msg.GotCallWithInvalidLogin
log:exception(logmessage:tag{
operation = request.operation_name,
remote = credential.login,
})
setNoPermSysEx(request, loginconst.InvalidLoginCode)
else
-- legacy credential with invalid login (OpenBus 1.5)
log:exception(msg.GotLegacyCallWithInvalidLogin:tag{
operation = request.operation_name,
remote = credential.login,
})
end
else
-- credential for another bus
......
Markdown is supported
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