diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 163 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 12 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLManager.cs | 31 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 46 |
4 files changed, 111 insertions, 141 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 5547c24..bb8cad5 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -114,7 +114,6 @@ namespace OpenSim.Framework.UserManagement | |||
114 | string clientversion = (string)requestData["version"]; | 114 | string clientversion = (string)requestData["version"]; |
115 | m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname); | 115 | m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname); |
116 | } | 116 | } |
117 | |||
118 | 117 | ||
119 | userProfile = GetTheUser(firstname, lastname); | 118 | userProfile = GetTheUser(firstname, lastname); |
120 | if (userProfile == null) | 119 | if (userProfile == null) |
@@ -398,7 +397,6 @@ namespace OpenSim.Framework.UserManagement | |||
398 | 397 | ||
399 | public Hashtable ProcessHTMLLogin(Hashtable keysvals) | 398 | public Hashtable ProcessHTMLLogin(Hashtable keysvals) |
400 | { | 399 | { |
401 | |||
402 | // Matches all unspecified characters | 400 | // Matches all unspecified characters |
403 | // Currently specified,; lowercase letters, upper case letters, numbers, underline | 401 | // Currently specified,; lowercase letters, upper case letters, numbers, underline |
404 | // period, space, parens, and dash. | 402 | // period, space, parens, and dash. |
@@ -422,44 +420,42 @@ namespace OpenSim.Framework.UserManagement | |||
422 | // the client requires the HTML form field be named 'username' | 420 | // the client requires the HTML form field be named 'username' |
423 | // however, the data it sends when it loads the first time is 'firstname' | 421 | // however, the data it sends when it loads the first time is 'firstname' |
424 | // another one of those little nuances. | 422 | // another one of those little nuances. |
425 | |||
426 | 423 | ||
427 | if (keysvals.Contains("firstname")) | 424 | if (keysvals.Contains("firstname")) |
428 | firstname = wfcut.Replace((string)keysvals["firstname"],String.Empty,99999); | 425 | firstname = wfcut.Replace((string)keysvals["firstname"], String.Empty, 99999); |
426 | |||
429 | if (keysvals.Contains("username")) | 427 | if (keysvals.Contains("username")) |
430 | firstname = wfcut.Replace((string)keysvals["username"],String.Empty,99999); | 428 | firstname = wfcut.Replace((string)keysvals["username"], String.Empty, 99999); |
431 | 429 | ||
432 | if (keysvals.Contains("lastname")) | 430 | if (keysvals.Contains("lastname")) |
433 | lastname = wfcut.Replace((string)keysvals["lastname"],String.Empty,99999); | 431 | lastname = wfcut.Replace((string)keysvals["lastname"], String.Empty, 99999); |
434 | 432 | ||
435 | if (keysvals.Contains("location")) | 433 | if (keysvals.Contains("location")) |
436 | location = wfcut.Replace((string)keysvals["location"],String.Empty,99999); | 434 | location = wfcut.Replace((string)keysvals["location"], String.Empty, 99999); |
437 | 435 | ||
438 | if (keysvals.Contains("region")) | 436 | if (keysvals.Contains("region")) |
439 | region = wfcut.Replace((string)keysvals["region"],String.Empty,99999); | 437 | region = wfcut.Replace((string)keysvals["region"], String.Empty, 99999); |
440 | 438 | ||
441 | if (keysvals.Contains("grid")) | 439 | if (keysvals.Contains("grid")) |
442 | grid = wfcut.Replace((string)keysvals["grid"],String.Empty,99999); | 440 | grid = wfcut.Replace((string)keysvals["grid"], String.Empty, 99999); |
443 | 441 | ||
444 | if (keysvals.Contains("channel")) | 442 | if (keysvals.Contains("channel")) |
445 | channel = wfcut.Replace((string)keysvals["channel"],String.Empty,99999); | 443 | channel = wfcut.Replace((string)keysvals["channel"], String.Empty, 99999); |
446 | 444 | ||
447 | if (keysvals.Contains("version")) | 445 | if (keysvals.Contains("version")) |
448 | version = wfcut.Replace((string)keysvals["version"],String.Empty,99999); | 446 | version = wfcut.Replace((string)keysvals["version"], String.Empty, 99999); |
449 | 447 | ||
450 | if (keysvals.Contains("lang")) | 448 | if (keysvals.Contains("lang")) |
451 | lang = wfcut.Replace((string)keysvals["lang"],String.Empty,99999); | 449 | lang = wfcut.Replace((string)keysvals["lang"], String.Empty, 99999); |
452 | 450 | ||
453 | if (keysvals.Contains("password")) | 451 | if (keysvals.Contains("password")) |
454 | password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999); | 452 | password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999); |
455 | 453 | ||
456 | |||
457 | // load our login form. | 454 | // load our login form. |
458 | string loginform = GetLoginForm(firstname,lastname,location,region,grid,channel,version,lang,password,errormessages); | 455 | string loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); |
459 | 456 | ||
460 | if (keysvals.ContainsKey("show_login_form")) | 457 | if (keysvals.ContainsKey("show_login_form")) |
461 | { | 458 | { |
462 | |||
463 | UserProfileData user = GetTheUser(firstname, lastname); | 459 | UserProfileData user = GetTheUser(firstname, lastname); |
464 | bool goodweblogin = false; | 460 | bool goodweblogin = false; |
465 | 461 | ||
@@ -472,9 +468,10 @@ namespace OpenSim.Framework.UserManagement | |||
472 | m_userManager.StoreWebLoginKey(user.UUID, webloginkey); | 468 | m_userManager.StoreWebLoginKey(user.UUID, webloginkey); |
473 | statuscode = 301; | 469 | statuscode = 301; |
474 | 470 | ||
475 | string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + | 471 | string redirectURL = "about:blank?redirect-http-hack=" + |
476 | lastname + | 472 | System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + |
477 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); | 473 | lastname + |
474 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); | ||
478 | //m_log.Info("[WEB]: R:" + redirectURL); | 475 | //m_log.Info("[WEB]: R:" + redirectURL); |
479 | returnactions["int_response_code"] = statuscode; | 476 | returnactions["int_response_code"] = statuscode; |
480 | returnactions["str_redirect_location"] = redirectURL; | 477 | returnactions["str_redirect_location"] = redirectURL; |
@@ -487,11 +484,7 @@ namespace OpenSim.Framework.UserManagement | |||
487 | loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); | 484 | loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); |
488 | returnactions["int_response_code"] = statuscode; | 485 | returnactions["int_response_code"] = statuscode; |
489 | returnactions["str_response_string"] = loginform; | 486 | returnactions["str_response_string"] = loginform; |
490 | |||
491 | } | 487 | } |
492 | |||
493 | |||
494 | |||
495 | } | 488 | } |
496 | else | 489 | else |
497 | { | 490 | { |
@@ -499,7 +492,6 @@ namespace OpenSim.Framework.UserManagement | |||
499 | returnactions["str_response_string"] = loginform; | 492 | returnactions["str_response_string"] = loginform; |
500 | } | 493 | } |
501 | return returnactions; | 494 | return returnactions; |
502 | |||
503 | } | 495 | } |
504 | 496 | ||
505 | public string GetLoginForm(string firstname, string lastname, string location, string region, | 497 | public string GetLoginForm(string firstname, string lastname, string location, string region, |
@@ -537,67 +529,66 @@ namespace OpenSim.Framework.UserManagement | |||
537 | public string GetDefaultLoginForm() | 529 | public string GetDefaultLoginForm() |
538 | { | 530 | { |
539 | string responseString = | 531 | string responseString = |
540 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; | 532 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; |
541 | responseString = responseString + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; | 533 | responseString += "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; |
542 | responseString = responseString + "<head>"; | 534 | responseString += "<head>"; |
543 | responseString = responseString + | 535 | responseString += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; |
544 | "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; | 536 | responseString += "<meta http-equiv=\"cache-control\" content=\"no-cache\">"; |
545 | responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">"; | 537 | responseString += "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; |
546 | responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; | 538 | responseString += "<title>OpenSim Login</title>"; |
547 | responseString = responseString + "<title>OpenSim Login</title>"; | 539 | responseString += "<body><br />"; |
548 | responseString = responseString + "<body><br />"; | 540 | responseString += "<div id=\"login_box\">"; |
549 | responseString = responseString + "<div id=\"login_box\">"; | ||
550 | 541 | ||
551 | responseString = responseString + "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">"; | 542 | responseString += "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">"; |
552 | 543 | ||
553 | responseString = responseString + "<div id=\"message\">[$errors]</div>"; | 544 | responseString += "<div id=\"message\">[$errors]</div>"; |
554 | responseString = responseString + "<fieldset id=\"firstname\">"; | 545 | responseString += "<fieldset id=\"firstname\">"; |
555 | responseString = responseString + "<legend>First Name:</legend>"; | 546 | responseString += "<legend>First Name:</legend>"; |
556 | responseString = responseString + "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"[$firstname]\" />"; | 547 | responseString += "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"[$firstname]\" />"; |
557 | responseString = responseString + "</fieldset>"; | 548 | responseString += "</fieldset>"; |
558 | responseString = responseString + "<fieldset id=\"lastname\">"; | 549 | responseString += "<fieldset id=\"lastname\">"; |
559 | responseString = responseString + "<legend>Last Name:</legend>"; | 550 | responseString += "<legend>Last Name:</legend>"; |
560 | responseString = responseString + "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"[$lastname]\" />"; | 551 | responseString += "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"[$lastname]\" />"; |
561 | responseString = responseString + "</fieldset>"; | 552 | responseString += "</fieldset>"; |
562 | responseString = responseString + "<fieldset id=\"password\">"; | 553 | responseString += "<fieldset id=\"password\">"; |
563 | responseString = responseString + "<legend>Password:</legend>"; | 554 | responseString += "<legend>Password:</legend>"; |
564 | responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; | 555 | responseString += "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; |
565 | responseString = responseString + "<tr>"; | 556 | responseString += "<tr>"; |
566 | responseString = responseString + "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"[$password]\" /></td>"; | 557 | responseString += "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"[$password]\" /></td>"; |
567 | responseString = responseString + "</tr>"; | 558 | responseString += "</tr>"; |
568 | responseString = responseString + "<tr>"; | 559 | responseString += "<tr>"; |
569 | responseString = responseString + "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" [$remember_password] style=\"margin-left:0px;\"/></td>"; | 560 | responseString += "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" [$remember_password] style=\"margin-left:0px;\"/></td>"; |
570 | responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>"; | 561 | responseString += "<td><label for=\"remember_password\">Remember password</label></td>"; |
571 | responseString = responseString + "</tr>"; | 562 | responseString += "</tr>"; |
572 | responseString = responseString + "</table>"; | 563 | responseString += "</table>"; |
573 | responseString = responseString + "</fieldset>"; | 564 | responseString += "</fieldset>"; |
574 | responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />"; | 565 | responseString += "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />"; |
575 | responseString = responseString + "<input type=\"hidden\" name=\"method\" value=\"login\" />"; | 566 | responseString += "<input type=\"hidden\" name=\"method\" value=\"login\" />"; |
576 | responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"[$grid]\" />"; | 567 | responseString += "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"[$grid]\" />"; |
577 | responseString = responseString + "<input type=\"hidden\" id=\"region\" name=\"region\" value=\"[$region]\" />"; | 568 | responseString += "<input type=\"hidden\" id=\"region\" name=\"region\" value=\"[$region]\" />"; |
578 | responseString = responseString + "<input type=\"hidden\" id=\"location\" name=\"location\" value=\"[$location]\" />"; | 569 | responseString += "<input type=\"hidden\" id=\"location\" name=\"location\" value=\"[$location]\" />"; |
579 | responseString = responseString + "<input type=\"hidden\" id=\"channel\" name=\"channel\" value=\"[$channel]\" />"; | 570 | responseString += "<input type=\"hidden\" id=\"channel\" name=\"channel\" value=\"[$channel]\" />"; |
580 | responseString = responseString + "<input type=\"hidden\" id=\"version\" name=\"version\" value=\"[$version]\" />"; | 571 | responseString += "<input type=\"hidden\" id=\"version\" name=\"version\" value=\"[$version]\" />"; |
581 | responseString = responseString + "<input type=\"hidden\" id=\"lang\" name=\"lang\" value=\"[$lang]\" />"; | 572 | responseString += "<input type=\"hidden\" id=\"lang\" name=\"lang\" value=\"[$lang]\" />"; |
582 | responseString = responseString + "<div id=\"submitbtn\">"; | 573 | responseString += "<div id=\"submitbtn\">"; |
583 | responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />"; | 574 | responseString += "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />"; |
584 | responseString = responseString + "</div>"; | 575 | responseString += "</div>"; |
585 | responseString = responseString + "<div id=\"connecting\" style=\"visibility:hidden\"> Connecting...</div>"; | 576 | responseString += "<div id=\"connecting\" style=\"visibility:hidden\"> Connecting...</div>"; |
586 | 577 | ||
587 | responseString = responseString + "<div id=\"helplinks\">"; | 578 | responseString += "<div id=\"helplinks\">"; |
588 | responseString = responseString + "<a href=\"#join now link\" target=\"_blank\"></a> | "; | 579 | responseString += "<a href=\"#join now link\" target=\"_blank\"></a> | "; |
589 | responseString = responseString + "<a href=\"#forgot password link\" target=\"_blank\"></a>"; | 580 | responseString += "<a href=\"#forgot password link\" target=\"_blank\"></a>"; |
590 | responseString = responseString + "</div>"; | 581 | responseString += "</div>"; |
591 | 582 | ||
592 | responseString = responseString + "<div id=\"channelinfo\"> [$channel] | [$version]=[$lang]</div>"; | 583 | responseString += "<div id=\"channelinfo\"> [$channel] | [$version]=[$lang]</div>"; |
593 | responseString = responseString + "</form>"; | 584 | responseString += "</form>"; |
594 | responseString = responseString + "<script language=\"JavaScript\">"; | 585 | responseString += "<script language=\"JavaScript\">"; |
595 | responseString = responseString + "document.getElementById('firstname_input').focus();"; | 586 | responseString += "document.getElementById('firstname_input').focus();"; |
596 | responseString = responseString + "</script>"; | 587 | responseString += "</script>"; |
597 | responseString = responseString + "</div>"; | 588 | responseString += "</div>"; |
598 | responseString = responseString + "</div>"; | 589 | responseString += "</div>"; |
599 | responseString = responseString + "</body>"; | 590 | responseString += "</body>"; |
600 | responseString = responseString + "</html>"; | 591 | responseString += "</html>"; |
601 | return responseString; | 592 | return responseString; |
602 | } | 593 | } |
603 | 594 | ||
@@ -611,7 +602,6 @@ namespace OpenSim.Framework.UserManagement | |||
611 | return m_userManager.CommitAgent(ref profile); | 602 | return m_userManager.CommitAgent(ref profile); |
612 | } | 603 | } |
613 | 604 | ||
614 | |||
615 | /// <summary> | 605 | /// <summary> |
616 | /// Checks a user against it's password hash | 606 | /// Checks a user against it's password hash |
617 | /// </summary> | 607 | /// </summary> |
@@ -638,7 +628,7 @@ namespace OpenSim.Framework.UserManagement | |||
638 | //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); | 628 | //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); |
639 | 629 | ||
640 | passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) | 630 | passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) |
641 | || profile.passwordHash.Equals(password,StringComparison.InvariantCultureIgnoreCase)); | 631 | || profile.passwordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); |
642 | 632 | ||
643 | return passwordSuccess; | 633 | return passwordSuccess; |
644 | } | 634 | } |
@@ -699,7 +689,6 @@ namespace OpenSim.Framework.UserManagement | |||
699 | buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; | 689 | buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; |
700 | buddyitem.BuddyRightsGiven = (int) fl.FriendPerms; | 690 | buddyitem.BuddyRightsGiven = (int) fl.FriendPerms; |
701 | buddylistreturn.AddNewBuddy(buddyitem); | 691 | buddylistreturn.AddNewBuddy(buddyitem); |
702 | |||
703 | } | 692 | } |
704 | return buddylistreturn; | 693 | return buddylistreturn; |
705 | } | 694 | } |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index b8e3114..48807c2 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -194,7 +194,6 @@ namespace OpenSim.Framework.UserManagement | |||
194 | /// <returns>A List of FriendListItems that contains info about the user's friends</returns> | 194 | /// <returns>A List of FriendListItems that contains info about the user's friends</returns> |
195 | public List<FriendListItem> GetUserFriendList(LLUUID ownerID) | 195 | public List<FriendListItem> GetUserFriendList(LLUUID ownerID) |
196 | { | 196 | { |
197 | |||
198 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 197 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
199 | { | 198 | { |
200 | try | 199 | try |
@@ -208,12 +207,10 @@ namespace OpenSim.Framework.UserManagement | |||
208 | } | 207 | } |
209 | 208 | ||
210 | return null; | 209 | return null; |
211 | |||
212 | } | 210 | } |
213 | 211 | ||
214 | public void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) | 212 | public void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) |
215 | { | 213 | { |
216 | |||
217 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 214 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
218 | { | 215 | { |
219 | try | 216 | try |
@@ -240,10 +237,8 @@ namespace OpenSim.Framework.UserManagement | |||
240 | m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); | 237 | m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); |
241 | } | 238 | } |
242 | } | 239 | } |
243 | |||
244 | } | 240 | } |
245 | 241 | ||
246 | |||
247 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | 242 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) |
248 | { | 243 | { |
249 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 244 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
@@ -273,6 +268,7 @@ namespace OpenSim.Framework.UserManagement | |||
273 | } | 268 | } |
274 | } | 269 | } |
275 | } | 270 | } |
271 | |||
276 | /// <summary> | 272 | /// <summary> |
277 | /// Loads a user agent by name (not called directly) | 273 | /// Loads a user agent by name (not called directly) |
278 | /// </summary> | 274 | /// </summary> |
@@ -295,7 +291,10 @@ namespace OpenSim.Framework.UserManagement | |||
295 | return null; | 291 | return null; |
296 | } | 292 | } |
297 | 293 | ||
298 | // TODO: document | 294 | /// <summary> |
295 | /// Resets the currentAgent in the user profile | ||
296 | /// </summary> | ||
297 | /// <param name="agentID">The agent's ID</param> | ||
299 | public void clearUserAgent(LLUUID agentID) | 298 | public void clearUserAgent(LLUUID agentID) |
300 | { | 299 | { |
301 | UserProfileData profile = GetUserProfile(agentID); | 300 | UserProfileData profile = GetUserProfile(agentID); |
@@ -459,7 +458,6 @@ namespace OpenSim.Framework.UserManagement | |||
459 | // If currentagent is null, we can't reference it here or the UserServer crashes! | 458 | // If currentagent is null, we can't reference it here or the UserServer crashes! |
460 | m_log.Info("[LOGOUT]: didn't save logout position: " + userid.ToString()); | 459 | m_log.Info("[LOGOUT]: didn't save logout position: " + userid.ToString()); |
461 | } | 460 | } |
462 | |||
463 | } | 461 | } |
464 | else | 462 | else |
465 | { | 463 | { |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index 46fd1bc..d422687 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs | |||
@@ -138,13 +138,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
138 | string dllName = module.Assembly.ManifestModule.Name; | 138 | string dllName = module.Assembly.ManifestModule.Name; |
139 | Version dllVersion = module.Assembly.GetName().Version; | 139 | Version dllVersion = module.Assembly.GetName().Version; |
140 | 140 | ||
141 | |||
142 | return | 141 | return |
143 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | 142 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, |
144 | dllVersion.Revision); | 143 | dllVersion.Revision); |
145 | } | 144 | } |
146 | 145 | ||
147 | |||
148 | /// <summary> | 146 | /// <summary> |
149 | /// Extract a named string resource from the embedded resources | 147 | /// Extract a named string resource from the embedded resources |
150 | /// </summary> | 148 | /// </summary> |
@@ -156,7 +154,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
156 | string[] names = assem.GetManifestResourceNames(); | 154 | string[] names = assem.GetManifestResourceNames(); |
157 | 155 | ||
158 | foreach (string s in names) | 156 | foreach (string s in names) |
157 | { | ||
159 | if (s.EndsWith(name)) | 158 | if (s.EndsWith(name)) |
159 | { | ||
160 | using (Stream resource = assem.GetManifestResourceStream(s)) | 160 | using (Stream resource = assem.GetManifestResourceStream(s)) |
161 | { | 161 | { |
162 | using (StreamReader resourceReader = new StreamReader(resource)) | 162 | using (StreamReader resourceReader = new StreamReader(resource)) |
@@ -165,6 +165,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
165 | return resourceString; | 165 | return resourceString; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | } | ||
169 | } | ||
168 | throw new Exception(string.Format("Resource '{0}' was not found", name)); | 170 | throw new Exception(string.Format("Resource '{0}' was not found", name)); |
169 | } | 171 | } |
170 | 172 | ||
@@ -214,8 +216,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
214 | } | 216 | } |
215 | } | 217 | } |
216 | 218 | ||
217 | 219 | // TODO: at some time this code should be cleaned up | |
218 | // at some time this code should be cleaned up | ||
219 | 220 | ||
220 | /// <summary> | 221 | /// <summary> |
221 | /// Runs a query with protection against SQL Injection by using parameterised input. | 222 | /// Runs a query with protection against SQL Injection by using parameterised input. |
@@ -249,7 +250,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
249 | { | 250 | { |
250 | } | 251 | } |
251 | 252 | ||
252 | // Try reopen it | 253 | // Try to reopen it |
253 | try | 254 | try |
254 | { | 255 | { |
255 | dbcon = new MySqlConnection(connectionString); | 256 | dbcon = new MySqlConnection(connectionString); |
@@ -368,7 +369,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
368 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); | 369 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); |
369 | retval.reservationName = (string) reader["resName"]; | 370 | retval.reservationName = (string) reader["resName"]; |
370 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; | 371 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; |
371 | LLUUID.TryParse((string) reader["userUUID"], out retval.userUUID); | 372 | LLUUID.TryParse((string) reader["userUUID"], out retval.userUUID); |
372 | } | 373 | } |
373 | else | 374 | else |
374 | { | 375 | { |
@@ -458,22 +459,22 @@ namespace OpenSim.Framework.Data.MySQL | |||
458 | else | 459 | else |
459 | retval.profileAboutText = (string) reader["profileAboutText"]; | 460 | retval.profileAboutText = (string) reader["profileAboutText"]; |
460 | 461 | ||
461 | if (reader.IsDBNull( reader.GetOrdinal( "profileFirstText" ) ) ) | 462 | if (reader.IsDBNull(reader.GetOrdinal("profileFirstText"))) |
462 | retval.profileFirstText = ""; | 463 | retval.profileFirstText = ""; |
463 | else | 464 | else |
464 | retval.profileFirstText = (string)reader["profileFirstText"]; | 465 | retval.profileFirstText = (string)reader["profileFirstText"]; |
465 | 466 | ||
466 | if (reader.IsDBNull( reader.GetOrdinal( "profileImage" ) ) ) | 467 | if (reader.IsDBNull(reader.GetOrdinal("profileImage"))) |
467 | retval.profileImage = LLUUID.Zero; | 468 | retval.profileImage = LLUUID.Zero; |
468 | else | 469 | else |
469 | LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage); | 470 | LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage); |
470 | 471 | ||
471 | if (reader.IsDBNull( reader.GetOrdinal( "profileFirstImage" ) ) ) | 472 | if (reader.IsDBNull(reader.GetOrdinal("profileFirstImage"))) |
472 | retval.profileFirstImage = LLUUID.Zero; | 473 | retval.profileFirstImage = LLUUID.Zero; |
473 | else | 474 | else |
474 | LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage); | 475 | LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage); |
475 | 476 | ||
476 | if( reader.IsDBNull( reader.GetOrdinal( "webLoginKey" ) ) ) | 477 | if(reader.IsDBNull(reader.GetOrdinal("webLoginKey"))) |
477 | { | 478 | { |
478 | retval.webLoginKey = LLUUID.Zero; | 479 | retval.webLoginKey = LLUUID.Zero; |
479 | } | 480 | } |
@@ -489,7 +490,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
489 | return retval; | 490 | return retval; |
490 | } | 491 | } |
491 | 492 | ||
492 | |||
493 | /// <summary> | 493 | /// <summary> |
494 | /// Inserts a new row into the log database | 494 | /// Inserts a new row into the log database |
495 | /// </summary> | 495 | /// </summary> |
@@ -534,7 +534,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
534 | return returnval; | 534 | return returnval; |
535 | } | 535 | } |
536 | 536 | ||
537 | |||
538 | /// <summary> | 537 | /// <summary> |
539 | /// Creates a new user and inserts it into the database | 538 | /// Creates a new user and inserts it into the database |
540 | /// </summary> | 539 | /// </summary> |
@@ -630,7 +629,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
630 | return returnval; | 629 | return returnval; |
631 | } | 630 | } |
632 | 631 | ||
633 | /// <summary> | 632 | /// <summary> |
634 | /// Creates a new user and inserts it into the database | 633 | /// Creates a new user and inserts it into the database |
635 | /// </summary> | 634 | /// </summary> |
636 | /// <param name="uuid">User ID</param> | 635 | /// <param name="uuid">User ID</param> |
@@ -823,6 +822,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
823 | 822 | ||
824 | return returnval; | 823 | return returnval; |
825 | } | 824 | } |
825 | |||
826 | /// <summary> | 826 | /// <summary> |
827 | /// Delete a region from the database | 827 | /// Delete a region from the database |
828 | /// </summary> | 828 | /// </summary> |
@@ -833,14 +833,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
833 | { | 833 | { |
834 | bool returnval = false; | 834 | bool returnval = false; |
835 | 835 | ||
836 | string sql = | 836 | string sql = "DELETE FROM regions WHERE uuid = ?uuid;"; |
837 | "DELETE FROM regions WHERE uuid = ?uuid;"; | ||
838 | 837 | ||
839 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 838 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
840 | 839 | ||
841 | try | 840 | try |
842 | { | 841 | { |
843 | parameters["?uuid"] = uuid; | 842 | parameters["?uuid"] = uuid; |
844 | 843 | ||
845 | IDbCommand result = Query(sql, parameters); | 844 | IDbCommand result = Query(sql, parameters); |
846 | 845 | ||
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 4c76461..1370b1b 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs | |||
@@ -108,7 +108,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
108 | UpgradeAgentsTable(tableList[m_agentsTableName]); | 108 | UpgradeAgentsTable(tableList[m_agentsTableName]); |
109 | UpgradeUsersTable(tableList[m_usersTableName]); | 109 | UpgradeUsersTable(tableList[m_usersTableName]); |
110 | UpgradeFriendsTable(tableList[m_userFriendsTableName]); | 110 | UpgradeFriendsTable(tableList[m_userFriendsTableName]); |
111 | |||
112 | } | 111 | } |
113 | 112 | ||
114 | /// <summary> | 113 | /// <summary> |
@@ -227,7 +226,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
227 | "(?friendID,?ownerID,?friendPerms,?datetimestamp)", | 226 | "(?friendID,?ownerID,?friendPerms,?datetimestamp)", |
228 | param); | 227 | param); |
229 | adder.ExecuteNonQuery(); | 228 | adder.ExecuteNonQuery(); |
230 | |||
231 | } | 229 | } |
232 | } | 230 | } |
233 | catch (Exception e) | 231 | catch (Exception e) |
@@ -244,23 +242,21 @@ namespace OpenSim.Framework.Data.MySQL | |||
244 | param["?ownerID"] = friendlistowner.UUID.ToString(); | 242 | param["?ownerID"] = friendlistowner.UUID.ToString(); |
245 | param["?friendID"] = friend.UUID.ToString(); | 243 | param["?friendID"] = friend.UUID.ToString(); |
246 | 244 | ||
247 | |||
248 | try | 245 | try |
249 | { | 246 | { |
250 | lock (database) | 247 | lock (database) |
251 | { | 248 | { |
252 | IDbCommand updater = | 249 | IDbCommand updater = |
253 | database.Query( | 250 | database.Query( |
254 | "delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID", | 251 | "delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID", |
255 | param); | 252 | param); |
256 | updater.ExecuteNonQuery(); | 253 | updater.ExecuteNonQuery(); |
257 | 254 | ||
258 | updater = | 255 | updater = |
259 | database.Query( | 256 | database.Query( |
260 | "delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID", | 257 | "delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID", |
261 | param); | 258 | param); |
262 | updater.ExecuteNonQuery(); | 259 | updater.ExecuteNonQuery(); |
263 | |||
264 | } | 260 | } |
265 | } | 261 | } |
266 | catch (Exception e) | 262 | catch (Exception e) |
@@ -270,13 +266,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
270 | return; | 266 | return; |
271 | } | 267 | } |
272 | } | 268 | } |
269 | |||
273 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | 270 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) |
274 | { | 271 | { |
275 | Dictionary<string, string> param = new Dictionary<string, string>(); | 272 | Dictionary<string, string> param = new Dictionary<string, string>(); |
276 | param["?ownerID"] = friendlistowner.UUID.ToString(); | 273 | param["?ownerID"] = friendlistowner.UUID.ToString(); |
277 | param["?friendID"] = friend.UUID.ToString(); | 274 | param["?friendID"] = friend.UUID.ToString(); |
278 | param["?friendPerms"] = perms.ToString(); | 275 | param["?friendPerms"] = perms.ToString(); |
279 | |||
280 | 276 | ||
281 | try | 277 | try |
282 | { | 278 | { |
@@ -284,12 +280,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
284 | { | 280 | { |
285 | IDbCommand updater = | 281 | IDbCommand updater = |
286 | database.Query( | 282 | database.Query( |
287 | "update " + m_userFriendsTableName + | 283 | "update " + m_userFriendsTableName + |
288 | " SET friendPerms = ?friendPerms " + | 284 | " SET friendPerms = ?friendPerms " + |
289 | "where ownerID = ?ownerID and friendID = ?friendID", | 285 | "where ownerID = ?ownerID and friendID = ?friendID", |
290 | param); | 286 | param); |
291 | updater.ExecuteNonQuery(); | 287 | updater.ExecuteNonQuery(); |
292 | |||
293 | } | 288 | } |
294 | } | 289 | } |
295 | catch (Exception e) | 290 | catch (Exception e) |
@@ -300,7 +295,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
300 | } | 295 | } |
301 | } | 296 | } |
302 | 297 | ||
303 | |||
304 | public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) | 298 | public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) |
305 | { | 299 | { |
306 | List<FriendListItem> Lfli = new List<FriendListItem>(); | 300 | List<FriendListItem> Lfli = new List<FriendListItem>(); |
@@ -315,12 +309,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
315 | //Left Join userfriends to itself | 309 | //Left Join userfriends to itself |
316 | IDbCommand result = | 310 | IDbCommand result = |
317 | database.Query( | 311 | database.Query( |
318 | "select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " + m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" + | 312 | "select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " + m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" + |
319 | " where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID", | 313 | " where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID", |
320 | param); | 314 | param); |
321 | IDataReader reader = result.ExecuteReader(); | 315 | IDataReader reader = result.ExecuteReader(); |
322 | 316 | ||
323 | |||
324 | while (reader.Read()) | 317 | while (reader.Read()) |
325 | { | 318 | { |
326 | FriendListItem fli = new FriendListItem(); | 319 | FriendListItem fli = new FriendListItem(); |
@@ -354,7 +347,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
354 | m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); | 347 | m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); |
355 | } | 348 | } |
356 | 349 | ||
357 | |||
358 | public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | 350 | public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) |
359 | { | 351 | { |
360 | List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>(); | 352 | List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>(); |
@@ -378,7 +370,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
378 | param); | 370 | param); |
379 | IDataReader reader = result.ExecuteReader(); | 371 | IDataReader reader = result.ExecuteReader(); |
380 | 372 | ||
381 | |||
382 | while (reader.Read()) | 373 | while (reader.Read()) |
383 | { | 374 | { |
384 | Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); | 375 | Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); |
@@ -413,7 +404,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
413 | param); | 404 | param); |
414 | IDataReader reader = result.ExecuteReader(); | 405 | IDataReader reader = result.ExecuteReader(); |
415 | 406 | ||
416 | |||
417 | while (reader.Read()) | 407 | while (reader.Read()) |
418 | { | 408 | { |
419 | Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); | 409 | Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); |
@@ -489,7 +479,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
489 | 479 | ||
490 | public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) | 480 | public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) |
491 | { | 481 | { |
492 | |||
493 | Dictionary<string, string> param = new Dictionary<string, string>(); | 482 | Dictionary<string, string> param = new Dictionary<string, string>(); |
494 | param["?UUID"] = AgentID.UUID.ToString(); | 483 | param["?UUID"] = AgentID.UUID.ToString(); |
495 | param["?webLoginKey"] = WebLoginKey.UUID.ToString(); | 484 | param["?webLoginKey"] = WebLoginKey.UUID.ToString(); |
@@ -500,11 +489,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
500 | { | 489 | { |
501 | IDbCommand updater = | 490 | IDbCommand updater = |
502 | database.Query( | 491 | database.Query( |
503 | "update " + m_usersTableName + " SET webLoginKey = ?webLoginKey " + | 492 | "update " + m_usersTableName + " SET webLoginKey = ?webLoginKey " + |
504 | "where UUID = ?UUID", | 493 | "where UUID = ?UUID", |
505 | param); | 494 | param); |
506 | updater.ExecuteNonQuery(); | 495 | updater.ExecuteNonQuery(); |
507 | |||
508 | } | 496 | } |
509 | } | 497 | } |
510 | catch (Exception e) | 498 | catch (Exception e) |
@@ -513,10 +501,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
513 | m_log.Error(e.ToString()); | 501 | m_log.Error(e.ToString()); |
514 | return; | 502 | return; |
515 | } | 503 | } |
516 | |||
517 | |||
518 | |||
519 | |||
520 | } | 504 | } |
521 | 505 | ||
522 | /// <summary> | 506 | /// <summary> |
@@ -605,11 +589,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
605 | /// <param name="user">The profile data to use to update the DB</param> | 589 | /// <param name="user">The profile data to use to update the DB</param> |
606 | public bool UpdateUserProfile(UserProfileData user) | 590 | public bool UpdateUserProfile(UserProfileData user) |
607 | { | 591 | { |
608 | database.updateUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt | 592 | database.updateUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, |
609 | , user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, user.homeLookAt.X | 593 | user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, user.homeLookAt.X, |
610 | , user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI | 594 | user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, |
611 | , user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, user.profileAboutText | 595 | user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, user.profileAboutText, |
612 | , user.profileFirstText, user.profileImage, user.profileFirstImage, user.webLoginKey); | 596 | user.profileFirstText, user.profileImage, user.profileFirstImage, user.webLoginKey); |
613 | return true; | 597 | return true; |
614 | } | 598 | } |
615 | 599 | ||