Remove the encryption from the IAuthenticationService interface. That

is too high up for that type of stuff. It needs to be at the
connector/handler level
remotes/origin/0.6.7-post-fixes
Melanie 2009-09-06 15:55:14 +01:00
parent bb1d4d23c4
commit dcebbc3f1b
5 changed files with 27 additions and 64 deletions

View File

@ -220,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_scripts_enabled = true; private bool m_scripts_enabled = true;
private string m_defaultScriptEngine; private string m_defaultScriptEngine;
private int m_LastLogin = 0; private int m_LastLogin = 0;
private Thread HeartbeatThread; private Thread HeartbeatThread = null;
private volatile bool shuttingdown = false; private volatile bool shuttingdown = false;
private int m_lastUpdate = Environment.TickCount; private int m_lastUpdate = Environment.TickCount;
@ -876,6 +876,13 @@ namespace OpenSim.Region.Framework.Scenes
//m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Enabled = true;
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
if (HeartbeatThread != null)
{
ThreadTracker.Remove(HeartbeatThread);
HeartbeatThread.Abort();
HeartbeatThread = null;
}
m_lastUpdate = Environment.TickCount;
HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
HeartbeatThread.SetApartmentState(ApartmentState.MTA); HeartbeatThread.SetApartmentState(ApartmentState.MTA);
HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@ -912,9 +919,15 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="e"></param> /// <param name="e"></param>
private void Heartbeat(object sender) private void Heartbeat(object sender)
{ {
Update(); try
{
Update();
m_lastUpdate = Environment.TickCount; m_lastUpdate = Environment.TickCount;
}
catch (ThreadAbortException)
{
}
} }
/// <summary> /// <summary>
@ -2307,6 +2320,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client"></param> /// <param name="client"></param>
public override void AddNewClient(IClientAPI client) public override void AddNewClient(IClientAPI client)
{ {
CheckHeartbeat();
SubscribeToClientEvents(client); SubscribeToClientEvents(client);
ScenePresence presence; ScenePresence presence;
@ -2831,6 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{ {
CheckHeartbeat();
AvatarAppearance appearance = null; AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance); GetAvatarAppearance(client, out appearance);
@ -2873,6 +2888,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="agentID"></param> /// <param name="agentID"></param>
public override void RemoveClient(UUID agentID) public override void RemoveClient(UUID agentID)
{ {
CheckHeartbeat();
bool childagentYN = false; bool childagentYN = false;
ScenePresence avatar = GetScenePresence(agentID); ScenePresence avatar = GetScenePresence(agentID);
if (avatar != null) if (avatar != null)
@ -4374,6 +4390,8 @@ namespace OpenSim.Region.Framework.Scenes
else else
return health; return health;
CheckHeartbeat();
return health; return health;
} }
@ -4559,5 +4577,11 @@ namespace OpenSim.Region.Framework.Scenes
return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
} }
private void CheckHeartbeat()
{
if (System.Environment.TickCount - m_lastUpdate > 2000)
StartTimer();
}
} }
} }

View File

@ -90,31 +90,16 @@ namespace OpenSim.Services.AuthenticationService
throw new Exception("Could not find a storage interface in the given module"); throw new Exception("Could not find a storage interface in the given module");
} }
public virtual byte[] GetPublicKey()
{
return new byte[0];
}
public bool Verify(UUID principalID, string token, int lifetime) public bool Verify(UUID principalID, string token, int lifetime)
{ {
return m_Database.CheckToken(principalID, token, lifetime); return m_Database.CheckToken(principalID, token, lifetime);
} }
public bool VerifyEncrypted(byte[] cyphertext, byte[] key)
{
return false;
}
public virtual bool Release(UUID principalID, string token) public virtual bool Release(UUID principalID, string token)
{ {
return m_Database.CheckToken(principalID, token, 0); return m_Database.CheckToken(principalID, token, 0);
} }
public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key)
{
return false;
}
protected string GetToken(UUID principalID, int lifetime) protected string GetToken(UUID principalID, int lifetime)
{ {
UUID token = UUID.Random(); UUID token = UUID.Random();

View File

@ -76,10 +76,5 @@ namespace OpenSim.Services.AuthenticationService
return String.Empty; return String.Empty;
} }
public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
{
return new byte[0];
}
} }
} }

View File

@ -56,10 +56,5 @@ namespace OpenSim.Services.AuthenticationService
{ {
return String.Empty; return String.Empty;
} }
public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
{
return new byte[0];
}
} }
} }

View File

@ -38,40 +38,13 @@ namespace OpenSim.Services.Interfaces
// //
public interface IAuthenticationService public interface IAuthenticationService
{ {
//////////////////////////////////////////////////////
// PKI Zone!
//
// HG2 authentication works by using a cryptographic
// exchange.
// This method must provide a public key, the other
// crypto methods must understand hoow to deal with
// messages encrypted to it.
//
// If the public key is of zero length, you will
// get NO encryption and NO security.
//
// For non-HG installations, this is not relevant
//
// Implementors who are not using PKI can treat the
// cyphertext as a string and provide a zero-length
// key. Encryptionless implementations will not
// interoperate with implementations using encryption.
// If one side uses encryption, both must do so.
//
byte[] GetPublicKey();
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Authentication // Authentication
// //
// These methods will return a token, which can be used to access // These methods will return a token, which can be used to access
// various services. // various services.
// //
// The encrypted versions take the received cyphertext and
// the public key of the peer, which the connector must have
// obtained using a remote GetPublicKey call.
//
string Authenticate(UUID principalID, string password, int lifetime); string Authenticate(UUID principalID, string password, int lifetime);
byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Verification // Verification
@ -81,12 +54,7 @@ namespace OpenSim.Services.Interfaces
// Tokens expire after 30 minutes and can be refreshed by // Tokens expire after 30 minutes and can be refreshed by
// re-verifying. // re-verifying.
// //
// If encrypted authentication was used, encrypted verification
// must be used to refresh. Unencrypted verification is still
// performed, but doesn't refresh token lifetime.
//
bool Verify(UUID principalID, string token, int lifetime); bool Verify(UUID principalID, string token, int lifetime);
bool VerifyEncrypted(byte[] cyphertext, byte[] key);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Teardown // Teardown
@ -95,11 +63,7 @@ namespace OpenSim.Services.Interfaces
// invalidates it and it can not subsequently be used // invalidates it and it can not subsequently be used
// or refreshed. // or refreshed.
// //
// Tokens created by encrypted authentication must
// be returned by encrypted release calls;
//
bool Release(UUID principalID, string token); bool Release(UUID principalID, string token);
bool ReleaseEncrypted(byte[] cyphertext, byte[] key);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Grid // Grid