diff options
author | Melanie | 2010-04-27 03:48:49 +0100 |
---|---|---|
committer | Melanie | 2010-04-27 03:48:49 +0100 |
commit | 1e743eab6d620a14876a1ec9b41b3e136af889d3 (patch) | |
tree | a9f0a968d10d6f65040c5ec13b0726ddf23377b7 | |
parent | Fix build break. (diff) | |
download | opensim-SC_OLD-1e743eab6d620a14876a1ec9b41b3e136af889d3.zip opensim-SC_OLD-1e743eab6d620a14876a1ec9b41b3e136af889d3.tar.gz opensim-SC_OLD-1e743eab6d620a14876a1ec9b41b3e136af889d3.tar.bz2 opensim-SC_OLD-1e743eab6d620a14876a1ec9b41b3e136af889d3.tar.xz |
Allow a client to pass a scope id to log into in the login XML / LLSD
-rw-r--r-- | OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 12 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/ILoginService.cs | 3 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 44 |
3 files changed, 42 insertions, 17 deletions
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index aaa958b..daf2704 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -72,6 +72,9 @@ namespace OpenSim.Server.Handlers.Login | |||
72 | string last = requestData["last"].ToString(); | 72 | string last = requestData["last"].ToString(); |
73 | string passwd = requestData["passwd"].ToString(); | 73 | string passwd = requestData["passwd"].ToString(); |
74 | string startLocation = string.Empty; | 74 | string startLocation = string.Empty; |
75 | UUID scopeID = UUID.Zero; | ||
76 | if (requestData["scope_id"] != null) | ||
77 | scopeID = new UUID(requestData["scope_id"].ToString()); | ||
75 | if (requestData.ContainsKey("start")) | 78 | if (requestData.ContainsKey("start")) |
76 | startLocation = requestData["start"].ToString(); | 79 | startLocation = requestData["start"].ToString(); |
77 | 80 | ||
@@ -83,7 +86,7 @@ namespace OpenSim.Server.Handlers.Login | |||
83 | m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); | 86 | m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); |
84 | 87 | ||
85 | LoginResponse reply = null; | 88 | LoginResponse reply = null; |
86 | reply = m_LocalService.Login(first, last, passwd, startLocation, remoteClient); | 89 | reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, remoteClient); |
87 | 90 | ||
88 | XmlRpcResponse response = new XmlRpcResponse(); | 91 | XmlRpcResponse response = new XmlRpcResponse(); |
89 | response.Value = reply.ToHashtable(); | 92 | response.Value = reply.ToHashtable(); |
@@ -109,10 +112,15 @@ namespace OpenSim.Server.Handlers.Login | |||
109 | if (map.ContainsKey("start")) | 112 | if (map.ContainsKey("start")) |
110 | startLocation = map["start"].AsString(); | 113 | startLocation = map["start"].AsString(); |
111 | 114 | ||
115 | UUID scopeID = UUID.Zero; | ||
116 | |||
117 | if (map.ContainsKey("scope_id")) | ||
118 | scopeID = new UUID(map["scope_id"].AsString()); | ||
119 | |||
112 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); | 120 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); |
113 | 121 | ||
114 | LoginResponse reply = null; | 122 | LoginResponse reply = null; |
115 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, remoteClient); | 123 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, remoteClient); |
116 | return reply.ToOSDMap(); | 124 | return reply.ToOSDMap(); |
117 | 125 | ||
118 | } | 126 | } |
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs index 24bf342..49efbe2 100644 --- a/OpenSim/Services/Interfaces/ILoginService.cs +++ b/OpenSim/Services/Interfaces/ILoginService.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | 32 | ||
33 | using OpenMetaverse.StructuredData; | 33 | using OpenMetaverse.StructuredData; |
34 | using OpenMetaverse; | ||
34 | 35 | ||
35 | namespace OpenSim.Services.Interfaces | 36 | namespace OpenSim.Services.Interfaces |
36 | { | 37 | { |
@@ -46,7 +47,7 @@ namespace OpenSim.Services.Interfaces | |||
46 | 47 | ||
47 | public interface ILoginService | 48 | public interface ILoginService |
48 | { | 49 | { |
49 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, IPEndPoint clientIP); | 50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP); |
50 | } | 51 | } |
51 | 52 | ||
52 | 53 | ||
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index c333b5c..4d7dfd1 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Services.LLLoginService | |||
147 | { | 147 | { |
148 | } | 148 | } |
149 | 149 | ||
150 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, IPEndPoint clientIP) | 150 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP) |
151 | { | 151 | { |
152 | bool success = false; | 152 | bool success = false; |
153 | UUID session = UUID.Random(); | 153 | UUID session = UUID.Random(); |
@@ -157,7 +157,7 @@ namespace OpenSim.Services.LLLoginService | |||
157 | // | 157 | // |
158 | // Get the account and check that it exists | 158 | // Get the account and check that it exists |
159 | // | 159 | // |
160 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | 160 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
161 | if (account == null) | 161 | if (account == null) |
162 | { | 162 | { |
163 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); | 163 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); |
@@ -170,6 +170,22 @@ namespace OpenSim.Services.LLLoginService | |||
170 | return LLFailedLoginResponse.LoginBlockedProblem; | 170 | return LLFailedLoginResponse.LoginBlockedProblem; |
171 | } | 171 | } |
172 | 172 | ||
173 | // If a scope id is requested, check that the account is in | ||
174 | // that scope, or unscoped. | ||
175 | // | ||
176 | if (scopeID != UUID.Zero) | ||
177 | { | ||
178 | if (account.ScopeID != scopeID && account.ScopeID != UUID.Zero) | ||
179 | { | ||
180 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); | ||
181 | return LLFailedLoginResponse.UserProblem; | ||
182 | } | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | scopeID = account.ScopeID; | ||
187 | } | ||
188 | |||
173 | // | 189 | // |
174 | // Authenticate this user | 190 | // Authenticate this user |
175 | // | 191 | // |
@@ -219,7 +235,7 @@ namespace OpenSim.Services.LLLoginService | |||
219 | // Get the home region | 235 | // Get the home region |
220 | if ((presence.HomeRegionID != UUID.Zero) && m_GridService != null) | 236 | if ((presence.HomeRegionID != UUID.Zero) && m_GridService != null) |
221 | { | 237 | { |
222 | home = m_GridService.GetRegionByUUID(account.ScopeID, presence.HomeRegionID); | 238 | home = m_GridService.GetRegionByUUID(scopeID, presence.HomeRegionID); |
223 | } | 239 | } |
224 | } | 240 | } |
225 | 241 | ||
@@ -230,7 +246,7 @@ namespace OpenSim.Services.LLLoginService | |||
230 | Vector3 position = Vector3.Zero; | 246 | Vector3 position = Vector3.Zero; |
231 | Vector3 lookAt = Vector3.Zero; | 247 | Vector3 lookAt = Vector3.Zero; |
232 | GridRegion gatekeeper = null; | 248 | GridRegion gatekeeper = null; |
233 | GridRegion destination = FindDestination(account, presence, session, startLocation, out gatekeeper, out where, out position, out lookAt); | 249 | GridRegion destination = FindDestination(account, scopeID, presence, session, startLocation, out gatekeeper, out where, out position, out lookAt); |
234 | if (destination == null) | 250 | if (destination == null) |
235 | { | 251 | { |
236 | m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); | 252 | m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); |
@@ -286,7 +302,7 @@ namespace OpenSim.Services.LLLoginService | |||
286 | } | 302 | } |
287 | } | 303 | } |
288 | 304 | ||
289 | protected GridRegion FindDestination(UserAccount account, PresenceInfo pinfo, UUID sessionID, string startLocation, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt) | 305 | protected GridRegion FindDestination(UserAccount account, UUID scopeID, PresenceInfo pinfo, UUID sessionID, string startLocation, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt) |
290 | { | 306 | { |
291 | m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); | 307 | m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); |
292 | 308 | ||
@@ -318,7 +334,7 @@ namespace OpenSim.Services.LLLoginService | |||
318 | } | 334 | } |
319 | else | 335 | else |
320 | { | 336 | { |
321 | region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.HomeRegionID); | 337 | region = m_GridService.GetRegionByUUID(scopeID, pinfo.HomeRegionID); |
322 | 338 | ||
323 | if (null == region) | 339 | if (null == region) |
324 | { | 340 | { |
@@ -332,7 +348,7 @@ namespace OpenSim.Services.LLLoginService | |||
332 | 348 | ||
333 | if (tryDefaults) | 349 | if (tryDefaults) |
334 | { | 350 | { |
335 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); | 351 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
336 | if (defaults != null && defaults.Count > 0) | 352 | if (defaults != null && defaults.Count > 0) |
337 | { | 353 | { |
338 | region = defaults[0]; | 354 | region = defaults[0]; |
@@ -342,7 +358,7 @@ namespace OpenSim.Services.LLLoginService | |||
342 | { | 358 | { |
343 | m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", | 359 | m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", |
344 | account.FirstName, account.LastName); | 360 | account.FirstName, account.LastName); |
345 | defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); | 361 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); |
346 | if (defaults != null && defaults.Count > 0) | 362 | if (defaults != null && defaults.Count > 0) |
347 | { | 363 | { |
348 | region = defaults[0]; | 364 | region = defaults[0]; |
@@ -363,9 +379,9 @@ namespace OpenSim.Services.LLLoginService | |||
363 | 379 | ||
364 | GridRegion region = null; | 380 | GridRegion region = null; |
365 | 381 | ||
366 | if (pinfo.RegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.RegionID)) == null) | 382 | if (pinfo.RegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.RegionID)) == null) |
367 | { | 383 | { |
368 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); | 384 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
369 | if (defaults != null && defaults.Count > 0) | 385 | if (defaults != null && defaults.Count > 0) |
370 | { | 386 | { |
371 | region = defaults[0]; | 387 | region = defaults[0]; |
@@ -374,7 +390,7 @@ namespace OpenSim.Services.LLLoginService | |||
374 | else | 390 | else |
375 | { | 391 | { |
376 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); | 392 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); |
377 | defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); | 393 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); |
378 | if (defaults != null && defaults.Count > 0) | 394 | if (defaults != null && defaults.Count > 0) |
379 | { | 395 | { |
380 | region = defaults[0]; | 396 | region = defaults[0]; |
@@ -414,11 +430,11 @@ namespace OpenSim.Services.LLLoginService | |||
414 | { | 430 | { |
415 | if (!regionName.Contains("@")) | 431 | if (!regionName.Contains("@")) |
416 | { | 432 | { |
417 | List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); | 433 | List<GridRegion> regions = m_GridService.GetRegionsByName(scopeID, regionName, 1); |
418 | if ((regions == null) || (regions != null && regions.Count == 0)) | 434 | if ((regions == null) || (regions != null && regions.Count == 0)) |
419 | { | 435 | { |
420 | m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); | 436 | m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); |
421 | regions = m_GridService.GetDefaultRegions(UUID.Zero); | 437 | regions = m_GridService.GetDefaultRegions(scopeID); |
422 | if (regions != null && regions.Count > 0) | 438 | if (regions != null && regions.Count > 0) |
423 | { | 439 | { |
424 | where = "safe"; | 440 | where = "safe"; |
@@ -461,7 +477,7 @@ namespace OpenSim.Services.LLLoginService | |||
461 | } | 477 | } |
462 | else | 478 | else |
463 | { | 479 | { |
464 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); | 480 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
465 | if (defaults != null && defaults.Count > 0) | 481 | if (defaults != null && defaults.Count > 0) |
466 | { | 482 | { |
467 | where = "safe"; | 483 | where = "safe"; |