Fix transaction use after changes to the authentication component.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4739 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer
2007-01-05 14:56:53 +00:00
parent 2857106808
commit 597c7bcb8b
3 changed files with 56 additions and 50 deletions

View File

@@ -250,6 +250,10 @@ public class AlfrescoAuthenticator extends CifsAuthenticator
*/
private final int doMD4UserAuthentication(ClientInfo client, SrvSession sess, int alg)
{
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Get the stored MD4 hashed password for the user, or null if the user does not exist
String md4hash = m_authComponent.getMD4HashedPassword(client.getUserName());
@@ -352,6 +356,10 @@ public class AlfrescoAuthenticator extends CifsAuthenticator
*/
private final int doPassthruUserAuthentication(ClientInfo client, SrvSession sess, int alg)
{
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Get the authentication token for the session
NTLMPassthruToken authToken = (NTLMPassthruToken) sess.getAuthenticationToken();

View File

@@ -1161,6 +1161,10 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticator implements Ca
negTokenTarg = new NegTokenTarg( SPNEGO.AcceptCompleted, OID.KERBEROS5, krbDetails.getResponseToken());
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Setup the Acegi authenticated user
m_authComponent.setCurrentUser( mapUserNameToPerson(krbDetails.getUserName()));
@@ -1350,6 +1354,10 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticator implements Ca
throw new SMBSrvException( SMBStatus.NTLogonFailure, SMBStatus.DOSAccessDenied, SMBStatus.ErrDos);
}
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Check if we are using local MD4 password hashes or passthru authentication
if ( m_authComponent.getNTLMMode() == NTLMMode.MD4_PROVIDER)
@@ -1474,6 +1482,10 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticator implements Ca
Type2NTLMMessage type2Msg = (Type2NTLMMessage) sess.getSetupObject( client.getProcessId());
sess.removeSetupObject( client.getProcessId());
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Check if we are using local MD4 password hashes or passthru authentication
if ( m_authComponent.getNTLMMode() == NTLMMode.MD4_PROVIDER)
@@ -1591,6 +1603,10 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticator implements Ca
private final void doNTLMv2Logon(SMBSrvSession sess, ClientInfo client)
throws SMBSrvException
{
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Check if we are using local MD4 password hashes or passthru authentication
if ( m_authComponent.getNTLMMode() == NTLMMode.MD4_PROVIDER)
@@ -1719,6 +1735,10 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticator implements Ca
Type2NTLMMessage type2Msg = (Type2NTLMMessage) sess.getSetupObject( client.getProcessId());
sess.removeSetupObject( client.getProcessId());
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Check if we are using local MD4 password hashes or passthru authentication
if ( m_authComponent.getNTLMMode() == NTLMMode.MD4_PROVIDER)

View File

@@ -119,6 +119,10 @@ public class PassthruAuthenticator extends CifsAuthenticator implements SessionL
return CifsAuthenticator.AUTH_ALLOW;
}
// Start a transaction
sess.beginReadTransaction( m_transactionService);
// Check if the client is already authenticated, and it is not a null logon
if ( client.getAuthenticationToken() != null && client.getLogonType() != ClientInfo.LogonNull)
@@ -207,16 +211,6 @@ public class PassthruAuthenticator extends CifsAuthenticator implements SessionL
}
else
{
// Wrap the service calls in a transaction
UserTransaction tx = m_transactionService.getUserTransaction( true);
try
{
// Start the transaction
tx.begin();
// Map the passthru username to an Alfresco person
String username = client.getUserName();
@@ -245,22 +239,6 @@ public class PassthruAuthenticator extends CifsAuthenticator implements SessionL
else if ( logger.isDebugEnabled())
logger.debug("Failed to find person matching user " + username);
}
finally
{
// Commit the transaction
if ( tx != null)
{
try {
tx.commit();
}
catch (Exception ex)
{
// Sink it
}
}
}
}
}
catch (Exception ex)
{