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 ...@@ -27,4 +27,8 @@ done
echo -n "Executing test '$2' ... " echo -n "Executing test '$2' ... "
$CONSOLE client.lua $2 $CONSOLE client.lua $2
echo "OK" 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) ...@@ -456,28 +456,23 @@ function Connection:receivereply(request)
end end
end end
function Connection:receiverequest(request) function Connection:receiverequest(request, ...)
if self.login ~= nil then if self.login ~= nil then
local ok, ex = pcall(receiveBusRequest, self, request) local ok, ex = pcall(receiveBusRequest, self, request, ...)
if ok then if not ok then
if request.success == nil and self.context:getCallerChain() == nil then if is_NO_PERMISSION(ex, NoLoginCode) then
log:exception(msg.DeniedOrdinaryCall:tag{ log:exception(msg.LostLoginDuringCallDispatch:tag{
operation = request.operation.name, 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 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 end
else else
log:exception(msg.GotCallWhileNotLoggedIn:tag{ log:exception(msg.GotCallWhileNotLoggedIn:tag{
...@@ -648,17 +643,24 @@ end ...@@ -648,17 +643,24 @@ end
function Context:receiverequest(request) function Context:receiverequest(request)
local credential = unmarshalCredential(self, request.service_context) local credential = unmarshalCredential(self, request.service_context)
local conn = getDispatcherFor(self, request, credential) if credential ~= nil then
or self.defaultConnection local conn = getDispatcherFor(self, request, credential)
if conn ~= nil then or self.defaultConnection
request[self] = conn if conn ~= nil then
self:setCurrentConnection(conn) request[self] = conn
conn:receiverequest(request, credential) self:setCurrentConnection(conn)
conn:receiverequest(request, credential)
else
log:exception(msg.GotCallWhileDisconnected:tag{
operation = request.operation_name,
})
setNoPermSysEx(request, UnknownBusCode)
end
else else
log:exception(msg.GotCallWhileDisconnected:tag{ log:exception(msg.DeniedOrdinaryCall:tag{
operation = request.operation_name, operation = request.operation.name,
}) })
setNoPermSysEx(request, UnknownBusCode) setNoPermSysEx(request, NoCredentialCode)
end end
end end
......
...@@ -455,6 +455,7 @@ function Interceptor:receiverequest(request, credential) ...@@ -455,6 +455,7 @@ function Interceptor:receiverequest(request, credential)
entity = caller.entity, entity = caller.entity,
delegate = credential.delegate, delegate = credential.delegate,
}) })
setNoPermSysEx(request, loginconst.InvalidCredentialCode)
else else
-- invalid credential, try to reset credetial session -- invalid credential, try to reset credetial session
local sessions = self.incomingSessions local sessions = self.incomingSessions
...@@ -488,19 +489,15 @@ function Interceptor:receiverequest(request, credential) ...@@ -488,19 +489,15 @@ function Interceptor:receiverequest(request, credential)
setNoPermSysEx(request, loginconst.InvalidPublicKeyCode) setNoPermSysEx(request, loginconst.InvalidPublicKeyCode)
end end
end end
elseif busid ~= nil then else
-- credential with invalid login -- 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, operation = request.operation_name,
remote = credential.login, remote = credential.login,
}) })
setNoPermSysEx(request, loginconst.InvalidLoginCode) 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 end
else else
-- credential for another bus -- 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