aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie2010-04-27 03:48:49 +0100
committerMelanie2010-04-27 03:48:49 +0100
commit1e743eab6d620a14876a1ec9b41b3e136af889d3 (patch)
treea9f0a968d10d6f65040c5ec13b0726ddf23377b7 /OpenSim/Services
parentFix build break. (diff)
downloadopensim-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
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Interfaces/ILoginService.cs3
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs44
2 files changed, 32 insertions, 15 deletions
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;
31using System.Net; 31using System.Net;
32 32
33using OpenMetaverse.StructuredData; 33using OpenMetaverse.StructuredData;
34using OpenMetaverse;
34 35
35namespace OpenSim.Services.Interfaces 36namespace 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";