mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -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();
|
||||
|
@@ -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,7 +1482,11 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticator implements Ca
|
||||
Type2NTLMMessage type2Msg = (Type2NTLMMessage) sess.getSetupObject( client.getProcessId());
|
||||
sess.removeSetupObject( client.getProcessId());
|
||||
|
||||
// Check if we are using local MD4 password hashes or passthru authentication
|
||||
// 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)
|
||||
|
@@ -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,59 +211,33 @@ public class PassthruAuthenticator extends CifsAuthenticator implements SessionL
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wrap the service calls in a transaction
|
||||
// Map the passthru username to an Alfresco person
|
||||
|
||||
UserTransaction tx = m_transactionService.getUserTransaction( true);
|
||||
String username = client.getUserName();
|
||||
String personName = m_personService.getUserIdentifier( username);
|
||||
|
||||
try
|
||||
if ( personName != null)
|
||||
{
|
||||
// Start the transaction
|
||||
// Use the person name as the current user
|
||||
|
||||
tx.begin();
|
||||
m_authComponent.setCurrentUser(personName);
|
||||
|
||||
// Map the passthru username to an Alfresco person
|
||||
// DEBUG
|
||||
|
||||
String username = client.getUserName();
|
||||
String personName = m_personService.getUserIdentifier( username);
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Setting current user using person " + personName + " (username " + username + ")");
|
||||
|
||||
if ( personName != null)
|
||||
{
|
||||
// Use the person name as the current user
|
||||
// Allow the user full access to the server
|
||||
|
||||
m_authComponent.setCurrentUser(personName);
|
||||
authSts = CifsAuthenticator.AUTH_ALLOW;
|
||||
|
||||
// DEBUG
|
||||
// Debug
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Setting current user using person " + personName + " (username " + username + ")");
|
||||
|
||||
// Allow the user full access to the server
|
||||
|
||||
authSts = CifsAuthenticator.AUTH_ALLOW;
|
||||
|
||||
// Debug
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Passthru authenticate user=" + client.getUserName() + ", FULL");
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Passthru authenticate user=" + client.getUserName() + ", FULL");
|
||||
}
|
||||
else if ( logger.isDebugEnabled())
|
||||
logger.debug("Failed to find person matching user " + username);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Reference in New Issue
Block a user