From de20f0603fa419ba16c56d16c2ad55301cad8b83 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 24 Jun 2011 19:49:05 +0100
Subject: Tell hypergridders when their teleports fail because of the 4096
limit rather than just saying "destination not found"
Instead of performing the 4096 check when the region is linked (and subsequently removing the link), leave the link in place and perform the check in the entity transfer module
This allows us to explicitly tell the hypergridder why the teleport failed (region out of range).
It also allows people on regions that are within range (on a large source grid) to teleport.
The Check4096 config parameter in the [GridService] section is replaced by a max_distance paramter in a new [EntityTransfer] section in OpenSimDefaults.ini
Since the parameter is in OpenSimDefaults.ini no action needs to be taken unless you want to increase this limit. It could also be decreased.
The check is being made in the base entity transfer module, since I believe the viewer problem occurs both on extremely large grids and while hypergridding.
---
OpenSim/Services/GridService/HypergridLinker.cs | 115 ++++++++++++------------
1 file changed, 59 insertions(+), 56 deletions(-)
(limited to 'OpenSim/Services')
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 5262598..83ec122 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService
protected GatekeeperServiceConnector m_GatekeeperConnector;
protected UUID m_ScopeID = UUID.Zero;
- protected bool m_Check4096 = true;
+// protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty;
protected string m_ThisGatekeeper = string.Empty;
protected Uri m_ThisGatekeeperURI = null;
@@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
if (scope != string.Empty)
UUID.TryParse(scope, out m_ScopeID);
- m_Check4096 = gridConfig.GetBoolean("Check4096", true);
+// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
@@ -347,14 +347,18 @@ namespace OpenSim.Services.GridService
return true;
}
- uint x, y;
- if (m_Check4096 && !Check4096(handle, out x, out y))
- {
- RemoveHyperlinkRegion(regInfo.RegionID);
- reason = "Region is too far (" + x + ", " + y + ")";
- m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
- return false;
- }
+ // We are now performing this check for each individual teleport in the EntityTransferModule instead. This
+ // allows us to give better feedback when teleports fail because of the distance reason (which can't be
+ // done here) and it also hypergrid teleports that are within range (possibly because the source grid
+ // itself has regions that are very far apart).
+// uint x, y;
+// if (m_Check4096 && !Check4096(handle, out x, out y))
+// {
+// //RemoveHyperlinkRegion(regInfo.RegionID);
+// reason = "Region is too far (" + x + ", " + y + ")";
+// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
+// //return false;
+// }
regInfo.RegionID = regionID;
@@ -405,60 +409,59 @@ namespace OpenSim.Services.GridService
}
}
- ///
- /// Cope with this viewer limitation.
- ///
- ///
- ///
- public bool Check4096(ulong realHandle, out uint x, out uint y)
- {
- uint ux = 0, uy = 0;
- Utils.LongToUInts(realHandle, out ux, out uy);
- x = ux / Constants.RegionSize;
- y = uy / Constants.RegionSize;
-
- const uint limit = (4096 - 1) * Constants.RegionSize;
- uint xmin = ux - limit;
- uint xmax = ux + limit;
- uint ymin = uy - limit;
- uint ymax = uy + limit;
- // World map boundary checks
- if (xmin < 0 || xmin > ux)
- xmin = 0;
- if (xmax > int.MaxValue || xmax < ux)
- xmax = int.MaxValue;
- if (ymin < 0 || ymin > uy)
- ymin = 0;
- if (ymax > int.MaxValue || ymax < uy)
- ymax = int.MaxValue;
-
- // Check for any regions that are within the possible teleport range to the linked region
- List regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
- if (regions.Count == 0)
- {
- return false;
- }
- else
- {
- // Check for regions which are not linked regions
- List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
- IEnumerable availableRegions = regions.Except(hyperlinks);
- if (availableRegions.Count() == 0)
- return false;
- }
-
- return true;
- }
+// Not currently used
+// ///
+// /// Cope with this viewer limitation.
+// ///
+// ///
+// ///
+// public bool Check4096(ulong realHandle, out uint x, out uint y)
+// {
+// uint ux = 0, uy = 0;
+// Utils.LongToUInts(realHandle, out ux, out uy);
+// x = ux / Constants.RegionSize;
+// y = uy / Constants.RegionSize;
+//
+// const uint limit = (4096 - 1) * Constants.RegionSize;
+// uint xmin = ux - limit;
+// uint xmax = ux + limit;
+// uint ymin = uy - limit;
+// uint ymax = uy + limit;
+// // World map boundary checks
+// if (xmin < 0 || xmin > ux)
+// xmin = 0;
+// if (xmax > int.MaxValue || xmax < ux)
+// xmax = int.MaxValue;
+// if (ymin < 0 || ymin > uy)
+// ymin = 0;
+// if (ymax > int.MaxValue || ymax < uy)
+// ymax = int.MaxValue;
+//
+// // Check for any regions that are within the possible teleport range to the linked region
+// List regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
+// if (regions.Count == 0)
+// {
+// return false;
+// }
+// else
+// {
+// // Check for regions which are not linked regions
+// List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
+// IEnumerable availableRegions = regions.Except(hyperlinks);
+// if (availableRegions.Count() == 0)
+// return false;
+// }
+//
+// return true;
+// }
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
{
-
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
rdata.Data["flags"] = flags.ToString();
m_Database.Store(rdata);
-
}
private void RemoveHyperlinkRegion(UUID regionID)
--
cgit v1.1
From 56dcc5109486e6ef721f065135b8c87c3501d8e2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 24 Jun 2011 23:54:37 +0100
Subject: Add a command "show account " to the user
account service that will show the given user details
---
.../UserAccountService/UserAccountService.cs | 39 +++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Services')
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index f376cf8..3525912 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -83,9 +83,16 @@ namespace OpenSim.Services.UserAccountService
"create user",
"create user [ [ [ []]]]",
"Create a new user", HandleCreateUser);
- MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password",
+
+ MainConsole.Instance.Commands.AddCommand("UserService", false,
+ "reset user password",
"reset user password [ [ []]]",
"Reset a user password", HandleResetUserPassword);
+
+ MainConsole.Instance.Commands.AddCommand("UserService", false,
+ "show account",
+ "show account ",
+ "Show account details for the given user", HandleShowAccount);
}
}
@@ -318,6 +325,36 @@ namespace OpenSim.Services.UserAccountService
CreateUser(firstName, lastName, password, email);
}
+ protected void HandleShowAccount(string module, string[] cmdparams)
+ {
+ if (cmdparams.Length != 4)
+ {
+ MainConsole.Instance.Output("Usage: show account ");
+ return;
+ }
+
+ string firstName = cmdparams[2];
+ string lastName = cmdparams[3];
+
+ UserAccount ua = GetUserAccount(UUID.Zero, firstName, lastName);
+
+ if (ua == null)
+ {
+ MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName);
+ return;
+ }
+
+ MainConsole.Instance.OutputFormat("Name: {0}", ua.Name);
+ MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID);
+ MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle);
+ MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email);
+ MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created));
+ MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel);
+ MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags);
+ foreach (KeyValuePair kvp in ua.ServiceURLs)
+ MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value);
+ }
+
protected void HandleResetUserPassword(string module, string[] cmdparams)
{
string firstName;
--
cgit v1.1
From 296774495b8544cbb3463e0a0694d7de910a5d7c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 25 Jun 2011 00:03:34 +0100
Subject: Implement "set user level" console command to set the user level
(which determines whether a user has a god account)
Adapted from Makopoppo's patch in http://opensimulator.org/mantis/view.php?id=5552. Thanks!
---
.../UserAccountService/UserAccountService.cs | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
(limited to 'OpenSim/Services')
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 3525912..a65c04b 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -90,6 +90,14 @@ namespace OpenSim.Services.UserAccountService
"Reset a user password", HandleResetUserPassword);
MainConsole.Instance.Commands.AddCommand("UserService", false,
+ "set user level",
+ "set user level [ [ []]]",
+ "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
+ + "this account will be treated as god-moded. "
+ + "It will also affect the 'login level' command. ",
+ HandleSetUserLevel);
+
+ MainConsole.Instance.Commands.AddCommand("UserService", false,
"show account",
"show account ",
"Show account details for the given user", HandleShowAccount);
@@ -387,6 +395,45 @@ namespace OpenSim.Services.UserAccountService
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
}
+ protected void HandleSetUserLevel(string module, string[] cmdparams)
+ {
+ string firstName;
+ string lastName;
+ string rawLevel;
+ int level;
+
+ if (cmdparams.Length < 4)
+ firstName = MainConsole.Instance.CmdPrompt("First name");
+ else firstName = cmdparams[3];
+
+ if (cmdparams.Length < 5)
+ lastName = MainConsole.Instance.CmdPrompt("Last name");
+ else lastName = cmdparams[4];
+
+ UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
+ if (account == null) {
+ MainConsole.Instance.OutputFormat("No such user");
+ return;
+ }
+
+ if (cmdparams.Length < 6)
+ rawLevel = MainConsole.Instance.CmdPrompt("User level");
+ else rawLevel = cmdparams[5];
+
+ if(int.TryParse(rawLevel, out level) == false) {
+ MainConsole.Instance.OutputFormat("Invalid user level");
+ return;
+ }
+
+ account.UserLevel = level;
+
+ bool success = StoreUserAccount(account);
+ if (!success)
+ MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName);
+ else
+ MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level);
+ }
+
#endregion
///
--
cgit v1.1
From 5daac0584aed1a6764060b6c6a0a1f74360859f1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 25 Jun 2011 00:08:14 +0100
Subject: Fix bug in reset user password where entering an invalid name would
cause an exception. Also, convert this commands log output to console
output.
Console output is more appropriate for console commands. The log only gets one side of the conversation anyway (since it doesn't necessarily record command inputs).
---
OpenSim/Services/UserAccountService/UserAccountService.cs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Services')
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index a65c04b..8b8a8f9 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -383,16 +383,19 @@ namespace OpenSim.Services.UserAccountService
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (account == null)
- m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user");
+ {
+ MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName);
+ return;
+ }
bool success = false;
if (m_AuthenticationService != null)
success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
+
if (!success)
- m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.",
- firstName, lastName);
+ MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName);
else
- m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
+ MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName);
}
protected void HandleSetUserLevel(string module, string[] cmdparams)
--
cgit v1.1