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
private int[] _authTypes = { AuthType.Null, AuthType.Unix };
private int[] _authTypes = { AuthType.Unix };
// UID/GID to username conversions

View File

@@ -424,10 +424,13 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
}
catch (RpcAuthenticationException ex) {
// Failed to authenticate the RPC client
rpc.buildAuthFailResponse(ex.getAuthenticationErrorCode());
return rpc;
// 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());
return rpc;
}
}
// Position the RPC buffer pointer at the start of the call parameters
@@ -582,25 +585,28 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
// Commit, or rollback, any active user transaction
try
{
// Commit or rollback the transaction
nfsSess.endTransaction();
}
catch ( Exception ex)
{
// Debug
if ( logger.isDebugEnabled())
logger.debug("Error committing transaction", ex);
}
if ( nfsSess != null)
{
try
{
// Commit or rollback the transaction
nfsSess.endTransaction();
}
catch ( Exception ex)
{
// Debug
if ( logger.isDebugEnabled())
logger.debug("Error committing transaction", ex);
}
}
}
finally
{
// If there is an active transaction then roll it back
if ( nfsSess.hasUserTransaction())
if ( nfsSess != null && nfsSess.hasUserTransaction())
{
try
{
@@ -4126,7 +4132,24 @@ public class NFSServer extends RpcNetworkServer implements RpcProcessor {
// Setup the authentication context for the request
getRpcAuthenticator().setCurrentUser( sess, sess.getClientInformation());
try
{
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