aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/LLLoginService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/LLLoginService')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs69
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs73
2 files changed, 123 insertions, 19 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 079bcb1..a4b3cbd 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -231,7 +231,8 @@ namespace OpenSim.Services.LLLoginService
231 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 231 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
232 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 232 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
233 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 233 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
234 GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency) 234 GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency,
235 string DSTZone)
235 : this() 236 : this()
236 { 237 {
237 FillOutInventoryData(invSkel, libService); 238 FillOutInventoryData(invSkel, libService);
@@ -260,7 +261,45 @@ namespace OpenSim.Services.LLLoginService
260 FillOutRegionData(destination); 261 FillOutRegionData(destination);
261 262
262 FillOutSeedCap(aCircuit, destination, clientIP); 263 FillOutSeedCap(aCircuit, destination, clientIP);
263 264
265 switch (DSTZone)
266 {
267 case "none":
268 DST = "N";
269 break;
270 case "local":
271 DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
272 break;
273 default:
274 TimeZoneInfo dstTimeZone = null;
275 string[] tzList = DSTZone.Split(';');
276
277 foreach (string tzName in tzList)
278 {
279 try
280 {
281 dstTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzName);
282 }
283 catch
284 {
285 continue;
286 }
287 break;
288 }
289
290 if (dstTimeZone == null)
291 {
292 m_log.WarnFormat(
293 "[LLOGIN RESPONSE]: No valid timezone found for DST in {0}, falling back to system time.", tzList);
294 DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
295 }
296 else
297 {
298 DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
299 }
300
301 break;
302 }
264 } 303 }
265 304
266 private void FillOutInventoryData(List<InventoryFolderBase> invSkel, ILibraryService libService) 305 private void FillOutInventoryData(List<InventoryFolderBase> invSkel, ILibraryService libService)
@@ -355,7 +394,31 @@ namespace OpenSim.Services.LLLoginService
355 394
356 private void SetDefaultValues() 395 private void SetDefaultValues()
357 { 396 {
358 DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; 397 TimeZoneInfo gridTimeZone;
398
399 // Disabled for now pending making timezone a config value, which can at some point have a default of
400 // a ; separated list of possible timezones.
401 // The problem here is that US/Pacific (or even the Olsen America/Los_Angeles) is not universal across
402 // windows, mac and various distributions of linux, introducing another element of consistency.
403 // The server operator needs to be able to control this setting
404// try
405// {
406// // First try to fetch DST from Pacific Standard Time, because this is
407// // the one expected by the viewer. "US/Pacific" is the string to search
408// // on linux and mac, and should work also on Windows (to confirm)
409// gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific");
410// }
411// catch (Exception e)
412// {
413// m_log.WarnFormat(
414// "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time",
415// e.Message);
416
417 gridTimeZone = TimeZoneInfo.Local;
418// }
419
420 DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
421
359 StipendSinceLogin = "N"; 422 StipendSinceLogin = "N";
360 Gendered = "Y"; 423 Gendered = "Y";
361 EverLoggedIn = "Y"; 424 EverLoggedIn = "Y";
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 891c452..ed887d9 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -82,6 +82,8 @@ namespace OpenSim.Services.LLLoginService
82 protected string m_AllowedClients; 82 protected string m_AllowedClients;
83 protected string m_DeniedClients; 83 protected string m_DeniedClients;
84 84
85 protected string m_DSTZone;
86
85 IConfig m_LoginServerConfig; 87 IConfig m_LoginServerConfig;
86// IConfig m_ClientsConfig; 88// IConfig m_ClientsConfig;
87 89
@@ -118,6 +120,8 @@ namespace OpenSim.Services.LLLoginService
118 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); 120 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
119 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); 121 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);
120 122
123 m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");
124
121 // Clean up some of these vars 125 // Clean up some of these vars
122 if (m_MapTileURL != String.Empty) 126 if (m_MapTileURL != String.Empty)
123 { 127 {
@@ -241,6 +245,7 @@ namespace OpenSim.Services.LLLoginService
241 245
242 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", 246 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}",
243 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); 247 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0);
248
244 try 249 try
245 { 250 {
246 // 251 //
@@ -253,7 +258,9 @@ namespace OpenSim.Services.LLLoginService
253 258
254 if (!am.Success) 259 if (!am.Success)
255 { 260 {
256 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is not allowed", clientVersion); 261 m_log.InfoFormat(
262 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is not allowed",
263 firstName, lastName, clientVersion);
257 return LLFailedLoginResponse.LoginBlockedProblem; 264 return LLFailedLoginResponse.LoginBlockedProblem;
258 } 265 }
259 } 266 }
@@ -265,7 +272,9 @@ namespace OpenSim.Services.LLLoginService
265 272
266 if (dm.Success) 273 if (dm.Success)
267 { 274 {
268 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is denied", clientVersion); 275 m_log.InfoFormat(
276 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is denied",
277 firstName, lastName, clientVersion);
269 return LLFailedLoginResponse.LoginBlockedProblem; 278 return LLFailedLoginResponse.LoginBlockedProblem;
270 } 279 }
271 } 280 }
@@ -276,7 +285,8 @@ namespace OpenSim.Services.LLLoginService
276 UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); 285 UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName);
277 if (account == null) 286 if (account == null)
278 { 287 {
279 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); 288 m_log.InfoFormat(
289 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user not found", firstName, lastName);
280 return LLFailedLoginResponse.UserProblem; 290 return LLFailedLoginResponse.UserProblem;
281 } 291 }
282 292
@@ -288,7 +298,9 @@ namespace OpenSim.Services.LLLoginService
288 298
289 if (account.UserLevel < m_MinLoginLevel) 299 if (account.UserLevel < m_MinLoginLevel)
290 { 300 {
291 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); 301 m_log.InfoFormat(
302 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}",
303 firstName, lastName, m_MinLoginLevel, account.UserLevel);
292 return LLFailedLoginResponse.LoginBlockedProblem; 304 return LLFailedLoginResponse.LoginBlockedProblem;
293 } 305 }
294 306
@@ -299,7 +311,8 @@ namespace OpenSim.Services.LLLoginService
299 { 311 {
300 if (account.ScopeID != scopeID && account.ScopeID != UUID.Zero) 312 if (account.ScopeID != scopeID && account.ScopeID != UUID.Zero)
301 { 313 {
302 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); 314 m_log.InfoFormat(
315 "[LLOGIN SERVICE]: Login failed, reason: user {0} {1} not found", firstName, lastName);
303 return LLFailedLoginResponse.UserProblem; 316 return LLFailedLoginResponse.UserProblem;
304 } 317 }
305 } 318 }
@@ -318,7 +331,9 @@ namespace OpenSim.Services.LLLoginService
318 UUID secureSession = UUID.Zero; 331 UUID secureSession = UUID.Zero;
319 if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) 332 if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession)))
320 { 333 {
321 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: authentication failed"); 334 m_log.InfoFormat(
335 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: authentication failed",
336 firstName, lastName);
322 return LLFailedLoginResponse.UserProblem; 337 return LLFailedLoginResponse.UserProblem;
323 } 338 }
324 339
@@ -327,13 +342,18 @@ namespace OpenSim.Services.LLLoginService
327 // 342 //
328 if (m_RequireInventory && m_InventoryService == null) 343 if (m_RequireInventory && m_InventoryService == null)
329 { 344 {
330 m_log.WarnFormat("[LLOGIN SERVICE]: Login failed, reason: inventory service not set up"); 345 m_log.WarnFormat(
346 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: inventory service not set up",
347 firstName, lastName);
331 return LLFailedLoginResponse.InventoryProblem; 348 return LLFailedLoginResponse.InventoryProblem;
332 } 349 }
350
333 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID); 351 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
334 if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))) 352 if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0)))
335 { 353 {
336 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: unable to retrieve user inventory"); 354 m_log.InfoFormat(
355 "[LLOGIN SERVICE]: Login failed, for {0} {1}, reason: unable to retrieve user inventory",
356 firstName, lastName);
337 return LLFailedLoginResponse.InventoryProblem; 357 return LLFailedLoginResponse.InventoryProblem;
338 } 358 }
339 359
@@ -347,9 +367,12 @@ namespace OpenSim.Services.LLLoginService
347 if (m_PresenceService != null) 367 if (m_PresenceService != null)
348 { 368 {
349 success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); 369 success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession);
370
350 if (!success) 371 if (!success)
351 { 372 {
352 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence"); 373 m_log.InfoFormat(
374 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: could not login presence",
375 firstName, lastName);
353 return LLFailedLoginResponse.GridProblem; 376 return LLFailedLoginResponse.GridProblem;
354 } 377 }
355 } 378 }
@@ -382,9 +405,18 @@ namespace OpenSim.Services.LLLoginService
382 if (destination == null) 405 if (destination == null)
383 { 406 {
384 m_PresenceService.LogoutAgent(session); 407 m_PresenceService.LogoutAgent(session);
385 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found"); 408
409 m_log.InfoFormat(
410 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: destination not found",
411 firstName, lastName);
386 return LLFailedLoginResponse.GridProblem; 412 return LLFailedLoginResponse.GridProblem;
387 } 413 }
414 else
415 {
416 m_log.DebugFormat(
417 "[LLOGIN SERVICE]: Found destination {0}, endpoint {1} for {2} {3}",
418 destination.RegionName, destination.ExternalEndPoint, firstName, lastName);
419 }
388 420
389 if (account.UserLevel >= 200) 421 if (account.UserLevel >= 200)
390 flags |= TeleportFlags.Godlike; 422 flags |= TeleportFlags.Godlike;
@@ -408,7 +440,7 @@ namespace OpenSim.Services.LLLoginService
408 if (aCircuit == null) 440 if (aCircuit == null)
409 { 441 {
410 m_PresenceService.LogoutAgent(session); 442 m_PresenceService.LogoutAgent(session);
411 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason); 443 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed for {0} {1}, reason: {2}", firstName, lastName, reason);
412 return new LLFailedLoginResponse("key", reason, "false"); 444 return new LLFailedLoginResponse("key", reason, "false");
413 445
414 } 446 }
@@ -423,10 +455,14 @@ namespace OpenSim.Services.LLLoginService
423 // 455 //
424 // Finally, fill out the response and return it 456 // Finally, fill out the response and return it
425 // 457 //
426 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 458 LLLoginResponse response
427 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency); 459 = new LLLoginResponse(
460 account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
461 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP,
462 m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone);
463
464 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName);
428 465
429 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
430 return response; 466 return response;
431 } 467 }
432 catch (Exception e) 468 catch (Exception e)
@@ -438,11 +474,16 @@ namespace OpenSim.Services.LLLoginService
438 } 474 }
439 } 475 }
440 476
441 protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags) 477 protected GridRegion FindDestination(
478 UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation,
479 GridRegion home, out GridRegion gatekeeper,
480 out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
442 { 481 {
443 flags = TeleportFlags.ViaLogin; 482 flags = TeleportFlags.ViaLogin;
444 483
445 m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); 484 m_log.DebugFormat(
485 "[LLOGIN SERVICE]: Finding destination matching start location {0} for {1}",
486 startLocation, account.Name);
446 487
447 gatekeeper = null; 488 gatekeeper = null;
448 where = "home"; 489 where = "home";