Removed auth null from list of available authentication types in the AlfrescoRpcAuthenticator.

Allow null RPC request to run without needing an authenticated session. Fix for AR-1605.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6266 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer
2007-07-16 14:55:44 +00:00
parent 72cdb81f47
commit 5ade7cb377
2 changed files with 43 additions and 20 deletions

View File

@@ -55,7 +55,7 @@ public class AlfrescoRpcAuthenticator implements RpcAuthenticator {
// Authentication types aupported by this implementation // Authentication types aupported by this implementation
private int[] _authTypes = { AuthType.Null, AuthType.Unix }; private int[] _authTypes = { AuthType.Unix };
// UID/GID to username conversions // UID/GID to username conversions

View File

@@ -424,11 +424,14 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
} }
catch (RpcAuthenticationException ex) { catch (RpcAuthenticationException ex) {
// Failed to authenticate the RPC client // Failed to authenticate the RPC client, return an error unless the request is the 'null' request
if ( rpc.getProcedureId() != NFS.ProcNull)
{
rpc.buildAuthFailResponse(ex.getAuthenticationErrorCode()); rpc.buildAuthFailResponse(ex.getAuthenticationErrorCode());
return rpc; return rpc;
} }
}
// Position the RPC buffer pointer at the start of the call parameters // Position the RPC buffer pointer at the start of the call parameters
@@ -582,6 +585,8 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
// Commit, or rollback, any active user transaction // Commit, or rollback, any active user transaction
if ( nfsSess != null)
{
try try
{ {
// Commit or rollback the transaction // Commit or rollback the transaction
@@ -596,11 +601,12 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
logger.debug("Error committing transaction", ex); logger.debug("Error committing transaction", ex);
} }
} }
}
finally finally
{ {
// If there is an active transaction then roll it back // If there is an active transaction then roll it back
if ( nfsSess.hasUserTransaction()) if ( nfsSess != null && nfsSess.hasUserTransaction())
{ {
try try
{ {
@@ -4126,7 +4132,24 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
// Setup the authentication context for the request // Setup the authentication context for the request
try
{
getRpcAuthenticator().setCurrentUser( sess, sess.getClientInformation()); getRpcAuthenticator().setCurrentUser( sess, sess.getClientInformation());
}
catch ( Throwable ex)
{
sess = null;
// DEBUG
if (logger.isDebugEnabled() && hasDebugFlag(DBG_ERROR))
logger.debug("RPC Authencation Exception: " + ex.toString());
}
// Check if the session is valid
if ( sess == null)
throw new RpcAuthenticationException(Rpc.AuthBadCred);
// Return the server session // Return the server session