aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2009-09-06 15:55:14 +0100
committerMelanie2009-09-06 15:55:14 +0100
commitdcebbc3f1b27cf01ae28cb522c5180c195729823 (patch)
tree50dd50f6b81f557b9b8c661f29bb224284bd4896 /OpenSim
parentChange the loader to actually load the user service data module (diff)
downloadopensim-SC_OLD-dcebbc3f1b27cf01ae28cb522c5180c195729823.zip
opensim-SC_OLD-dcebbc3f1b27cf01ae28cb522c5180c195729823.tar.gz
opensim-SC_OLD-dcebbc3f1b27cf01ae28cb522c5180c195729823.tar.bz2
opensim-SC_OLD-dcebbc3f1b27cf01ae28cb522c5180c195729823.tar.xz
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
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs30
-rw-r--r--OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs15
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs5
-rw-r--r--OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs5
-rw-r--r--OpenSim/Services/Interfaces/IAuthenticationService.cs36
5 files changed, 27 insertions, 64 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c25ae10..8cd77f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes
220 private bool m_scripts_enabled = true; 220 private bool m_scripts_enabled = true;
221 private string m_defaultScriptEngine; 221 private string m_defaultScriptEngine;
222 private int m_LastLogin = 0; 222 private int m_LastLogin = 0;
223 private Thread HeartbeatThread; 223 private Thread HeartbeatThread = null;
224 private volatile bool shuttingdown = false; 224 private volatile bool shuttingdown = false;
225 225
226 private int m_lastUpdate = Environment.TickCount; 226 private int m_lastUpdate = Environment.TickCount;
@@ -876,6 +876,13 @@ namespace OpenSim.Region.Framework.Scenes
876 //m_heartbeatTimer.Enabled = true; 876 //m_heartbeatTimer.Enabled = true;
877 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 877 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
878 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 878 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
879 if (HeartbeatThread != null)
880 {
881 ThreadTracker.Remove(HeartbeatThread);
882 HeartbeatThread.Abort();
883 HeartbeatThread = null;
884 }
885 m_lastUpdate = Environment.TickCount;
879 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); 886 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
880 HeartbeatThread.SetApartmentState(ApartmentState.MTA); 887 HeartbeatThread.SetApartmentState(ApartmentState.MTA);
881 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); 888 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@@ -912,9 +919,15 @@ namespace OpenSim.Region.Framework.Scenes
912 /// <param name="e"></param> 919 /// <param name="e"></param>
913 private void Heartbeat(object sender) 920 private void Heartbeat(object sender)
914 { 921 {
915 Update(); 922 try
923 {
924 Update();
916 925
917 m_lastUpdate = Environment.TickCount; 926 m_lastUpdate = Environment.TickCount;
927 }
928 catch (ThreadAbortException)
929 {
930 }
918 } 931 }
919 932
920 /// <summary> 933 /// <summary>
@@ -2307,6 +2320,7 @@ namespace OpenSim.Region.Framework.Scenes
2307 /// <param name="client"></param> 2320 /// <param name="client"></param>
2308 public override void AddNewClient(IClientAPI client) 2321 public override void AddNewClient(IClientAPI client)
2309 { 2322 {
2323 CheckHeartbeat();
2310 SubscribeToClientEvents(client); 2324 SubscribeToClientEvents(client);
2311 ScenePresence presence; 2325 ScenePresence presence;
2312 2326
@@ -2831,6 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes
2831 /// <returns></returns> 2845 /// <returns></returns>
2832 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) 2846 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
2833 { 2847 {
2848 CheckHeartbeat();
2834 AvatarAppearance appearance = null; 2849 AvatarAppearance appearance = null;
2835 GetAvatarAppearance(client, out appearance); 2850 GetAvatarAppearance(client, out appearance);
2836 2851
@@ -2873,6 +2888,7 @@ namespace OpenSim.Region.Framework.Scenes
2873 /// <param name="agentID"></param> 2888 /// <param name="agentID"></param>
2874 public override void RemoveClient(UUID agentID) 2889 public override void RemoveClient(UUID agentID)
2875 { 2890 {
2891 CheckHeartbeat();
2876 bool childagentYN = false; 2892 bool childagentYN = false;
2877 ScenePresence avatar = GetScenePresence(agentID); 2893 ScenePresence avatar = GetScenePresence(agentID);
2878 if (avatar != null) 2894 if (avatar != null)
@@ -4374,6 +4390,8 @@ namespace OpenSim.Region.Framework.Scenes
4374 else 4390 else
4375 return health; 4391 return health;
4376 4392
4393 CheckHeartbeat();
4394
4377 return health; 4395 return health;
4378 } 4396 }
4379 4397
@@ -4559,5 +4577,11 @@ namespace OpenSim.Region.Framework.Scenes
4559 4577
4560 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; 4578 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
4561 } 4579 }
4580
4581 private void CheckHeartbeat()
4582 {
4583 if (System.Environment.TickCount - m_lastUpdate > 2000)
4584 StartTimer();
4585 }
4562 } 4586 }
4563} 4587}
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
index 2ed177c..8904461 100644
--- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
+++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
@@ -90,31 +90,16 @@ namespace OpenSim.Services.AuthenticationService
90 throw new Exception("Could not find a storage interface in the given module"); 90 throw new Exception("Could not find a storage interface in the given module");
91 } 91 }
92 92
93 public virtual byte[] GetPublicKey()
94 {
95 return new byte[0];
96 }
97
98 public bool Verify(UUID principalID, string token, int lifetime) 93 public bool Verify(UUID principalID, string token, int lifetime)
99 { 94 {
100 return m_Database.CheckToken(principalID, token, lifetime); 95 return m_Database.CheckToken(principalID, token, lifetime);
101 } 96 }
102 97
103 public bool VerifyEncrypted(byte[] cyphertext, byte[] key)
104 {
105 return false;
106 }
107
108 public virtual bool Release(UUID principalID, string token) 98 public virtual bool Release(UUID principalID, string token)
109 { 99 {
110 return m_Database.CheckToken(principalID, token, 0); 100 return m_Database.CheckToken(principalID, token, 0);
111 } 101 }
112 102
113 public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key)
114 {
115 return false;
116 }
117
118 protected string GetToken(UUID principalID, int lifetime) 103 protected string GetToken(UUID principalID, int lifetime)
119 { 104 {
120 UUID token = UUID.Random(); 105 UUID token = UUID.Random();
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 7fdbbf6..6c99b66 100644
--- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
@@ -76,10 +76,5 @@ namespace OpenSim.Services.AuthenticationService
76 76
77 return String.Empty; 77 return String.Empty;
78 } 78 }
79
80 public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
81 {
82 return new byte[0];
83 }
84 } 79 }
85} 80}
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
index 0118c91..8831c8a 100644
--- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
@@ -56,10 +56,5 @@ namespace OpenSim.Services.AuthenticationService
56 { 56 {
57 return String.Empty; 57 return String.Empty;
58 } 58 }
59
60 public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
61 {
62 return new byte[0];
63 }
64 } 59 }
65} 60}
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs
index b448a14..9225773 100644
--- a/OpenSim/Services/Interfaces/IAuthenticationService.cs
+++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs
@@ -39,39 +39,12 @@ namespace OpenSim.Services.Interfaces
39 public interface IAuthenticationService 39 public interface IAuthenticationService
40 { 40 {
41 ////////////////////////////////////////////////////// 41 //////////////////////////////////////////////////////
42 // PKI Zone!
43 //
44 // HG2 authentication works by using a cryptographic
45 // exchange.
46 // This method must provide a public key, the other
47 // crypto methods must understand hoow to deal with
48 // messages encrypted to it.
49 //
50 // If the public key is of zero length, you will
51 // get NO encryption and NO security.
52 //
53 // For non-HG installations, this is not relevant
54 //
55 // Implementors who are not using PKI can treat the
56 // cyphertext as a string and provide a zero-length
57 // key. Encryptionless implementations will not
58 // interoperate with implementations using encryption.
59 // If one side uses encryption, both must do so.
60 //
61 byte[] GetPublicKey();
62
63 //////////////////////////////////////////////////////
64 // Authentication 42 // Authentication
65 // 43 //
66 // These methods will return a token, which can be used to access 44 // These methods will return a token, which can be used to access
67 // various services. 45 // various services.
68 // 46 //
69 // The encrypted versions take the received cyphertext and
70 // the public key of the peer, which the connector must have
71 // obtained using a remote GetPublicKey call.
72 //
73 string Authenticate(UUID principalID, string password, int lifetime); 47 string Authenticate(UUID principalID, string password, int lifetime);
74 byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key);
75 48
76 ////////////////////////////////////////////////////// 49 //////////////////////////////////////////////////////
77 // Verification 50 // Verification
@@ -81,12 +54,7 @@ namespace OpenSim.Services.Interfaces
81 // Tokens expire after 30 minutes and can be refreshed by 54 // Tokens expire after 30 minutes and can be refreshed by
82 // re-verifying. 55 // re-verifying.
83 // 56 //
84 // If encrypted authentication was used, encrypted verification
85 // must be used to refresh. Unencrypted verification is still
86 // performed, but doesn't refresh token lifetime.
87 //
88 bool Verify(UUID principalID, string token, int lifetime); 57 bool Verify(UUID principalID, string token, int lifetime);
89 bool VerifyEncrypted(byte[] cyphertext, byte[] key);
90 58
91 ////////////////////////////////////////////////////// 59 //////////////////////////////////////////////////////
92 // Teardown 60 // Teardown
@@ -95,11 +63,7 @@ namespace OpenSim.Services.Interfaces
95 // invalidates it and it can not subsequently be used 63 // invalidates it and it can not subsequently be used
96 // or refreshed. 64 // or refreshed.
97 // 65 //
98 // Tokens created by encrypted authentication must
99 // be returned by encrypted release calls;
100 //
101 bool Release(UUID principalID, string token); 66 bool Release(UUID principalID, string token);
102 bool ReleaseEncrypted(byte[] cyphertext, byte[] key);
103 67
104 ////////////////////////////////////////////////////// 68 //////////////////////////////////////////////////////
105 // Grid 69 // Grid