aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Server
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Base/CommandManager.cs90
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs35
-rw-r--r--OpenSim/Server/Base/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Server/Base/ProtocolVersions.cs14
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs179
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs202
-rw-r--r--OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs3
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs14
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs4
-rw-r--r--OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs12
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs28
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs11
-rw-r--r--OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs12
-rw-r--r--OpenSim/Server/Handlers/BakedTextures/XBakes.cs4
-rw-r--r--OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs8
-rw-r--r--OpenSim/Server/Handlers/Base/ServerConnector.cs6
-rw-r--r--OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs7
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs6
-rw-r--r--OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs10
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs20
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs11
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs4
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs18
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs7
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs5
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs24
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs22
-rw-r--r--OpenSim/Server/Handlers/Land/LandHandlers.cs3
-rw-r--r--OpenSim/Server/Handlers/Land/LandServiceInConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs19
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs4
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs29
-rw-r--r--OpenSim/Server/Handlers/Map/MapGetServerConnector.cs28
-rw-r--r--OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs256
-rw-r--r--OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs63
-rw-r--r--OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs240
-rw-r--r--OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs2
-rw-r--r--OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs4
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs6
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs109
-rw-r--r--OpenSim/Server/Handlers/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs110
-rw-r--r--OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs2
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs66
-rw-r--r--OpenSim/Server/Properties/AssemblyInfo.cs8
-rw-r--r--OpenSim/Server/ServerMain.cs17
54 files changed, 1348 insertions, 412 deletions
diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs
index bd18485..b6e2903 100644
--- a/OpenSim/Server/Base/CommandManager.cs
+++ b/OpenSim/Server/Base/CommandManager.cs
@@ -41,117 +41,117 @@ namespace OpenSim.Server.Base
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Command manager - 43 /// Command manager -
44 /// Wrapper for OpenSim.Framework.PluginManager to allow 44 /// Wrapper for OpenSim.Framework.PluginManager to allow
45 /// us to add commands to the console to perform operations 45 /// us to add commands to the console to perform operations
46 /// on our repos and plugins 46 /// on our repos and plugins
47 /// </summary> 47 /// </summary>
48 public class CommandManager 48 public class CommandManager
49 { 49 {
50 public AddinRegistry PluginRegistry; 50 public AddinRegistry PluginRegistry;
51 protected PluginManager PluginManager; 51 protected PluginManager PluginManager;
52 52
53 public CommandManager(AddinRegistry registry) 53 public CommandManager(AddinRegistry registry)
54 { 54 {
55 PluginRegistry = registry; 55 PluginRegistry = registry;
56 PluginManager = new PluginManager(PluginRegistry); 56 PluginManager = new PluginManager(PluginRegistry);
57 AddManagementCommands(); 57 AddManagementCommands();
58 } 58 }
59 59
60 private void AddManagementCommands() 60 private void AddManagementCommands()
61 { 61 {
62 // add plugin 62 // add plugin
63 MainConsole.Instance.Commands.AddCommand("Plugin", true, 63 MainConsole.Instance.Commands.AddCommand("Plugin", true,
64 "plugin add", "plugin add \"plugin index\"", 64 "plugin add", "plugin add \"plugin index\"",
65 "Install plugin from repository.", 65 "Install plugin from repository.",
66 HandleConsoleInstallPlugin); 66 HandleConsoleInstallPlugin);
67 67
68 // remove plugin 68 // remove plugin
69 MainConsole.Instance.Commands.AddCommand("Plugin", true, 69 MainConsole.Instance.Commands.AddCommand("Plugin", true,
70 "plugin remove", "plugin remove \"plugin index\"", 70 "plugin remove", "plugin remove \"plugin index\"",
71 "Remove plugin from repository", 71 "Remove plugin from repository",
72 HandleConsoleUnInstallPlugin); 72 HandleConsoleUnInstallPlugin);
73 73
74 // list installed plugins 74 // list installed plugins
75 MainConsole.Instance.Commands.AddCommand("Plugin", true, 75 MainConsole.Instance.Commands.AddCommand("Plugin", true,
76 "plugin list installed", 76 "plugin list installed",
77 "plugin list installed","List install plugins", 77 "plugin list installed","List install plugins",
78 HandleConsoleListInstalledPlugin); 78 HandleConsoleListInstalledPlugin);
79 79
80 // list plugins available from registered repositories 80 // list plugins available from registered repositories
81 MainConsole.Instance.Commands.AddCommand("Plugin", true, 81 MainConsole.Instance.Commands.AddCommand("Plugin", true,
82 "plugin list available", 82 "plugin list available",
83 "plugin list available","List available plugins", 83 "plugin list available","List available plugins",
84 HandleConsoleListAvailablePlugin); 84 HandleConsoleListAvailablePlugin);
85 // List available updates 85 // List available updates
86 MainConsole.Instance.Commands.AddCommand("Plugin", true, 86 MainConsole.Instance.Commands.AddCommand("Plugin", true,
87 "plugin updates", "plugin updates","List availble updates", 87 "plugin updates", "plugin updates","List availble updates",
88 HandleConsoleListUpdates); 88 HandleConsoleListUpdates);
89 89
90 // Update plugin 90 // Update plugin
91 MainConsole.Instance.Commands.AddCommand("Plugin", true, 91 MainConsole.Instance.Commands.AddCommand("Plugin", true,
92 "plugin update", "plugin update \"plugin index\"","Update the plugin", 92 "plugin update", "plugin update \"plugin index\"","Update the plugin",
93 HandleConsoleUpdatePlugin); 93 HandleConsoleUpdatePlugin);
94 94
95 // Add repository 95 // Add repository
96 MainConsole.Instance.Commands.AddCommand("Repository", true, 96 MainConsole.Instance.Commands.AddCommand("Repository", true,
97 "repo add", "repo add \"url\"","Add repository", 97 "repo add", "repo add \"url\"","Add repository",
98 HandleConsoleAddRepo); 98 HandleConsoleAddRepo);
99 99
100 // Refresh repo 100 // Refresh repo
101 MainConsole.Instance.Commands.AddCommand("Repository", true, 101 MainConsole.Instance.Commands.AddCommand("Repository", true,
102 "repo refresh", "repo refresh \"url\"", "Sync with a registered repository", 102 "repo refresh", "repo refresh \"url\"", "Sync with a registered repository",
103 HandleConsoleGetRepo); 103 HandleConsoleGetRepo);
104 104
105 // Remove repository from registry 105 // Remove repository from registry
106 MainConsole.Instance.Commands.AddCommand("Repository", true, 106 MainConsole.Instance.Commands.AddCommand("Repository", true,
107 "repo remove", 107 "repo remove",
108 "repo remove \"[url | index]\"", 108 "repo remove \"[url | index]\"",
109 "Remove repository from registry", 109 "Remove repository from registry",
110 HandleConsoleRemoveRepo); 110 HandleConsoleRemoveRepo);
111 111
112 // Enable repo 112 // Enable repo
113 MainConsole.Instance.Commands.AddCommand("Repository", true, 113 MainConsole.Instance.Commands.AddCommand("Repository", true,
114 "repo enable", "repo enable \"[url | index]\"", 114 "repo enable", "repo enable \"[url | index]\"",
115 "Enable registered repository", 115 "Enable registered repository",
116 HandleConsoleEnableRepo); 116 HandleConsoleEnableRepo);
117 117
118 // Disable repo 118 // Disable repo
119 MainConsole.Instance.Commands.AddCommand("Repository", true, 119 MainConsole.Instance.Commands.AddCommand("Repository", true,
120 "repo disable", "repo disable\"[url | index]\"", 120 "repo disable", "repo disable\"[url | index]\"",
121 "Disable registered repository", 121 "Disable registered repository",
122 HandleConsoleDisableRepo); 122 HandleConsoleDisableRepo);
123 123
124 // List registered repositories 124 // List registered repositories
125 MainConsole.Instance.Commands.AddCommand("Repository", true, 125 MainConsole.Instance.Commands.AddCommand("Repository", true,
126 "repo list", "repo list", 126 "repo list", "repo list",
127 "List registered repositories", 127 "List registered repositories",
128 HandleConsoleListRepos); 128 HandleConsoleListRepos);
129 129
130 // * 130 // *
131 MainConsole.Instance.Commands.AddCommand("Plugin", true, 131 MainConsole.Instance.Commands.AddCommand("Plugin", true,
132 "plugin info", "plugin info \"plugin index\"","Show detailed information for plugin", 132 "plugin info", "plugin info \"plugin index\"","Show detailed information for plugin",
133 HandleConsoleShowAddinInfo); 133 HandleConsoleShowAddinInfo);
134 134
135 // Plugin disable 135 // Plugin disable
136 MainConsole.Instance.Commands.AddCommand("Plugin", true, 136 MainConsole.Instance.Commands.AddCommand("Plugin", true,
137 "plugin disable", "plugin disable \"plugin index\"", 137 "plugin disable", "plugin disable \"plugin index\"",
138 "Disable a plugin", 138 "Disable a plugin",
139 HandleConsoleDisablePlugin); 139 HandleConsoleDisablePlugin);
140 140
141 // Enable plugin 141 // Enable plugin
142 MainConsole.Instance.Commands.AddCommand("Plugin", true, 142 MainConsole.Instance.Commands.AddCommand("Plugin", true,
143 "plugin enable", "plugin enable \"plugin index\"", 143 "plugin enable", "plugin enable \"plugin index\"",
144 "Enable the selected plugin plugin", 144 "Enable the selected plugin plugin",
145 HandleConsoleEnablePlugin); 145 HandleConsoleEnablePlugin);
146 } 146 }
147 147
148 #region console handlers 148 #region console handlers
149 // Handle our console commands 149 // Handle our console commands
150 // 150 //
151 // Install plugin from registered repository 151 // Install plugin from registered repository
152 /// <summary> 152 /// <summary>
153 /// Handles the console install plugin command. Attempts to install the selected plugin 153 /// Handles the console install plugin command. Attempts to install the selected plugin
154 /// and 154 /// and
155 /// </summary> 155 /// </summary>
156 /// <param name='module'> 156 /// <param name='module'>
157 /// Module. 157 /// Module.
@@ -323,7 +323,7 @@ namespace OpenSim.Server.Base
323 { 323 {
324 if (cmd.Length >= 3) 324 if (cmd.Length >= 3)
325 { 325 {
326 326
327 Dictionary<string, object> result = new Dictionary<string, object>(); 327 Dictionary<string, object> result = new Dictionary<string, object>();
328 328
329 int ndx = Convert.ToInt16(cmd[2]); 329 int ndx = Convert.ToInt16(cmd[2]);
@@ -355,5 +355,5 @@ namespace OpenSim.Server.Base
355 return; 355 return;
356 } 356 }
357 #endregion 357 #endregion
358 } 358 }
359} \ No newline at end of file 359} \ No newline at end of file
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index 44ef124..3357250 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
40{ 40{
41 public class HttpServerBase : ServicesServerBase 41 public class HttpServerBase : ServicesServerBase
42 { 42 {
43// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private uint m_consolePort; 45 private uint m_consolePort;
46 46
@@ -70,6 +70,7 @@ namespace OpenSim.Server.Base
70 70
71 bool ssl_main = networkConfig.GetBoolean("https_main",false); 71 bool ssl_main = networkConfig.GetBoolean("https_main",false);
72 bool ssl_listener = networkConfig.GetBoolean("https_listener",false); 72 bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
73 bool ssl_external = networkConfig.GetBoolean("https_external",false);
73 74
74 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); 75 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
75 76
@@ -111,25 +112,33 @@ namespace OpenSim.Server.Base
111 MainServer.Instance = httpServer; 112 MainServer.Instance = httpServer;
112 113
113 // If https_listener = true, then add an ssl listener on the https_port... 114 // If https_listener = true, then add an ssl listener on the https_port...
114 if (ssl_listener == true) 115 if (ssl_listener == true)
115 { 116 {
116 uint https_port = (uint)networkConfig.GetInt("https_port", 0); 117 uint https_port = (uint)networkConfig.GetInt("https_port", 0);
117 118
118 string cert_path = networkConfig.GetString("cert_path",String.Empty); 119 m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
119 if (cert_path == String.Empty) 120 if (!ssl_external)
120 { 121 {
121 System.Console.WriteLine("ERROR: Path to X509 certificate is missing, server can't start."); 122 string cert_path = networkConfig.GetString("cert_path",String.Empty);
122 Environment.Exit(1); 123 if ( cert_path == String.Empty )
124 {
125 System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
126 Thread.CurrentThread.Abort();
127 }
128 string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
129 if ( cert_pass == String.Empty )
130 {
131 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
132 Thread.CurrentThread.Abort();
133 }
134
135 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
123 } 136 }
124 137 else
125 string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
126 if (cert_pass == String.Empty)
127 { 138 {
128 System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start."); 139 m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
129 Environment.Exit(1); 140 MainServer.AddHttpServer(new BaseHttpServer(https_port));
130 } 141 }
131
132 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
133 } 142 }
134 } 143 }
135 144
diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs
index 3c634a7..4be0f25 100644
--- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Server.Base")] 8[assembly: AssemblyTitle("OpenSim.Server.Base")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
@@ -25,9 +25,9 @@ using System.Runtime.InteropServices;
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.3.*")] 32[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
33 33
diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs
index 5c2278c..27eed4c 100644
--- a/OpenSim/Server/Base/ProtocolVersions.cs
+++ b/OpenSim/Server/Base/ProtocolVersions.cs
@@ -31,20 +31,20 @@ namespace OpenSim.Server.Base
31 { 31 {
32 /// <value> 32 /// <value>
33 /// This is the external protocol versions. It is separate from the OpenSimulator project version. 33 /// This is the external protocol versions. It is separate from the OpenSimulator project version.
34 /// 34 ///
35 /// These version numbers should be increased by 1 every time a code 35 /// These version numbers should be increased by 1 every time a code
36 /// change in the Service.Connectors and Server.Handlers, espectively, 36 /// change in the Service.Connectors and Server.Handlers, espectively,
37 /// makes the previous OpenSimulator revision incompatible 37 /// makes the previous OpenSimulator revision incompatible
38 /// with the new revision. 38 /// with the new revision.
39 /// 39 ///
40 /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality 40 /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality
41 /// but not outright failure) do not need a version number increment. 41 /// but not outright failure) do not need a version number increment.
42 /// 42 ///
43 /// Having this version number allows the grid service to reject connections from regions running a version 43 /// Having this version number allows the grid service to reject connections from regions running a version
44 /// of the code that is too old. 44 /// of the code that is too old.
45 /// 45 ///
46 /// </value> 46 /// </value>
47 47
48 // The range of acceptable servers for client-side connectors 48 // The range of acceptable servers for client-side connectors
49 public readonly static int ClientProtocolVersionMin = 1; 49 public readonly static int ClientProtocolVersionMin = 1;
50 public readonly static int ClientProtocolVersionMax = 1; 50 public readonly static int ClientProtocolVersionMax = 1;
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 18a4266..cc506bc 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -39,7 +39,7 @@ using OpenMetaverse;
39using Mono.Addins; 39using Mono.Addins;
40using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
42 42using OpenMetaverse.StructuredData; // LitJson is hidden on this
43 43
44[assembly:AddinRoot("Robust", OpenSim.VersionInfo.VersionNumber)] 44[assembly:AddinRoot("Robust", OpenSim.VersionInfo.VersionNumber)]
45namespace OpenSim.Server.Base 45namespace OpenSim.Server.Base
@@ -104,7 +104,7 @@ namespace OpenSim.Server.Base
104 // libomv, which has a hard-coded path to "." for pinvoke 104 // libomv, which has a hard-coded path to "." for pinvoke
105 // to load the openjpeg dll 105 // to load the openjpeg dll
106 // 106 //
107 // Will look for a way to fix, but for now this keeps the 107 // Will look for a way to fix, but for now this keeps the
108 // confusion to a minimum. this was copied from our region 108 // confusion to a minimum. this was copied from our region
109 // plugin loader, we have been doing this in there for a long time. 109 // plugin loader, we have been doing this in there for a long time.
110 // 110 //
@@ -183,7 +183,7 @@ namespace OpenSim.Server.Base
183 183
184 if(port != 0) 184 if(port != 0)
185 server = MainServer.GetHttpServer(port); 185 server = MainServer.GetHttpServer(port);
186 else 186 else
187 server = MainServer.Instance; 187 server = MainServer.Instance;
188 188
189 return server; 189 return server;
@@ -222,19 +222,19 @@ namespace OpenSim.Server.Base
222 // This is good to debug configuration problems 222 // This is good to debug configuration problems
223 //if (dllName == string.Empty) 223 //if (dllName == string.Empty)
224 // Util.PrintCallStack(); 224 // Util.PrintCallStack();
225 225
226 string className = String.Empty; 226 string className = String.Empty;
227 227
228 // The path for a dynamic plugin will contain ":" on Windows 228 // The path for a dynamic plugin will contain ":" on Windows
229 string[] parts = dllName.Split (new char[] {':'}); 229 string[] parts = dllName.Split (new char[] {':'});
230 230
231 if (parts [0].Length > 1) 231 if (parts [0].Length > 1)
232 { 232 {
233 dllName = parts [0]; 233 dllName = parts [0];
234 if (parts.Length > 1) 234 if (parts.Length > 1)
235 className = parts[1]; 235 className = parts[1];
236 } 236 }
237 else 237 else
238 { 238 {
239 // This is Windows - we must replace the ":" in the path 239 // This is Windows - we must replace the ":" in the path
240 dllName = String.Format ("{0}:{1}", parts [0], parts [1]); 240 dllName = String.Format ("{0}:{1}", parts [0], parts [1]);
@@ -242,6 +242,18 @@ namespace OpenSim.Server.Base
242 className = parts[2]; 242 className = parts[2];
243 } 243 }
244 244
245 // Handle extra string arguments in a more generic way
246 if (dllName.Contains("@"))
247 {
248 string[] dllNameParts = dllName.Split(new char[] {'@'});
249 dllName = dllNameParts[dllNameParts.Length - 1];
250 List<Object> argList = new List<Object>(args);
251 for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i)
252 argList.Add(dllNameParts[i]);
253
254 args = argList.ToArray();
255 }
256
245 return LoadPlugin<T>(dllName, className, args); 257 return LoadPlugin<T>(dllName, className, args);
246 } 258 }
247 259
@@ -264,10 +276,10 @@ namespace OpenSim.Server.Base
264 { 276 {
265 if (pluginType.IsPublic) 277 if (pluginType.IsPublic)
266 { 278 {
267 if (className != String.Empty 279 if (className != String.Empty
268 && pluginType.ToString() != pluginType.Namespace + "." + className) 280 && pluginType.ToString() != pluginType.Namespace + "." + className)
269 continue; 281 continue;
270 282
271 Type typeInterface = pluginType.GetInterface(interfaceName); 283 Type typeInterface = pluginType.GetInterface(interfaceName);
272 284
273 if (typeInterface != null) 285 if (typeInterface != null)
@@ -283,8 +295,8 @@ namespace OpenSim.Server.Base
283 if (!(e is System.MissingMethodException)) 295 if (!(e is System.MissingMethodException))
284 { 296 {
285 m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}", 297 m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}",
286 interfaceName, 298 interfaceName,
287 dllName, 299 dllName,
288 e.InnerException == null ? e.Message : e.InnerException.Message), 300 e.InnerException == null ? e.Message : e.InnerException.Message),
289 e); 301 e);
290 } 302 }
@@ -315,49 +327,62 @@ namespace OpenSim.Server.Base
315 327
316 public static Dictionary<string, object> ParseQueryString(string query) 328 public static Dictionary<string, object> ParseQueryString(string query)
317 { 329 {
318 Dictionary<string, object> result = new Dictionary<string, object>();
319 string[] terms = query.Split(new char[] {'&'}); 330 string[] terms = query.Split(new char[] {'&'});
320 331
321 if (terms.Length == 0) 332 int nterms = terms.Length;
322 return result; 333 if (nterms == 0)
334 return new Dictionary<string, object>();
323 335
324 foreach (string t in terms) 336 Dictionary<string, object> result = new Dictionary<string, object>(nterms);
337 string name;
338
339 for(int i = 0; i < nterms; ++i)
325 { 340 {
326 string[] elems = t.Split(new char[] {'='}); 341 string[] elems = terms[i].Split(new char[] {'='});
342
327 if (elems.Length == 0) 343 if (elems.Length == 0)
328 continue; 344 continue;
329 345
330 string name = System.Web.HttpUtility.UrlDecode(elems[0]); 346 if(String.IsNullOrWhiteSpace(elems[0]))
331 string value = String.Empty; 347 continue;
332 348
333 if (elems.Length > 1) 349 name = System.Web.HttpUtility.UrlDecode(elems[0]);
334 value = System.Web.HttpUtility.UrlDecode(elems[1]);
335 350
336 if (name.EndsWith("[]")) 351 if (name.EndsWith("[]"))
337 { 352 {
338 string cleanName = name.Substring(0, name.Length - 2); 353 name = name.Substring(0, name.Length - 2);
339 if (result.ContainsKey(cleanName)) 354 if(String.IsNullOrWhiteSpace(name))
355 continue;
356 if (result.ContainsKey(name))
340 { 357 {
341 if (!(result[cleanName] is List<string>)) 358 if (!(result[name] is List<string>))
342 continue; 359 continue;
343 360
344 List<string> l = (List<string>)result[cleanName]; 361 List<string> l = (List<string>)result[name];
345 362 if (elems.Length > 1 && !String.IsNullOrWhiteSpace(elems[1]))
346 l.Add(value); 363 l.Add(System.Web.HttpUtility.UrlDecode(elems[1]));
364 else
365 l.Add(String.Empty);
347 } 366 }
348 else 367 else
349 { 368 {
350 List<string> newList = new List<string>(); 369 List<string> newList = new List<string>();
351 370 if (elems.Length > 1 && !String.IsNullOrWhiteSpace(elems[1]))
352 newList.Add(value); 371 newList.Add(System.Web.HttpUtility.UrlDecode(elems[1]));
353 372 else
354 result[cleanName] = newList; 373 newList.Add(String.Empty);
374 result[name] = newList;
355 } 375 }
356 } 376 }
357 else 377 else
358 { 378 {
359 if (!result.ContainsKey(name)) 379 if (!result.ContainsKey(name))
360 result[name] = value; 380 {
381 if (elems.Length > 1 && !String.IsNullOrWhiteSpace(elems[1]))
382 result[name] = System.Web.HttpUtility.UrlDecode(elems[1]);
383 else
384 result[name] = String.Empty;
385 }
361 } 386 }
362 } 387 }
363 388
@@ -366,47 +391,70 @@ namespace OpenSim.Server.Base
366 391
367 public static string BuildQueryString(Dictionary<string, object> data) 392 public static string BuildQueryString(Dictionary<string, object> data)
368 { 393 {
369 string qstring = String.Empty; 394 // this is not conform to html url encoding
395 // can only be used on Body of POST or PUT
396 StringBuilder sb = new StringBuilder(4096);
370 397
371 string part; 398 string pvalue;
372 399
373 foreach (KeyValuePair<string, object> kvp in data) 400 foreach (KeyValuePair<string, object> kvp in data)
374 { 401 {
375 if (kvp.Value is List<string>) 402 if (kvp.Value is List<string>)
376 { 403 {
377 List<string> l = (List<String>)kvp.Value; 404 List<string> l = (List<String>)kvp.Value;
378 405 int llen = l.Count;
379 foreach (string s in l) 406 string nkey = System.Web.HttpUtility.UrlEncode(kvp.Key);
407 for(int i = 0; i < llen; ++i)
380 { 408 {
381 part = System.Web.HttpUtility.UrlEncode(kvp.Key) + 409 if (sb.Length != 0)
382 "[]=" + System.Web.HttpUtility.UrlEncode(s); 410 sb.Append("&");
383 411 sb.Append(nkey);
384 if (qstring != String.Empty) 412 sb.Append("[]=");
385 qstring += "&"; 413 sb.Append(System.Web.HttpUtility.UrlEncode(l[i]));
386
387 qstring += part;
388 } 414 }
389 } 415 }
390 else 416 else if(kvp.Value is Dictionary<string, object>)
391 { 417 {
392 if (kvp.Value.ToString() != String.Empty) 418 // encode complex structures as JSON
419 // needed for estate bans with the encoding used on xml
420 // encode can be here because object does contain the structure information
421 // but decode needs to be on estateSettings (or other user)
422 string js;
423 try
393 { 424 {
394 part = System.Web.HttpUtility.UrlEncode(kvp.Key) + 425 // bypass libovm, we dont need even more useless high level maps
395 "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); 426 // this should only be called once.. but no problem, i hope
427 // (other uses may need more..)
428 LitJson.JsonMapper.RegisterExporter<UUID>((uuid, writer) => writer.Write(uuid.ToString()) );
429 js = LitJson.JsonMapper.ToJson(kvp.Value);
396 } 430 }
397 else 431 // catch(Exception e)
432 catch
398 { 433 {
399 part = System.Web.HttpUtility.UrlEncode(kvp.Key); 434 continue;
435 }
436 if (sb.Length != 0)
437 sb.Append("&");
438 sb.Append(System.Web.HttpUtility.UrlEncode(kvp.Key));
439 sb.Append("=");
440 sb.Append(System.Web.HttpUtility.UrlEncode(js));
441 }
442 else
443 {
444 if (sb.Length != 0)
445 sb.Append("&");
446 sb.Append(System.Web.HttpUtility.UrlEncode(kvp.Key));
447
448 pvalue = kvp.Value.ToString();
449 if (!String.IsNullOrEmpty(pvalue))
450 {
451 sb.Append("=");
452 sb.Append(System.Web.HttpUtility.UrlEncode(pvalue));
400 } 453 }
401
402 if (qstring != String.Empty)
403 qstring += "&";
404
405 qstring += part;
406 } 454 }
407 } 455 }
408 456
409 return qstring; 457 return sb.ToString();
410 } 458 }
411 459
412 public static string BuildXmlResponse(Dictionary<string, object> data) 460 public static string BuildXmlResponse(Dictionary<string, object> data)
@@ -465,18 +513,23 @@ namespace OpenSim.Server.Base
465 Dictionary<string, object> ret = new Dictionary<string, object>(); 513 Dictionary<string, object> ret = new Dictionary<string, object>();
466 514
467 XmlDocument doc = new XmlDocument(); 515 XmlDocument doc = new XmlDocument();
516 doc.XmlResolver = null;
517 try
518 {
519 doc.LoadXml(data);
520 XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
468 521
469 doc.LoadXml(data); 522 if (rootL.Count != 1)
470 523 return ret;
471 XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
472
473 if (rootL.Count != 1)
474 return ret;
475
476 XmlNode rootNode = rootL[0];
477 524
478 ret = ParseElement(rootNode); 525 XmlNode rootNode = rootL[0];
479 526
527 ret = ParseElement(rootNode);
528 }
529 catch (Exception e)
530 {
531 m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0} \n --- string: {1} - ",e.Message, data);
532 }
480 return ret; 533 return ret;
481 } 534 }
482 535
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 076868d..176e876 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -55,16 +55,16 @@ namespace OpenSim.Server.Base
55 // 55 //
56 protected string[] m_Arguments; 56 protected string[] m_Arguments;
57 57
58 public string ConfigDirectory 58 protected string m_configDirectory = ".";
59 {
60 get;
61 private set;
62 }
63 59
64 // Run flag 60 // Run flag
65 // 61 //
66 private bool m_Running = true; 62 private bool m_Running = true;
67 63
64#if (_MONO)
65 private static Mono.Unix.UnixSignal[] signals;
66#endif
67
68 // Handle all the automagical stuff 68 // Handle all the automagical stuff
69 // 69 //
70 public ServicesServerBase(string prompt, string[] args) : base() 70 public ServicesServerBase(string prompt, string[] args) : base()
@@ -85,7 +85,7 @@ namespace OpenSim.Server.Base
85 string fileName = ""; 85 string fileName = "";
86 if (Assembly.GetEntryAssembly() != null) 86 if (Assembly.GetEntryAssembly() != null)
87 fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); 87 fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
88 string iniFile = "../config/" + fileName + ".ini"; 88 string iniFile = fileName + ".ini";
89 string logConfig = null; 89 string logConfig = null;
90 90
91 IConfig startupConfig = argvConfig.Configs["Startup"]; 91 IConfig startupConfig = argvConfig.Configs["Startup"];
@@ -96,39 +96,31 @@ namespace OpenSim.Server.Base
96 96
97 // Check if a prompt was given on the command line 97 // Check if a prompt was given on the command line
98 prompt = startupConfig.GetString("prompt", prompt); 98 prompt = startupConfig.GetString("prompt", prompt);
99 99
100 // Check for a Log4Net config file on the command line 100 // Check for a Log4Net config file on the command line
101 logConfig =startupConfig.GetString("logconfig", logConfig); 101 logConfig =startupConfig.GetString("logconfig", logConfig);
102 } 102 }
103 103
104 // Find out of the file name is a URI and remote load it if possible. 104 Config = ReadConfigSource(iniFile);
105 // Load it as a local file otherwise.
106 Uri configUri;
107 105
108 try 106 List<string> sources = new List<string>();
107 sources.Add(iniFile);
108
109 int sourceIndex = 1;
110
111 while (AddIncludes(Config, sources))
109 { 112 {
110 if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) && 113 for ( ; sourceIndex < sources.Count ; ++sourceIndex)
111 configUri.Scheme == Uri.UriSchemeHttp)
112 { 114 {
113 XmlReader r = XmlReader.Create(iniFile); 115 IConfigSource s = ReadConfigSource(sources[sourceIndex]);
114 Config = new XmlConfigSource(r); 116 Config.Merge(s);
115 } 117 }
116 else
117 {
118 Config = new IniConfigSource(iniFile);
119 }
120 }
121 catch (Exception e)
122 {
123 System.Console.WriteLine("Error reading from config source. {0}", e.Message);
124 System.Diagnostics.Process.GetCurrentProcess().Kill();
125///// Environment.Exit(1);
126 } 118 }
127 119
128 // Merge OpSys env vars 120 // Merge OpSys env vars
129 m_log.Info("[CONFIG]: Loading environment variables for Config"); 121 Console.WriteLine("[CONFIG]: Loading environment variables for Config");
130 Util.MergeEnvironmentToConfig(Config); 122 Util.MergeEnvironmentToConfig(Config);
131 123
132 // Merge the configuration from the command line into the loaded file 124 // Merge the configuration from the command line into the loaded file
133 Config.Merge(argvConfig); 125 Config.Merge(argvConfig);
134 126
@@ -140,10 +132,12 @@ namespace OpenSim.Server.Base
140 startupConfig = Config.Configs["Startup"]; 132 startupConfig = Config.Configs["Startup"];
141 } 133 }
142 134
143 ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); 135 if (startupConfig != null)
144 136 {
145 prompt = startupConfig.GetString("Prompt", prompt); 137 m_configDirectory = startupConfig.GetString("ConfigDirectory", m_configDirectory);
146 138
139 prompt = startupConfig.GetString("Prompt", prompt);
140 }
147 // Allow derived classes to load config before the console is opened. 141 // Allow derived classes to load config before the console is opened.
148 ReadConfig(); 142 ReadConfig();
149 143
@@ -193,6 +187,42 @@ namespace OpenSim.Server.Base
193 RegisterCommonCommands(); 187 RegisterCommonCommands();
194 RegisterCommonComponents(Config); 188 RegisterCommonComponents(Config);
195 189
190#if (_MONO)
191 Thread signal_thread = new Thread (delegate ()
192 {
193 while (true)
194 {
195 // Wait for a signal to be delivered
196 int index = Mono.Unix.UnixSignal.WaitAny (signals, -1);
197
198 //Mono.Unix.Native.Signum signal = signals [index].Signum;
199 ShutdownSpecific();
200 m_Running = false;
201 Environment.Exit(0);
202 }
203 });
204
205 if(!Util.IsWindows())
206 {
207 try
208 {
209 // linux mac os specifics
210 signals = new Mono.Unix.UnixSignal[]
211 {
212 new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM)
213 };
214 ignal_thread.IsBackground = true;
215 signal_thread.Start();
216 }
217 catch (Exception e)
218 {
219 m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not");
220 m_log.InfoFormat("shut down gracefully: {0}", e.Message);
221 m_log.Debug("Exception was: ", e);
222 }
223 }
224#endif
225
196 // Allow derived classes to perform initialization that 226 // Allow derived classes to perform initialization that
197 // needs to be done after the console has opened 227 // needs to be done after the console has opened
198 Initialise(); 228 Initialise();
@@ -220,6 +250,9 @@ namespace OpenSim.Server.Base
220 } 250 }
221 } 251 }
222 252
253 MemoryWatchdog.Enabled = false;
254 Watchdog.Enabled = false;
255 WorkManager.Stop();
223 RemovePIDFile(); 256 RemovePIDFile();
224 257
225 return 0; 258 return 0;
@@ -240,5 +273,114 @@ namespace OpenSim.Server.Base
240 protected virtual void Initialise() 273 protected virtual void Initialise()
241 { 274 {
242 } 275 }
276
277 /// <summary>
278 /// Adds the included files as ini configuration files
279 /// </summary>
280 /// <param name="sources">List of URL strings or filename strings</param>
281 private bool AddIncludes(IConfigSource configSource, List<string> sources)
282 {
283 bool sourcesAdded = false;
284
285 //loop over config sources
286 foreach (IConfig config in configSource.Configs)
287 {
288 // Look for Include-* in the key name
289 string[] keys = config.GetKeys();
290 foreach (string k in keys)
291 {
292 if (k.StartsWith("Include-"))
293 {
294 // read the config file to be included.
295 string file = config.GetString(k);
296 if (IsUri(file))
297 {
298 if (!sources.Contains(file))
299 {
300 sourcesAdded = true;
301 sources.Add(file);
302 }
303 }
304 else
305 {
306 string basepath = Path.GetFullPath(m_configDirectory);
307 // Resolve relative paths with wildcards
308 string chunkWithoutWildcards = file;
309 string chunkWithWildcards = string.Empty;
310 int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' });
311 if (wildcardIndex != -1)
312 {
313 chunkWithoutWildcards = file.Substring(0, wildcardIndex);
314 chunkWithWildcards = file.Substring(wildcardIndex);
315 }
316 string path = Path.Combine(basepath, chunkWithoutWildcards);
317 path = Path.GetFullPath(path) + chunkWithWildcards;
318 string[] paths = Util.Glob(path);
319
320 // If the include path contains no wildcards, then warn the user that it wasn't found.
321 if (wildcardIndex == -1 && paths.Length == 0)
322 {
323 Console.WriteLine("[CONFIG]: Could not find include file {0}", path);
324 }
325 else
326 {
327 foreach (string p in paths)
328 {
329 if (!sources.Contains(p))
330 {
331 sourcesAdded = true;
332 sources.Add(p);
333 }
334 }
335 }
336 }
337 }
338 }
339 }
340
341 return sourcesAdded;
342 }
343
344 /// <summary>
345 /// Check if we can convert the string to a URI
346 /// </summary>
347 /// <param name="file">String uri to the remote resource</param>
348 /// <returns>true if we can convert the string to a Uri object</returns>
349 bool IsUri(string file)
350 {
351 Uri configUri;
352
353 return Uri.TryCreate(file, UriKind.Absolute,
354 out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
355 }
356
357 IConfigSource ReadConfigSource(string iniFile)
358 {
359 // Find out of the file name is a URI and remote load it if possible.
360 // Load it as a local file otherwise.
361 Uri configUri;
362 IConfigSource s = null;
363
364 try
365 {
366 if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) &&
367 configUri.Scheme == Uri.UriSchemeHttp)
368 {
369 XmlReader r = XmlReader.Create(iniFile);
370 s = new XmlConfigSource(r);
371 }
372 else
373 {
374 s = new IniConfigSource(iniFile);
375 }
376 }
377 catch (Exception e)
378 {
379 System.Console.WriteLine("Error reading from config source. {0}", e.Message);
380 Environment.Exit(1);
381 }
382
383 return s;
384 }
243 } 385 }
244} 386}
diff --git a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs
index 713b755..b1b3c6f 100644
--- a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs
@@ -106,7 +106,8 @@ namespace OpenSim.Server.Handlers.AgentPreferences
106 return FailureResult(); 106 return FailureResult();
107 AgentPrefs prefs = m_AgentPreferencesService.GetAgentPreferences(userID); 107 AgentPrefs prefs = m_AgentPreferencesService.GetAgentPreferences(userID);
108 Dictionary<string, object> result = new Dictionary<string, object>(); 108 Dictionary<string, object> result = new Dictionary<string, object>();
109 result = prefs.ToKeyValuePairs(); 109 if (prefs != null)
110 result = prefs.ToKeyValuePairs();
110 111
111 string xmlString = ServerUtils.BuildXmlResponse(result); 112 string xmlString = ServerUtils.BuildXmlResponse(result);
112 113
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index ab81dd6..bad3ea2 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -151,27 +151,27 @@ namespace OpenSim.Server.Handlers.Asset
151 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId); 151 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId);
152 return; 152 return;
153 } 153 }
154 154
155 AssetBase asset = m_AssetService.Get(assetId.ToString()); 155 AssetBase asset = m_AssetService.Get(assetId.ToString());
156 if (asset == null) 156 if (asset == null)
157 { 157 {
158 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId); 158 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId);
159 return; 159 return;
160 } 160 }
161 161
162 string fileName = rawAssetId; 162 string fileName = rawAssetId;
163 163
164 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName)) 164 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName))
165 return; 165 return;
166 166
167 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) 167 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
168 { 168 {
169 using (BinaryWriter bw = new BinaryWriter(fs)) 169 using (BinaryWriter bw = new BinaryWriter(fs))
170 { 170 {
171 bw.Write(asset.Data); 171 bw.Write(asset.Data);
172 } 172 }
173 } 173 }
174 174
175 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName); 175 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName);
176 } 176 }
177 177
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
index 91c5c54..8bfc690 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Server.Handlers.Asset
53 public AssetServerGetHandler(IAssetService service) : 53 public AssetServerGetHandler(IAssetService service) :
54 base("GET", "/assets") 54 base("GET", "/assets")
55 { 55 {
56 m_AssetService = service; 56 m_AssetService = service;
57 } 57 }
58 58
59 public AssetServerGetHandler(IAssetService service, IServiceAuth auth, string redirectURL) : 59 public AssetServerGetHandler(IAssetService service, IServiceAuth auth, string redirectURL) :
@@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset
155 httpResponse.ContentType = "text/plain"; 155 httpResponse.ContentType = "text/plain";
156 result = new byte[0]; 156 result = new byte[0];
157 } 157 }
158 158
159 if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id)) 159 if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id))
160 { 160 {
161 httpResponse.StatusCode = (int)HttpStatusCode.Redirect; 161 httpResponse.StatusCode = (int)HttpStatusCode.Redirect;
diff --git a/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs b/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs
index faa6fb7..4d2228a 100644
--- a/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs
+++ b/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs
@@ -52,8 +52,8 @@ namespace OpenSim.Server.Handlers.Asset.Test
52 52
53 UUID assetId = TestHelpers.ParseTail(0x1); 53 UUID assetId = TestHelpers.ParseTail(0x1);
54 54
55 IConfigSource config = new IniConfigSource(); 55 IConfigSource config = new IniConfigSource();
56 config.AddConfig("AssetService"); 56 config.AddConfig("AssetService");
57 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 57 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
58 58
59 AssetService assetService = new AssetService(config); 59 AssetService assetService = new AssetService(config);
@@ -72,7 +72,7 @@ namespace OpenSim.Server.Handlers.Asset.Test
72 XmlSerializer serializer = new XmlSerializer(typeof(AssetBase)); 72 XmlSerializer serializer = new XmlSerializer(typeof(AssetBase));
73 serializer.Serialize(writer, asset); 73 serializer.Serialize(writer, asset);
74 writer.Flush(); 74 writer.Flush();
75 } 75 }
76 76
77 buffer.Position = 0; 77 buffer.Position = 0;
78 asph.Handle(null, buffer, null, null); 78 asph.Handle(null, buffer, null, null);
@@ -87,13 +87,13 @@ namespace OpenSim.Server.Handlers.Asset.Test
87 { 87 {
88 TestHelpers.InMethod(); 88 TestHelpers.InMethod();
89 89
90 IConfigSource config = new IniConfigSource(); 90 IConfigSource config = new IniConfigSource();
91 config.AddConfig("AssetService"); 91 config.AddConfig("AssetService");
92 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 92 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
93 93
94 AssetService assetService = new AssetService(config); 94 AssetService assetService = new AssetService(config);
95 95
96 AssetServerPostHandler asph = new AssetServerPostHandler(assetService); 96 AssetServerPostHandler asph = new AssetServerPostHandler(assetService);
97 97
98 MemoryStream buffer = new MemoryStream(); 98 MemoryStream buffer = new MemoryStream();
99 byte[] badData = new byte[] { 0x48, 0x65, 0x6c, 0x6c, 0x6f }; 99 byte[] badData = new byte[] { 0x48, 0x65, 0x6c, 0x6c, 0x6f };
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 6ee98b3..4f03cf4 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -82,11 +82,11 @@ namespace OpenSim.Server.Handlers.Authentication
82 switch (p[0]) 82 switch (p[0])
83 { 83 {
84 case "plain": 84 case "plain":
85 StreamReader sr = new StreamReader(request); 85 string body;
86 string body = sr.ReadToEnd(); 86 using(StreamReader sr = new StreamReader(request))
87 sr.Close(); 87 body = sr.ReadToEnd();
88
89 return DoPlainMethods(body); 88 return DoPlainMethods(body);
89
90 case "crypt": 90 case "crypt":
91 byte[] buffer = new byte[request.Length]; 91 byte[] buffer = new byte[request.Length];
92 long length = request.Length; 92 long length = request.Length;
@@ -132,41 +132,41 @@ namespace OpenSim.Server.Handlers.Authentication
132 case "authenticate": 132 case "authenticate":
133 if (!request.ContainsKey("PASSWORD")) 133 if (!request.ContainsKey("PASSWORD"))
134 return FailureResult(); 134 return FailureResult();
135 135
136 token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime); 136 token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime);
137 137
138 if (token != String.Empty) 138 if (token != String.Empty)
139 return SuccessResult(token); 139 return SuccessResult(token);
140 return FailureResult(); 140 return FailureResult();
141 141
142 case "setpassword": 142 case "setpassword":
143 if (!m_AllowSetPassword) 143 if (!m_AllowSetPassword)
144 return FailureResult(); 144 return FailureResult();
145 145
146 if (!request.ContainsKey("PASSWORD")) 146 if (!request.ContainsKey("PASSWORD"))
147 return FailureResult(); 147 return FailureResult();
148 148
149 if (m_AuthenticationService.SetPassword(principalID, request["PASSWORD"].ToString())) 149 if (m_AuthenticationService.SetPassword(principalID, request["PASSWORD"].ToString()))
150 return SuccessResult(); 150 return SuccessResult();
151 else 151 else
152 return FailureResult(); 152 return FailureResult();
153 153
154 case "verify": 154 case "verify":
155 if (!request.ContainsKey("TOKEN")) 155 if (!request.ContainsKey("TOKEN"))
156 return FailureResult(); 156 return FailureResult();
157 157
158 if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime)) 158 if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime))
159 return SuccessResult(); 159 return SuccessResult();
160 160
161 return FailureResult(); 161 return FailureResult();
162 162
163 case "release": 163 case "release":
164 if (!request.ContainsKey("TOKEN")) 164 if (!request.ContainsKey("TOKEN"))
165 return FailureResult(); 165 return FailureResult();
166 166
167 if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString())) 167 if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString()))
168 return SuccessResult(); 168 return SuccessResult();
169 169
170 return FailureResult(); 170 return FailureResult();
171 171
172 case "getauthinfo": 172 case "getauthinfo":
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs
index 6464399..ac8ff52 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Server.Handlers.Authentication
41 private static readonly ILog m_log = 41 private static readonly ILog m_log =
42 LogManager.GetLogger( 42 LogManager.GetLogger(
43 MethodBase.GetCurrentMethod().DeclaringType); 43 MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private IAuthenticationService m_AuthenticationService; 45 private IAuthenticationService m_AuthenticationService;
46 private IUserAccountService m_UserAccountService; 46 private IUserAccountService m_UserAccountService;
47 private string m_ConfigName = "OpenIdService"; 47 private string m_ConfigName = "OpenIdService";
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index b201dc7..254b82f 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -178,14 +178,14 @@ namespace OpenSim.Server.Handlers.Authentication
178"; 178";
179 179
180 /// <summary>Page shown for an invalid OpenID identity</summary> 180 /// <summary>Page shown for an invalid OpenID identity</summary>
181 const string INVALID_OPENID_PAGE = 181 const string INVALID_OPENID_PAGE =
182@"<html><head><title>Identity not found</title></head> 182@"<html><head><title>Identity not found</title></head>
183<body>Invalid OpenID identity</body></html>"; 183<body>Invalid OpenID identity</body></html>";
184 184
185 /// <summary>Page shown if the OpenID endpoint is requested directly</summary> 185 /// <summary>Page shown if the OpenID endpoint is requested directly</summary>
186 const string ENDPOINT_PAGE = 186 const string ENDPOINT_PAGE =
187@"<html><head><title>OpenID Endpoint</title></head><body> 187@"<html><head><title>OpenID Endpoint</title></head><body>
188This is an OpenID server endpoint, not a human-readable resource. 188This is an OpenID server endpoint, not a human-readable resource.
189For more information, see <a href='http://openid.net/'>http://openid.net/</a>. 189For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
190</body></html>"; 190</body></html>";
191 191
@@ -222,7 +222,10 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
222 222
223 try 223 try
224 { 224 {
225 NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); 225 string forPost;
226 using(StreamReader sr = new StreamReader(httpRequest.InputStream))
227 forPost = sr.ReadToEnd();
228 NameValueCollection postQuery = HttpUtility.ParseQueryString(forPost);
226 NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); 229 NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query);
227 NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); 230 NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery);
228 231
@@ -241,7 +244,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
241 // Check for form POST data 244 // Check for form POST data
242 if (passwordValues != null && passwordValues.Length == 1) 245 if (passwordValues != null && passwordValues.Length == 1)
243 { 246 {
244 if (account != null && 247 if (account != null &&
245 (m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty)) 248 (m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty))
246 authRequest.IsAuthenticated = true; 249 authRequest.IsAuthenticated = true;
247 else 250 else
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
index c9b4e9b..310a542 100644
--- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Authorization
67 67
68 xs = new XmlSerializer(typeof(AuthorizationResponse)); 68 xs = new XmlSerializer(typeof(AuthorizationResponse));
69 return ServerUtils.SerializeResult(xs, result); 69 return ServerUtils.SerializeResult(xs, result);
70 70
71 } 71 }
72 } 72 }
73} 73}
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index ff8699f..b8fdacf 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -60,9 +60,9 @@ namespace OpenSim.Server.Handlers.Avatar
60 protected override byte[] ProcessRequest(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 { 62 {
63 StreamReader sr = new StreamReader(requestData); 63 string body;
64 string body = sr.ReadToEnd(); 64 using(StreamReader sr = new StreamReader(requestData))
65 sr.Close(); 65 body = sr.ReadToEnd();
66 body = body.Trim(); 66 body = body.Trim();
67 67
68 //m_log.DebugFormat("[XXX]: query String: {0}", body); 68 //m_log.DebugFormat("[XXX]: query String: {0}", body);
@@ -175,7 +175,7 @@ namespace OpenSim.Server.Handlers.Avatar
175 request.Remove("METHOD"); 175 request.Remove("METHOD");
176 request.Remove("UserID"); 176 request.Remove("UserID");
177 } 177 }
178 178
179 byte[] SetItems(Dictionary<string, object> request) 179 byte[] SetItems(Dictionary<string, object> request)
180 { 180 {
181 UUID user = UUID.Zero; 181 UUID user = UUID.Zero;
@@ -196,7 +196,7 @@ namespace OpenSim.Server.Handlers.Avatar
196 names = _names.ToArray(); 196 names = _names.ToArray();
197 List<string> _values = (List<string>)request["Values"]; 197 List<string> _values = (List<string>)request["Values"];
198 values = _values.ToArray(); 198 values = _values.ToArray();
199 199
200 if (m_AvatarService.SetItems(user, names, values)) 200 if (m_AvatarService.SetItems(user, names, values))
201 return SuccessResult(); 201 return SuccessResult();
202 202
@@ -227,7 +227,7 @@ namespace OpenSim.Server.Handlers.Avatar
227 } 227 }
228 228
229 229
230 230
231 private byte[] SuccessResult() 231 private byte[] SuccessResult()
232 { 232 {
233 XmlDocument doc = new XmlDocument(); 233 XmlDocument doc = new XmlDocument();
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs
index abcda62..4e55433 100644
--- a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs
+++ b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs
@@ -70,9 +70,9 @@ namespace OpenSim.Server.Handlers.BakedTextures
70 m_FSBase = assetConfig.GetString("BaseDirectory", String.Empty); 70 m_FSBase = assetConfig.GetString("BaseDirectory", String.Empty);
71 if (m_FSBase == String.Empty) 71 if (m_FSBase == String.Empty)
72 { 72 {
73 m_FSBase = "bakes"; 73 m_log.ErrorFormat("[BAKES]: BaseDirectory not specified");
74 throw new Exception("Configuration error");
74 } 75 }
75 m_FSBase = "../caches/" + m_FSBase;
76 76
77 m_log.Info("[BAKES]: XBakes service enabled"); 77 m_log.Info("[BAKES]: XBakes service enabled");
78 } 78 }
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs
index 4c12967..4386a2d 100644
--- a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs
+++ b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.BakedTextures
61 ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args); 61 ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args);
62 62
63 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); 63 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
64 64
65 server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth)); 65 server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth));
66 server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth)); 66 server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth));
67 } 67 }
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
index e38543b..d16000d 100644
--- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
+++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
@@ -65,12 +65,10 @@ namespace OpenSim.Server.Handlers.BakedTextures
65 return new byte[0]; 65 return new byte[0];
66 } 66 }
67 67
68 StreamReader sr = new StreamReader(request); 68 using(StreamReader sr = new StreamReader(request))
69 69 m_BakesService.Store(p[0],sr.ReadToEnd());
70 m_BakesService.Store(p[0], sr.ReadToEnd());
71 sr.Close();
72 70
73 return new byte[0]; 71 return new byte[0];
74 } 72 }
75 } 73 }
76} \ No newline at end of file 74}
diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs
index 72014db..0a4df54 100644
--- a/OpenSim/Server/Handlers/Base/ServerConnector.cs
+++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Server.Handlers.Base
72 72
73 // We call this from our plugin module to get our configuration 73 // We call this from our plugin module to get our configuration
74 public IConfig GetConfig() 74 public IConfig GetConfig()
75 { 75 {
76 IConfig config = null; 76 IConfig config = null;
77 config = ServerUtils.GetConfig(ConfigFile, ConfigName); 77 config = ServerUtils.GetConfig(ConfigFile, ConfigName);
78 78
@@ -96,12 +96,12 @@ namespace OpenSim.Server.Handlers.Base
96 96
97 // We get our remote initial configuration for bootstrapping in case 97 // We get our remote initial configuration for bootstrapping in case
98 // we have no configuration in our main file or in an existing 98 // we have no configuration in our main file or in an existing
99 // modular config file. This is the last resort to bootstrap the 99 // modular config file. This is the last resort to bootstrap the
100 // configuration, likely a new plugin loading for the first time. 100 // configuration, likely a new plugin loading for the first time.
101 private IConfigSource GetConfigSource() 101 private IConfigSource GetConfigSource()
102 { 102 {
103 IConfigSource source = null; 103 IConfigSource source = null;
104 104
105 source = ServerUtils.LoadInitialConfig(ConfigURL); 105 source = ServerUtils.LoadInitialConfig(ConfigURL);
106 106
107 if (source == null) 107 if (source == null)
diff --git a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs
index e0c2810..b7558ec 100644
--- a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs
+++ b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs
@@ -282,9 +282,10 @@ namespace OpenSim.Server.Handlers
282 // /estates/estate/?eid=int&region=uuid 282 // /estates/estate/?eid=int&region=uuid
283 if ("estate".Equals(resource)) 283 if ("estate".Equals(resource))
284 { 284 {
285 StreamReader sr = new StreamReader(request); 285 string body;
286 string body = sr.ReadToEnd(); 286 using(StreamReader sr = new StreamReader(request))
287 sr.Close(); 287 body = sr.ReadToEnd();
288
288 body = body.Trim(); 289 body = body.Trim();
289 290
290 Dictionary<string, object> requestData = ServerUtils.ParseQueryString(body); 291 Dictionary<string, object> requestData = ServerUtils.ParseQueryString(body);
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 3aab30b..d6668ab 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -61,9 +61,9 @@ namespace OpenSim.Server.Handlers.Friends
61 protected override byte[] ProcessRequest(string path, Stream requestData, 61 protected override byte[] ProcessRequest(string path, Stream requestData,
62 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 62 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
63 { 63 {
64 StreamReader sr = new StreamReader(requestData); 64 string body;
65 string body = sr.ReadToEnd(); 65 using(StreamReader sr = new StreamReader(requestData))
66 sr.Close(); 66 body = sr.ReadToEnd();
67 body = body.Trim(); 67 body = body.Trim();
68 68
69 //m_log.DebugFormat("[XXX]: query String: {0}", body); 69 //m_log.DebugFormat("[XXX]: query String: {0}", body);
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
index 346af32..2aec045 100644
--- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
+++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
@@ -83,10 +83,10 @@ namespace OpenSim.Server.Handlers.Grid
83 { 83 {
84 _info["login"] 84 _info["login"]
85 = String.Format( 85 = String.Format(
86 "http://127.0.0.1:{0}/", 86 "http://127.0.0.1:{0}/",
87 netCfg.GetString( 87 netCfg.GetString(
88 "http_listener_port", ConfigSettings.DefaultRegionHttpPort.ToString())); 88 "http_listener_port", ConfigSettings.DefaultRegionHttpPort.ToString()));
89 89
90 IssueWarning(); 90 IssueWarning();
91 } 91 }
92 else 92 else
@@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.Grid
99 { 99 {
100 _log.Warn("[GRID INFO SERVICE]: Cannot get grid info from config source, using minimal defaults"); 100 _log.Warn("[GRID INFO SERVICE]: Cannot get grid info from config source, using minimal defaults");
101 } 101 }
102 102
103 _log.DebugFormat("[GRID INFO SERVICE]: Grid info service initialized with {0} keys", _info.Count); 103 _log.DebugFormat("[GRID INFO SERVICE]: Grid info service initialized with {0} keys", _info.Count);
104 } 104 }
105 105
@@ -107,7 +107,7 @@ namespace OpenSim.Server.Handlers.Grid
107 { 107 {
108 _log.Warn("[GRID INFO SERVICE]: found no [GridInfo] section in your configuration files"); 108 _log.Warn("[GRID INFO SERVICE]: found no [GridInfo] section in your configuration files");
109 _log.Warn("[GRID INFO SERVICE]: trying to guess sensible defaults, you might want to provide better ones:"); 109 _log.Warn("[GRID INFO SERVICE]: trying to guess sensible defaults, you might want to provide better ones:");
110 110
111 foreach (string k in _info.Keys) 111 foreach (string k in _info.Keys)
112 { 112 {
113 _log.WarnFormat("[GRID INFO SERVICE]: {0}: {1}", k, _info[k]); 113 _log.WarnFormat("[GRID INFO SERVICE]: {0}: {1}", k, _info[k]);
@@ -181,7 +181,7 @@ namespace OpenSim.Server.Handlers.Grid
181 new string[] { "Startup", "Hypergrid" }, String.Empty); 181 new string[] { "Startup", "Hypergrid" }, String.Empty);
182 182
183 if (!String.IsNullOrEmpty(HomeURI)) 183 if (!String.IsNullOrEmpty(HomeURI))
184 map["home"] = OSD.FromString(HomeURI); 184 map["home"] = OSD.FromString(HomeURI);
185 else // Legacy. Remove soon! 185 else // Legacy. Remove soon!
186 { 186 {
187 IConfig cfg = m_Config.Configs["LoginService"]; 187 IConfig cfg = m_Config.Configs["LoginService"];
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 86fda36..44d4654 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -65,9 +65,9 @@ namespace OpenSim.Server.Handlers.Grid
65 protected override byte[] ProcessRequest(string path, Stream requestData, 65 protected override byte[] ProcessRequest(string path, Stream requestData,
66 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 66 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
67 { 67 {
68 StreamReader sr = new StreamReader(requestData); 68 string body;
69 string body = sr.ReadToEnd(); 69 using(StreamReader sr = new StreamReader(requestData))
70 sr.Close(); 70 body = sr.ReadToEnd();
71 body = body.Trim(); 71 body = body.Trim();
72 72
73 //m_log.DebugFormat("[XXX]: query String: {0}", body); 73 //m_log.DebugFormat("[XXX]: query String: {0}", body);
@@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Grid
126 case "get_grid_extra_features": 126 case "get_grid_extra_features":
127 return GetGridExtraFeatures(request); 127 return GetGridExtraFeatures(request);
128 } 128 }
129 129
130 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); 130 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method);
131 } 131 }
132 catch (Exception e) 132 catch (Exception e)
@@ -579,33 +579,33 @@ namespace OpenSim.Server.Handlers.Grid
579 if (request.ContainsKey("SCOPEID")) 579 if (request.ContainsKey("SCOPEID"))
580 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); 580 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
581 else 581 else
582 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); 582 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get RegionFlags");
583 583
584 UUID regionID = UUID.Zero; 584 UUID regionID = UUID.Zero;
585 if (request.ContainsKey("REGIONID")) 585 if (request.ContainsKey("REGIONID"))
586 UUID.TryParse(request["REGIONID"].ToString(), out regionID); 586 UUID.TryParse(request["REGIONID"].ToString(), out regionID);
587 else 587 else
588 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); 588 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get RegionFlags");
589 589
590 int flags = m_GridService.GetRegionFlags(scopeID, regionID); 590 int flags = m_GridService.GetRegionFlags(scopeID, regionID);
591 // m_log.DebugFormat("[GRID HANDLER]: flags for region {0}: {1}", regionID, flags); 591 // m_log.DebugFormat("[GRID HANDLER]: flags for region {0}: {1}", regionID, flags);
592 592
593 Dictionary<string, object> result = new Dictionary<string, object>(); 593 Dictionary<string, object> result = new Dictionary<string, object>();
594 result["result"] = flags.ToString(); 594 result["result"] = flags.ToString();
595 595
596 string xmlString = ServerUtils.BuildXmlResponse(result); 596 string xmlString = ServerUtils.BuildXmlResponse(result);
597 597
598 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 598 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
599 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 599 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
600 } 600 }
601 601
602 byte[] GetGridExtraFeatures(Dictionary<string, object> request) 602 byte[] GetGridExtraFeatures(Dictionary<string, object> request)
603 { 603 {
604 604
605 Dictionary<string, object> result = new Dictionary<string, object> (); 605 Dictionary<string, object> result = new Dictionary<string, object> ();
606 Dictionary<string, object> extraFeatures = m_GridService.GetExtraFeatures (); 606 Dictionary<string, object> extraFeatures = m_GridService.GetExtraFeatures ();
607 607
608 foreach (string key in extraFeatures.Keys) 608 foreach (string key in extraFeatures.Keys)
609 { 609 {
610 result [key] = extraFeatures [key]; 610 result [key] = extraFeatures [key];
611 } 611 }
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs
index 1e29378..755272b 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser
56 Object[] args = new Object[] { config }; 56 Object[] args = new Object[] { config };
57 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); 57 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args);
58 58
59 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; 59 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
60 60
61 server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); 61 server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth));
62 } 62 }
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 9237c63..1f691d6 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -60,9 +60,9 @@ namespace OpenSim.Server.Handlers.GridUser
60 protected override byte[] ProcessRequest(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 { 62 {
63 StreamReader sr = new StreamReader(requestData); 63 string body;
64 string body = sr.ReadToEnd(); 64 using(StreamReader sr = new StreamReader(requestData))
65 sr.Close(); 65 body = sr.ReadToEnd();
66 body = body.Trim(); 66 body = body.Trim();
67 67
68 //m_log.DebugFormat("[XXX]: query String: {0}", body); 68 //m_log.DebugFormat("[XXX]: query String: {0}", body);
@@ -185,6 +185,9 @@ namespace OpenSim.Server.Handlers.GridUser
185 185
186 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); 186 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user);
187 187
188 if (guinfo == null)
189 return FailureResult();
190
188 Dictionary<string, object> result = new Dictionary<string, object>(); 191 Dictionary<string, object> result = new Dictionary<string, object>();
189 if (guinfo != null) 192 if (guinfo != null)
190 result["result"] = guinfo.ToKeyValuePairs(); 193 result["result"] = guinfo.ToKeyValuePairs();
@@ -225,6 +228,8 @@ namespace OpenSim.Server.Handlers.GridUser
225 int i = 0; 228 int i = 0;
226 foreach (GridUserInfo pinfo in pinfos) 229 foreach (GridUserInfo pinfo in pinfos)
227 { 230 {
231 if(pinfo == null)
232 continue;
228 Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs(); 233 Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs();
229 result["griduser" + i] = rinfoDict; 234 result["griduser" + i] = rinfoDict;
230 i++; 235 i++;
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
index 95a0510..684d1a8 100644
--- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
52 public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentPostHandler 52 public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentPostHandler
53 { 53 {
54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private IGatekeeperService m_GatekeeperService; 56 private IGatekeeperService m_GatekeeperService;
57 57
58 public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) : base("/foreignagent") 58 public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) : base("/foreignagent")
@@ -62,7 +62,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
62 } 62 }
63 63
64 protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, 64 protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
65 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) 65 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, EntityTransferContext ctx, out string reason)
66 { 66 {
67 return m_GatekeeperService.LoginAgent(source, aCircuit, destination, out reason); 67 return m_GatekeeperService.LoginAgent(source, aCircuit, destination, out reason);
68 } 68 }
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs
index 6c79c60..870a5ef 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
48 } 48 }
49 49
50 // Called from standalone configurations 50 // Called from standalone configurations
51 public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) 51 public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn)
52 : base(config, server, configName) 52 : base(config, server, configName)
53 { 53 {
54 if (configName != string.Empty) 54 if (configName != string.Empty)
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 37b47ed..fc1a77d 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
61 m_UserAgentService = uas; 61 m_UserAgentService = uas;
62 m_FriendsLocalSimConnector = friendsConn; 62 m_FriendsLocalSimConnector = friendsConn;
63 63
64 m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", 64 m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})",
65 (m_FriendsLocalSimConnector == null ? "robust" : "standalone")); 65 (m_FriendsLocalSimConnector == null ? "robust" : "standalone"));
66 66
67 if (m_TheService == null) 67 if (m_TheService == null)
@@ -71,9 +71,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
71 protected override byte[] ProcessRequest(string path, Stream requestData, 71 protected override byte[] ProcessRequest(string path, Stream requestData,
72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
73 { 73 {
74 StreamReader sr = new StreamReader(requestData); 74 string body;
75 string body = sr.ReadToEnd(); 75 using(StreamReader sr = new StreamReader(requestData))
76 sr.Close(); 76 body = sr.ReadToEnd();
77 body = body.Trim(); 77 body = body.Trim();
78 78
79 //m_log.DebugFormat("[XXX]: query String: {0}", body); 79 //m_log.DebugFormat("[XXX]: query String: {0}", body);
@@ -105,24 +105,24 @@ namespace OpenSim.Server.Handlers.Hypergrid
105 105
106 case "validate_friendship_offered": 106 case "validate_friendship_offered":
107 return ValidateFriendshipOffered(request); 107 return ValidateFriendshipOffered(request);
108 108
109 case "statusnotification": 109 case "statusnotification":
110 return StatusNotification(request); 110 return StatusNotification(request);
111 /* 111 /*
112 case "friendship_approved": 112 case "friendship_approved":
113 return FriendshipApproved(request); 113 return FriendshipApproved(request);
114 114
115 case "friendship_denied": 115 case "friendship_denied":
116 return FriendshipDenied(request); 116 return FriendshipDenied(request);
117 117
118 case "friendship_terminated": 118 case "friendship_terminated":
119 return FriendshipTerminated(request); 119 return FriendshipTerminated(request);
120 120
121 case "grant_rights": 121 case "grant_rights":
122 return GrantRights(request); 122 return GrantRights(request);
123 */ 123 */
124 } 124 }
125 125
126 m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method); 126 m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method);
127 } 127 }
128 catch (Exception e) 128 catch (Exception e)
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index e787f7c..367c481 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
118 118
119 119
120 protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, 120 protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
121 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) 121 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, EntityTransferContext ctx, out string reason)
122 { 122 {
123 return m_UserAgentService.LoginAgentToGrid(source, aCircuit, gatekeeper, destination, fromLogin, out reason); 123 return m_UserAgentService.LoginAgentToGrid(source, aCircuit, gatekeeper, destination, fromLogin, out reason);
124 } 124 }
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
index c7ac9be..6bd24db 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
@@ -70,13 +70,17 @@ namespace OpenSim.Server.Handlers.Hypergrid
70 string imageURL = string.Empty; 70 string imageURL = string.Empty;
71 ulong regionHandle = 0; 71 ulong regionHandle = 0;
72 string reason = string.Empty; 72 string reason = string.Empty;
73 int sizeX = 256;
74 int sizeY = 256;
73 75
74 bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason); 76 bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason, out sizeX, out sizeY);
75 77
76 Hashtable hash = new Hashtable(); 78 Hashtable hash = new Hashtable();
77 hash["result"] = success.ToString(); 79 hash["result"] = success.ToString();
78 hash["uuid"] = regionID.ToString(); 80 hash["uuid"] = regionID.ToString();
79 hash["handle"] = regionHandle.ToString(); 81 hash["handle"] = regionHandle.ToString();
82 hash["size_x"] = sizeX.ToString();
83 hash["size_y"] = sizeY.ToString();
80 hash["region_image"] = imageURL; 84 hash["region_image"] = imageURL;
81 hash["external_name"] = externalName; 85 hash["external_name"] = externalName;
82 86
@@ -121,6 +125,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
121 hash["hostname"] = regInfo.ExternalHostName; 125 hash["hostname"] = regInfo.ExternalHostName;
122 hash["http_port"] = regInfo.HttpPort.ToString(); 126 hash["http_port"] = regInfo.HttpPort.ToString();
123 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); 127 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
128 hash["server_uri"] = regInfo.ServerURI;
124 } 129 }
125 130
126 if (message != null) 131 if (message != null)
diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
index 8145a21..63f376d 100644
--- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
55 55
56 public InstantMessageServerConnector(IConfigSource config, IHttpServer server) : 56 public InstantMessageServerConnector(IConfigSource config, IHttpServer server) :
57 this(config, server, (IInstantMessageSimConnector)null) 57 this(config, server, (IInstantMessageSimConnector)null)
58 { 58 {
59 } 59 }
60 60
61 public InstantMessageServerConnector(IConfigSource config, IHttpServer server, string configName) : 61 public InstantMessageServerConnector(IConfigSource config, IHttpServer server, string configName) :
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index e112e0e..394b133 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -63,14 +63,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
63 63
64 public UserAgentServerConnector(IConfigSource config, IHttpServer server) : 64 public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
65 this(config, server, (IFriendsSimConnector)null) 65 this(config, server, (IFriendsSimConnector)null)
66 { 66 {
67 } 67 }
68 68
69 public UserAgentServerConnector(IConfigSource config, IHttpServer server, string configName) : 69 public UserAgentServerConnector(IConfigSource config, IHttpServer server, string configName) :
70 this(config, server) 70 this(config, server)
71 { 71 {
72 } 72 }
73 73
74 public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) : 74 public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) :
75 base(config, server, String.Empty) 75 base(config, server, String.Empty)
76 { 76 {
@@ -139,6 +139,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
139 hash["region_name"] = regInfo.RegionName; 139 hash["region_name"] = regInfo.RegionName;
140 hash["hostname"] = regInfo.ExternalHostName; 140 hash["hostname"] = regInfo.ExternalHostName;
141 hash["http_port"] = regInfo.HttpPort.ToString(); 141 hash["http_port"] = regInfo.HttpPort.ToString();
142 hash["server_uri"] = regInfo.ServerURI;
142 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); 143 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
143 hash["position"] = position.ToString(); 144 hash["position"] = position.ToString();
144 hash["lookAt"] = lookAt.ToString(); 145 hash["lookAt"] = lookAt.ToString();
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
index b295446..e90b869 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Inventory
61 { 61 {
62 if (configName != string.Empty) 62 if (configName != string.Empty)
63 m_ConfigName = configName; 63 m_ConfigName = configName;
64 64
65 IConfig serverConfig = config.Configs[m_ConfigName]; 65 IConfig serverConfig = config.Configs[m_ConfigName];
66 if (serverConfig == null) 66 if (serverConfig == null)
67 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); 67 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
@@ -92,7 +92,7 @@ namespace OpenSim.Server.Handlers.Inventory
92 m_httpServer.AddStreamHandler( 92 m_httpServer.AddStreamHandler(
93 new RestDeserialiseSecureHandler<Guid, InventoryCollection>( 93 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
94 "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession)); 94 "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession));
95 95
96 m_httpServer.AddStreamHandler( 96 m_httpServer.AddStreamHandler(
97 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 97 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
98 "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); 98 "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession));
@@ -114,12 +114,12 @@ namespace OpenSim.Server.Handlers.Inventory
114 "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); 114 "POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
115 115
116 m_httpServer.AddStreamHandler( 116 m_httpServer.AddStreamHandler(
117 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( 117 new RestDeserialiseSecureHandler<Guid, InventoryItemBase>(
118 "POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession)); 118 "POST", "/QueryItem/", GetItem, CheckAuthSession));
119 119
120 m_httpServer.AddStreamHandler( 120 m_httpServer.AddStreamHandler(
121 new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>( 121 new RestDeserialiseSecureHandler<Guid, InventoryFolderBase>(
122 "POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession)); 122 "POST", "/QueryFolder/", GetFolder, CheckAuthSession));
123 123
124 m_httpServer.AddStreamHandler( 124 m_httpServer.AddStreamHandler(
125 new RestDeserialiseTrustedHandler<Guid, bool>( 125 new RestDeserialiseTrustedHandler<Guid, bool>(
@@ -151,7 +151,7 @@ namespace OpenSim.Server.Handlers.Inventory
151 151
152 m_httpServer.AddStreamHandler(new InventoryServerMoveItemsHandler(m_InventoryService)); 152 m_httpServer.AddStreamHandler(new InventoryServerMoveItemsHandler(m_InventoryService));
153 153
154 154
155 // for persistent active gestures 155 // for persistent active gestures
156 m_httpServer.AddStreamHandler( 156 m_httpServer.AddStreamHandler(
157 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> 157 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
@@ -205,6 +205,16 @@ namespace OpenSim.Server.Handlers.Inventory
205 return new Dictionary<AssetType, InventoryFolderBase>(); 205 return new Dictionary<AssetType, InventoryFolderBase>();
206 } 206 }
207 207
208 public InventoryItemBase GetItem(Guid guid)
209 {
210 return m_InventoryService.GetItem(UUID.Zero, new UUID(guid));
211 }
212
213 public InventoryFolderBase GetFolder(Guid guid)
214 {
215 return m_InventoryService.GetFolder(UUID.Zero, new UUID(guid));
216 }
217
208 public InventoryCollection GetFolderContent(Guid guid) 218 public InventoryCollection GetFolderContent(Guid guid)
209 { 219 {
210 return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); 220 return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid));
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 5c4e7a9..742d1a0 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -95,9 +95,9 @@ namespace OpenSim.Server.Handlers.Inventory
95 protected override byte[] ProcessRequest(string path, Stream requestData, 95 protected override byte[] ProcessRequest(string path, Stream requestData,
96 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 96 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
97 { 97 {
98 StreamReader sr = new StreamReader(requestData); 98 string body;
99 string body = sr.ReadToEnd(); 99 using(StreamReader sr = new StreamReader(requestData))
100 sr.Close(); 100 body = sr.ReadToEnd();
101 body = body.Trim(); 101 body = body.Trim();
102 102
103 //m_log.DebugFormat("[XXX]: query String: {0}", body); 103 //m_log.DebugFormat("[XXX]: query String: {0}", body);
@@ -293,7 +293,7 @@ namespace OpenSim.Server.Handlers.Inventory
293 result["FID"] = icoll.FolderID.ToString(); 293 result["FID"] = icoll.FolderID.ToString();
294 result["VERSION"] = icoll.Version.ToString(); 294 result["VERSION"] = icoll.Version.ToString();
295 Dictionary<string, object> folders = new Dictionary<string, object>(); 295 Dictionary<string, object> folders = new Dictionary<string, object>();
296 int i = 0; 296 int i = 0;
297 if (icoll.Folders != null) 297 if (icoll.Folders != null)
298 { 298 {
299 foreach (InventoryFolderBase f in icoll.Folders) 299 foreach (InventoryFolderBase f in icoll.Folders)
@@ -407,7 +407,7 @@ namespace OpenSim.Server.Handlers.Inventory
407 } 407 }
408 } 408 }
409 result["ITEMS"] = sitems; 409 result["ITEMS"] = sitems;
410 410
411 string xmlString = ServerUtils.BuildXmlResponse(result); 411 string xmlString = ServerUtils.BuildXmlResponse(result);
412 412
413 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 413 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@@ -566,9 +566,11 @@ namespace OpenSim.Server.Handlers.Inventory
566 Dictionary<string,object> result = new Dictionary<string,object>(); 566 Dictionary<string,object> result = new Dictionary<string,object>();
567 UUID id = UUID.Zero; 567 UUID id = UUID.Zero;
568 UUID.TryParse(request["ID"].ToString(), out id); 568 UUID.TryParse(request["ID"].ToString(), out id);
569 UUID user = UUID.Zero;
570 if (request.ContainsKey("PRINCIPAL"))
571 UUID.TryParse(request["PRINCIPAL"].ToString(), out user);
569 572
570 InventoryItemBase item = new InventoryItemBase(id); 573 InventoryItemBase item = m_InventoryService.GetItem(user, id);
571 item = m_InventoryService.GetItem(item);
572 if (item != null) 574 if (item != null)
573 result["item"] = EncodeItem(item); 575 result["item"] = EncodeItem(item);
574 576
@@ -617,9 +619,11 @@ namespace OpenSim.Server.Handlers.Inventory
617 Dictionary<string, object> result = new Dictionary<string, object>(); 619 Dictionary<string, object> result = new Dictionary<string, object>();
618 UUID id = UUID.Zero; 620 UUID id = UUID.Zero;
619 UUID.TryParse(request["ID"].ToString(), out id); 621 UUID.TryParse(request["ID"].ToString(), out id);
622 UUID user = UUID.Zero;
623 if (request.ContainsKey("PRINCIPAL"))
624 UUID.TryParse(request["PRINCIPAL"].ToString(), out user);
620 625
621 InventoryFolderBase folder = new InventoryFolderBase(id); 626 InventoryFolderBase folder = m_InventoryService.GetFolder(user, id);
622 folder = m_InventoryService.GetFolder(folder);
623 if (folder != null) 627 if (folder != null)
624 result["folder"] = EncodeFolder(folder); 628 result["folder"] = EncodeFolder(folder);
625 629
diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs
index b45289a..d74077a 100644
--- a/OpenSim/Server/Handlers/Land/LandHandlers.cs
+++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Land
64 ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); 64 ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
65 uint x = Convert.ToUInt32(requestData["x"]); 65 uint x = Convert.ToUInt32(requestData["x"]);
66 uint y = Convert.ToUInt32(requestData["y"]); 66 uint y = Convert.ToUInt32(requestData["y"]);
67 m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); 67// m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);
68 68
69 byte regionAccess; 69 byte regionAccess;
70 LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess); 70 LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess);
@@ -85,6 +85,7 @@ namespace OpenSim.Server.Handlers.Land
85 hash["SnapshotID"] = landData.SnapshotID.ToString(); 85 hash["SnapshotID"] = landData.SnapshotID.ToString();
86 hash["UserLocation"] = landData.UserLocation.ToString(); 86 hash["UserLocation"] = landData.UserLocation.ToString();
87 hash["RegionAccess"] = regionAccess.ToString(); 87 hash["RegionAccess"] = regionAccess.ToString();
88 hash["Dwell"] = landData.Dwell.ToString();
88 } 89 }
89 90
90 XmlRpcResponse response = new XmlRpcResponse(); 91 XmlRpcResponse response = new XmlRpcResponse();
diff --git a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs
index d368bd3..c4b339f 100644
--- a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Land
54 m_log.Error("[LAND IN CONNECTOR]: Land service was not provided"); 54 m_log.Error("[LAND IN CONNECTOR]: Land service was not provided");
55 return; 55 return;
56 } 56 }
57 57
58 //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false); 58 //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false);
59 //if (authentication) 59 //if (authentication)
60 // m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>(); 60 // m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>();
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index f2a5678..4e7ab00 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Server.Handlers.Login
53 53
54 private ILoginService m_LocalService; 54 private ILoginService m_LocalService;
55 private bool m_Proxy; 55 private bool m_Proxy;
56 56
57 57
58 public LLLoginHandlers(ILoginService service, bool hasProxy) 58 public LLLoginHandlers(ILoginService service, bool hasProxy)
59 { 59 {
@@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Login
64 public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) 64 public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
65 { 65 {
66 Hashtable requestData = (Hashtable)request.Params[0]; 66 Hashtable requestData = (Hashtable)request.Params[0];
67 if (m_Proxy && request.Params[3] != null) 67 if (request.Params[3] != null)
68 { 68 {
69 IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); 69 IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
70 if (ep != null) 70 if (ep != null)
@@ -132,8 +132,13 @@ namespace OpenSim.Server.Handlers.Login
132 132
133 //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); 133 //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);
134 134
135
136 bool LibOMVclient = false;
137 if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy")
138 LibOMVclient = true;
139
135 LoginResponse reply = null; 140 LoginResponse reply = null;
136 reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); 141 reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient);
137 142
138 XmlRpcResponse response = new XmlRpcResponse(); 143 XmlRpcResponse response = new XmlRpcResponse();
139 response.Value = reply.ToHashtable(); 144 response.Value = reply.ToHashtable();
@@ -216,7 +221,7 @@ namespace OpenSim.Server.Handlers.Login
216 221
217 LoginResponse reply = null; 222 LoginResponse reply = null;
218 reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, 223 reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID,
219 map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); 224 map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false);
220 return reply.ToOSDMap(); 225 return reply.ToOSDMap();
221 226
222 } 227 }
@@ -259,7 +264,7 @@ namespace OpenSim.Server.Handlers.Login
259 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); 264 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint();
260 LoginResponse reply = null; 265 LoginResponse reply = null;
261 reply = m_LocalService.Login(first, last, passwd, start, scope, version, 266 reply = m_LocalService.Login(first, last, passwd, start, scope, version,
262 channel, mac, id0, endPoint); 267 channel, mac, id0, endPoint,false);
263 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); 268 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap()));
264 269
265 } 270 }
@@ -274,11 +279,11 @@ namespace OpenSim.Server.Handlers.Login
274 sock.Close("success"); 279 sock.Close("success");
275 } 280 }
276 }; 281 };
277 282
278 sock.HandshakeAndUpgrade(); 283 sock.HandshakeAndUpgrade();
279 284
280 } 285 }
281 286
282 287
283 private XmlRpcResponse FailedXMLRPCResponse() 288 private XmlRpcResponse FailedXMLRPCResponse()
284 { 289 {
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
index f60e892..56ac3c2 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Server.Handlers.Login
98 m_DosProtectionOptions.ForgetTimeSpan = 98 m_DosProtectionOptions.ForgetTimeSpan =
99 TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSForgiveClientAfterMS", 120000)); 99 TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSForgiveClientAfterMS", 120000));
100 m_DosProtectionOptions.ReportingName = "LOGINDOSPROTECTION"; 100 m_DosProtectionOptions.ReportingName = "LOGINDOSPROTECTION";
101 101
102 102
103 return loginService; 103 return loginService;
104 } 104 }
@@ -106,7 +106,7 @@ namespace OpenSim.Server.Handlers.Login
106 private void InitializeHandlers(IHttpServer server) 106 private void InitializeHandlers(IHttpServer server)
107 { 107 {
108 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); 108 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy);
109 server.AddXmlRPCHandler("login_to_simulator", 109 server.AddXmlRPCHandler("login_to_simulator",
110 new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin,loginHandlers.HandleXMLRPCLoginBlocked, 110 new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin,loginHandlers.HandleXMLRPCLoginBlocked,
111 m_DosProtectionOptions).Process, false); 111 m_DosProtectionOptions).Process, false);
112 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); 112 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 649a27e..331dabf 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -104,9 +104,9 @@ namespace OpenSim.Server.Handlers.MapImage
104 protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 104 protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
105 { 105 {
106// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); 106// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
107 StreamReader sr = new StreamReader(requestData); 107 string body;
108 string body = sr.ReadToEnd(); 108 using(StreamReader sr = new StreamReader(requestData))
109 sr.Close(); 109 body = sr.ReadToEnd();
110 body = body.Trim(); 110 body = body.Trim();
111 111
112 try 112 try
@@ -118,9 +118,13 @@ namespace OpenSim.Server.Handlers.MapImage
118 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; 118 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
119 return FailureResult("Bad request."); 119 return FailureResult("Bad request.");
120 } 120 }
121 uint x = 0, y = 0; 121 int x = 0, y = 0;
122 UInt32.TryParse(request["X"].ToString(), out x); 122// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
123 UInt32.TryParse(request["Y"].ToString(), out y); 123 UUID scopeID = UUID.Zero;
124 Int32.TryParse(request["X"].ToString(), out x);
125 Int32.TryParse(request["Y"].ToString(), out y);
126 if (request.ContainsKey("SCOPE"))
127 UUID.TryParse(request["SCOPE"].ToString(), out scopeID);
124 128
125 m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); 129 m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y);
126 130
@@ -132,7 +136,7 @@ namespace OpenSim.Server.Handlers.MapImage
132 if (m_GridService != null) 136 if (m_GridService != null)
133 { 137 {
134 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); 138 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
135 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); 139 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y));
136 if (r != null) 140 if (r != null)
137 { 141 {
138 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) 142 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
@@ -144,7 +148,7 @@ namespace OpenSim.Server.Handlers.MapImage
144 } 148 }
145 else 149 else
146 { 150 {
147 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", 151 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}",
148 ipAddr, x, y); 152 ipAddr, x, y);
149 return FailureResult("Region not found at given coordinates"); 153 return FailureResult("Region not found at given coordinates");
150 } 154 }
@@ -153,7 +157,8 @@ namespace OpenSim.Server.Handlers.MapImage
153 byte[] data = Convert.FromBase64String(request["DATA"].ToString()); 157 byte[] data = Convert.FromBase64String(request["DATA"].ToString());
154 158
155 string reason = string.Empty; 159 string reason = string.Empty;
156 bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); 160
161 bool result = m_MapService.AddMapTile((int)x, (int)y, data, scopeID, out reason);
157 162
158 if (result) 163 if (result)
159 return SuccessResult(); 164 return SuccessResult();
@@ -220,8 +225,8 @@ namespace OpenSim.Server.Handlers.MapImage
220 225
221 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) 226 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
222 { 227 {
223 if (!m_Proxy) 228// if (!m_Proxy)
224 return request.RemoteIPEndPoint.Address; 229// return request.RemoteIPEndPoint.Address;
225 230
226 // We're behind a proxy 231 // We're behind a proxy
227 string xff = "X-Forwarded-For"; 232 string xff = "X-Forwarded-For";
@@ -231,7 +236,7 @@ namespace OpenSim.Server.Handlers.MapImage
231 236
232 if (xffValue == null || (xffValue != null && xffValue == string.Empty)) 237 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
233 { 238 {
234 m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); 239// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
235 return request.RemoteIPEndPoint.Address; 240 return request.RemoteIPEndPoint.Address;
236 } 241 }
237 242
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index 7bb2f39..1ae669c 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -29,6 +29,7 @@ using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32 33
33using Nini.Config; 34using Nini.Config;
34using log4net; 35using log4net;
@@ -37,6 +38,7 @@ using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Server.Handlers.Base; 40using OpenSim.Server.Handlers.Base;
41using OpenMetaverse;
40 42
41namespace OpenSim.Server.Handlers.MapImage 43namespace OpenSim.Server.Handlers.MapImage
42{ 44{
@@ -70,6 +72,8 @@ namespace OpenSim.Server.Handlers.MapImage
70 72
71 class MapServerGetHandler : BaseStreamHandler 73 class MapServerGetHandler : BaseStreamHandler
72 { 74 {
75 public static ManualResetEvent ev = new ManualResetEvent(true);
76
73// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74 78
75 private IMapImageService m_MapService; 79 private IMapImageService m_MapService;
@@ -82,10 +86,25 @@ namespace OpenSim.Server.Handlers.MapImage
82 86
83 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 87 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
84 { 88 {
85 byte[] result = new byte[0]; 89 ev.WaitOne();
90 lock (ev)
91 {
92 ev.Reset();
93 }
86 94
95 byte[] result = new byte[0];
87 string format = string.Empty; 96 string format = string.Empty;
88 result = m_MapService.GetMapTile(path.Trim('/'), out format); 97
98// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
99 UUID scopeID = UUID.Zero;
100
101 string[] bits = path.Trim('/').Split(new char[] {'/'});
102 if (bits.Length > 1)
103 {
104 scopeID = new UUID(bits[0]);
105 path = bits[1];
106 }
107 result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format);
89 if (result.Length > 0) 108 if (result.Length > 0)
90 { 109 {
91 httpResponse.StatusCode = (int)HttpStatusCode.OK; 110 httpResponse.StatusCode = (int)HttpStatusCode.OK;
@@ -100,6 +119,11 @@ namespace OpenSim.Server.Handlers.MapImage
100 httpResponse.ContentType = "text/plain"; 119 httpResponse.ContentType = "text/plain";
101 } 120 }
102 121
122 lock (ev)
123 {
124 ev.Set();
125 }
126
103 return result; 127 return result;
104 } 128 }
105 129
diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
new file mode 100644
index 0000000..9daeb73
--- /dev/null
+++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
@@ -0,0 +1,256 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Xml;
33
34using Nini.Config;
35using log4net;
36using OpenMetaverse;
37
38using OpenSim.Framework;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Server.Handlers.Base;
43
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
46namespace OpenSim.Server.Handlers.MapImage
47{
48 public class MapRemoveServiceConnector : ServiceConnector
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 private IMapImageService m_MapService;
53 private IGridService m_GridService;
54 private string m_ConfigName = "MapImageService";
55
56 public MapRemoveServiceConnector(IConfigSource config, IHttpServer server, string configName) :
57 base(config, server, configName)
58 {
59 IConfig serverConfig = config.Configs[m_ConfigName];
60 if (serverConfig == null)
61 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
62
63 string mapService = serverConfig.GetString("LocalServiceModule",
64 String.Empty);
65
66 if (mapService == String.Empty)
67 throw new Exception("No LocalServiceModule in config file");
68
69 Object[] args = new Object[] { config };
70 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);
71
72 string gridService = serverConfig.GetString("GridService", String.Empty);
73 if (gridService != string.Empty)
74 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
75
76 if (m_GridService != null)
77 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
78 else
79 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
80
81 bool proxy = serverConfig.GetBoolean("HasProxy", false);
82 server.AddStreamHandler(new MapServerRemoveHandler(m_MapService, m_GridService, proxy));
83
84 }
85 }
86
87 class MapServerRemoveHandler : BaseStreamHandler
88 {
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90 private IMapImageService m_MapService;
91 private IGridService m_GridService;
92 bool m_Proxy;
93
94 public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) :
95 base("POST", "/removemap")
96 {
97 m_MapService = service;
98 m_GridService = grid;
99 m_Proxy = proxy;
100 }
101
102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
103 {
104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
105 string body;
106 using(StreamReader sr = new StreamReader(requestData))
107 body = sr.ReadToEnd();
108 body = body.Trim();
109
110 try
111 {
112 Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
113
114 if (!request.ContainsKey("X") || !request.ContainsKey("Y"))
115 {
116 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
117 return FailureResult("Bad request.");
118 }
119 int x = 0, y = 0;
120 Int32.TryParse(request["X"].ToString(), out x);
121 Int32.TryParse(request["Y"].ToString(), out y);
122// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
123 UUID scopeID = UUID.Zero;
124 if (request.ContainsKey("SCOPE"))
125 UUID.TryParse(request["SCOPE"].ToString(), out scopeID);
126
127 m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y);
128
129 if (m_GridService != null)
130 {
131 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
132 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y));
133 if (r != null)
134 {
135 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
136 {
137 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address);
138 return FailureResult("IP address of caller does not match IP address of registered region");
139 }
140
141 }
142 else
143 {
144 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}",
145 ipAddr, x, y);
146 return FailureResult("Region not found at given coordinates");
147 }
148 }
149
150 string reason = string.Empty;
151 bool result = m_MapService.RemoveMapTile(x, y, scopeID, out reason);
152
153 if (result)
154 return SuccessResult();
155 else
156 return FailureResult(reason);
157
158 }
159 catch (Exception e)
160 {
161 m_log.ErrorFormat("[MAP SERVICE IMAGE HANDLER]: Exception {0} {1}", e.Message, e.StackTrace);
162 }
163
164 return FailureResult("Unexpected server error");
165 }
166
167 private byte[] SuccessResult()
168 {
169 XmlDocument doc = new XmlDocument();
170
171 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
172 "", "");
173
174 doc.AppendChild(xmlnode);
175
176 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
177 "");
178
179 doc.AppendChild(rootElement);
180
181 XmlElement result = doc.CreateElement("", "Result", "");
182 result.AppendChild(doc.CreateTextNode("Success"));
183
184 rootElement.AppendChild(result);
185
186 return DocToBytes(doc);
187 }
188
189 private byte[] FailureResult(string msg)
190 {
191 XmlDocument doc = new XmlDocument();
192
193 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
194 "", "");
195
196 doc.AppendChild(xmlnode);
197
198 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
199 "");
200
201 doc.AppendChild(rootElement);
202
203 XmlElement result = doc.CreateElement("", "Result", "");
204 result.AppendChild(doc.CreateTextNode("Failure"));
205
206 rootElement.AppendChild(result);
207
208 XmlElement message = doc.CreateElement("", "Message", "");
209 message.AppendChild(doc.CreateTextNode(msg));
210
211 rootElement.AppendChild(message);
212
213 return DocToBytes(doc);
214 }
215
216 private byte[] DocToBytes(XmlDocument doc)
217 {
218 using(MemoryStream ms = new MemoryStream())
219 {
220 using(XmlTextWriter xw = new XmlTextWriter(ms,null))
221 {
222 xw.Formatting = Formatting.Indented;
223 doc.WriteTo(xw);
224 xw.Flush();
225 }
226 return ms.ToArray();
227 }
228 }
229
230 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
231 {
232// if (!m_Proxy)
233// return request.RemoteIPEndPoint.Address;
234
235 // We're behind a proxy
236 string xff = "X-Forwarded-For";
237 string xffValue = request.Headers[xff.ToLower()];
238 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
239 xffValue = request.Headers[xff];
240
241 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
242 {
243// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
244 return request.RemoteIPEndPoint.Address;
245 }
246
247 System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue);
248 if (ep != null)
249 return ep.Address;
250
251 // Oops
252 return request.RemoteIPEndPoint.Address;
253 }
254
255 }
256}
diff --git a/OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs b/OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs
new file mode 100644
index 0000000..8d27f07
--- /dev/null
+++ b/OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs
@@ -0,0 +1,63 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.ServiceAuth;
33using OpenSim.Framework.Servers.HttpServer;
34using OpenSim.Server.Handlers.Base;
35
36namespace OpenSim.Server.Handlers.GridUser
37{
38 public class MuteListServiceConnector : ServiceConnector
39 {
40 private IMuteListService m_MuteListService;
41 private string m_ConfigName = "MuteListService";
42
43 public MuteListServiceConnector(IConfigSource config, IHttpServer server, string configName) :
44 base(config, server, configName)
45 {
46 IConfig serverConfig = config.Configs[m_ConfigName];
47 if (serverConfig == null)
48 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
49
50 string service = serverConfig.GetString("LocalServiceModule", String.Empty);
51
52 if (service == String.Empty)
53 throw new Exception("LocalServiceModule not present in MuteListService config file MuteListService section");
54
55 Object[] args = new Object[] { config };
56 m_MuteListService = ServerUtils.LoadPlugin<IMuteListService>(service, args);
57
58 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
59
60 server.AddStreamHandler(new MuteListServerPostHandler(m_MuteListService, auth));
61 }
62 }
63}
diff --git a/OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs b/OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs
new file mode 100644
index 0000000..26c4093
--- /dev/null
+++ b/OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs
@@ -0,0 +1,240 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Nini.Config;
29using log4net;
30using System;
31using System.Reflection;
32using System.IO;
33using System.Net;
34using System.Text;
35using System.Text.RegularExpressions;
36using System.Xml;
37using System.Xml.Serialization;
38using System.Collections.Generic;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Framework;
42using OpenSim.Framework.ServiceAuth;
43using OpenSim.Framework.Servers.HttpServer;
44using OpenMetaverse;
45
46namespace OpenSim.Server.Handlers.GridUser
47{
48 public class MuteListServerPostHandler : BaseStreamHandler
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 private IMuteListService m_service;
53
54 public MuteListServerPostHandler(IMuteListService service, IServiceAuth auth) :
55 base("POST", "/mutelist", auth)
56 {
57 m_service = service;
58 }
59
60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 {
63 string body;
64 using(StreamReader sr = new StreamReader(requestData))
65 body = sr.ReadToEnd();
66 body = body.Trim();
67
68 //m_log.DebugFormat("[XXX]: query String: {0}", body);
69 string method = string.Empty;
70
71 try
72 {
73 Dictionary<string, object> request =
74 ServerUtils.ParseQueryString(body);
75
76 if (!request.ContainsKey("METHOD"))
77 return FailureResult();
78
79 method = request["METHOD"].ToString();
80
81 switch (method)
82 {
83 case "get":
84 return getmutes(request);
85 case "update":
86 return updatemute(request);
87 case "delete":
88 return deletemute(request);
89 }
90 m_log.DebugFormat("[MUTELIST HANDLER]: unknown method request: {0}", method);
91 }
92 catch (Exception e)
93 {
94 m_log.DebugFormat("[MUTELIST HANDLER]: Exception in method {0}: {1}", method, e);
95 }
96
97 return FailureResult();
98 }
99
100 byte[] getmutes(Dictionary<string, object> request)
101 {
102 if(!request.ContainsKey("agentid") || !request.ContainsKey("mutecrc"))
103 return FailureResult();
104
105 UUID agentID;
106 if(!UUID.TryParse(request["agentid"].ToString(), out agentID))
107 return FailureResult();
108
109 uint mutecrc;
110 if(!UInt32.TryParse(request["mutecrc"].ToString(), out mutecrc))
111 return FailureResult();
112
113 byte[] data = m_service.MuteListRequest(agentID, mutecrc);
114
115 Dictionary<string, object> result = new Dictionary<string, object>();
116 result["result"] = Convert.ToBase64String(data);
117
118 string xmlString = ServerUtils.BuildXmlResponse(result);
119
120 //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
121 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
122 }
123
124 byte[] updatemute(Dictionary<string, object> request)
125 {
126 if(!request.ContainsKey("agentid") || !request.ContainsKey("muteid"))
127 return FailureResult();
128
129 MuteData mute = new MuteData();
130
131 if( !UUID.TryParse(request["agentid"].ToString(), out mute.AgentID))
132 return FailureResult();
133
134 if(!UUID.TryParse(request["muteid"].ToString(), out mute.MuteID))
135 return FailureResult();
136
137 if(request.ContainsKey("mutename"))
138 {
139 mute.MuteName = request["mutename"].ToString();
140 }
141 else
142 mute.MuteName = String.Empty;
143
144 if(request.ContainsKey("mutetype"))
145 {
146 if(!Int32.TryParse(request["mutetype"].ToString(), out mute.MuteType))
147 return FailureResult();
148 }
149 else
150 mute.MuteType = 0;
151
152 if(request.ContainsKey("muteflags"))
153 {
154 if(!Int32.TryParse(request["muteflags"].ToString(), out mute.MuteFlags))
155 return FailureResult();
156 }
157 else
158 mute.MuteFlags = 0;
159
160 if(request.ContainsKey("mutestamp"))
161 {
162 if(!Int32.TryParse(request["mutestamp"].ToString(), out mute.Stamp))
163 return FailureResult();
164 }
165 else
166 mute.Stamp = Util.UnixTimeSinceEpoch();
167
168 return m_service.UpdateMute(mute) ? SuccessResult() : FailureResult();
169 }
170
171 byte[] deletemute(Dictionary<string, object> request)
172 {
173 if(!request.ContainsKey("agentid") || !request.ContainsKey("muteid"))
174 return FailureResult();
175
176 UUID agentID;
177 if( !UUID.TryParse(request["agentid"].ToString(), out agentID))
178 return FailureResult();
179
180 UUID muteID;
181 if(!UUID.TryParse(request["muteid"].ToString(), out muteID))
182 return FailureResult();
183
184 string muteName;
185 if(request.ContainsKey("mutename"))
186 {
187 muteName = request["mutename"].ToString();
188
189 }
190 else
191 muteName = String.Empty;
192
193 return m_service.RemoveMute(agentID, muteID, muteName) ? SuccessResult() : FailureResult();
194 }
195
196 private byte[] SuccessResult()
197 {
198 XmlDocument doc = new XmlDocument();
199
200 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
201 "", "");
202
203 doc.AppendChild(xmlnode);
204
205 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
206 "");
207
208 doc.AppendChild(rootElement);
209
210 XmlElement result = doc.CreateElement("", "result", "");
211 result.AppendChild(doc.CreateTextNode("Success"));
212
213 rootElement.AppendChild(result);
214
215 return Util.DocToBytes(doc);
216 }
217
218 private byte[] FailureResult()
219 {
220 XmlDocument doc = new XmlDocument();
221
222 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
223 "", "");
224
225 doc.AppendChild(xmlnode);
226
227 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
228 "");
229
230 doc.AppendChild(rootElement);
231
232 XmlElement result = doc.CreateElement("", "result", "");
233 result.AppendChild(doc.CreateTextNode("Failure"));
234
235 rootElement.AppendChild(result);
236
237 return Util.DocToBytes(doc);
238 }
239 }
240}
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index 3525a01..e3ee467 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Server.Handlers.Neighbour
150 150
151 // Finally! 151 // Finally!
152 GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); 152 GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion);
153 153
154 OSDMap resp = new OSDMap(1); 154 OSDMap resp = new OSDMap(1);
155 155
156 if (thisRegion != null) 156 if (thisRegion != null)
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs
index ac2e75f..65ac4e6 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Neighbour
55 m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided"); 55 m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided");
56 return; 56 return;
57 } 57 }
58 58
59 //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false); 59 //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false);
60 //if (authentication) 60 //if (authentication)
61 // m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>(); 61 // m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>();
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 49dbcb5..be16e17 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Server.Handlers.Presence
158 158
159 return FailureResult(); 159 return FailureResult();
160 } 160 }
161 161
162 byte[] Report(Dictionary<string, object> request) 162 byte[] Report(Dictionary<string, object> request)
163 { 163 {
164 UUID session = UUID.Zero; 164 UUID session = UUID.Zero;
@@ -241,7 +241,7 @@ namespace OpenSim.Server.Handlers.Presence
241 } 241 }
242 242
243 string xmlString = ServerUtils.BuildXmlResponse(result); 243 string xmlString = ServerUtils.BuildXmlResponse(result);
244 244
245 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 245 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
246 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 246 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
247 } 247 }
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
index 2dfb862..eecb370 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
@@ -39,8 +39,8 @@ namespace OpenSim.Server.Handlers.Profiles
39{ 39{
40 public class UserProfilesConnector: ServiceConnector 40 public class UserProfilesConnector: ServiceConnector
41 { 41 {
42// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 // Our Local Module 44 // Our Local Module
45 public IUserProfilesService ServiceModule 45 public IUserProfilesService ServiceModule
46 { 46 {
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Profiles
83 83
84 Object[] args = new Object[] { config, ConfigName }; 84 Object[] args = new Object[] { config, ConfigName };
85 ServiceModule = ServerUtils.LoadPlugin<IUserProfilesService>(service, args); 85 ServiceModule = ServerUtils.LoadPlugin<IUserProfilesService>(service, args);
86 86
87 JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule); 87 JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule);
88 88
89 Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest); 89 Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest);
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
index 49aa8ba..f23a981 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
@@ -48,17 +48,17 @@ namespace OpenSim.Server.Handlers
48 static readonly ILog m_log = 48 static readonly ILog m_log =
49 LogManager.GetLogger( 49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType); 50 MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 public IUserProfilesService Service 52 public IUserProfilesService Service
53 { 53 {
54 get; private set; 54 get; private set;
55 } 55 }
56 56
57 public JsonRpcProfileHandlers(IUserProfilesService service) 57 public JsonRpcProfileHandlers(IUserProfilesService service)
58 { 58 {
59 Service = service; 59 Service = service;
60 } 60 }
61 61
62 #region Classifieds 62 #region Classifieds
63 /// <summary> 63 /// <summary>
64 /// Request avatar's classified ads. 64 /// Request avatar's classified ads.
@@ -80,17 +80,17 @@ namespace OpenSim.Server.Handlers
80 m_log.DebugFormat ("Classified Request"); 80 m_log.DebugFormat ("Classified Request");
81 return false; 81 return false;
82 } 82 }
83 83
84 OSDMap request = (OSDMap)json["params"]; 84 OSDMap request = (OSDMap)json["params"];
85 UUID creatorId = new UUID(request["creatorId"].AsString()); 85 UUID creatorId = new UUID(request["creatorId"].AsString());
86 86
87 87
88 OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId); 88 OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId);
89 response.Result = data; 89 response.Result = data;
90 90
91 return true; 91 return true;
92 } 92 }
93 93
94 public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response) 94 public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response)
95 { 95 {
96 if(!json.ContainsKey("params")) 96 if(!json.ContainsKey("params"))
@@ -100,7 +100,7 @@ namespace OpenSim.Server.Handlers
100 m_log.DebugFormat ("Classified Update Request"); 100 m_log.DebugFormat ("Classified Update Request");
101 return false; 101 return false;
102 } 102 }
103 103
104 string result = string.Empty; 104 string result = string.Empty;
105 UserClassifiedAdd ad = new UserClassifiedAdd(); 105 UserClassifiedAdd ad = new UserClassifiedAdd();
106 object Ad = (object)ad; 106 object Ad = (object)ad;
@@ -110,12 +110,12 @@ namespace OpenSim.Server.Handlers
110 response.Result = OSD.SerializeMembers(ad); 110 response.Result = OSD.SerializeMembers(ad);
111 return true; 111 return true;
112 } 112 }
113 113
114 response.Error.Code = ErrorCode.InternalError; 114 response.Error.Code = ErrorCode.InternalError;
115 response.Error.Message = string.Format("{0}", result); 115 response.Error.Message = string.Format("{0}", result);
116 return false; 116 return false;
117 } 117 }
118 118
119 public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response) 119 public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response)
120 { 120 {
121 if(!json.ContainsKey("params")) 121 if(!json.ContainsKey("params"))
@@ -124,10 +124,10 @@ namespace OpenSim.Server.Handlers
124 m_log.DebugFormat ("Classified Delete Request"); 124 m_log.DebugFormat ("Classified Delete Request");
125 return false; 125 return false;
126 } 126 }
127 127
128 OSDMap request = (OSDMap)json["params"]; 128 OSDMap request = (OSDMap)json["params"];
129 UUID classifiedId = new UUID(request["classifiedId"].AsString()); 129 UUID classifiedId = new UUID(request["classifiedId"].AsString());
130 130
131 if (Service.ClassifiedDelete(classifiedId)) 131 if (Service.ClassifiedDelete(classifiedId))
132 return true; 132 return true;
133 133
@@ -135,7 +135,7 @@ namespace OpenSim.Server.Handlers
135 response.Error.Message = "data error removing record"; 135 response.Error.Message = "data error removing record";
136 return false; 136 return false;
137 } 137 }
138 138
139 public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response) 139 public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response)
140 { 140 {
141 if(!json.ContainsKey("params")) 141 if(!json.ContainsKey("params"))
@@ -145,7 +145,7 @@ namespace OpenSim.Server.Handlers
145 m_log.DebugFormat ("Classified Info Request"); 145 m_log.DebugFormat ("Classified Info Request");
146 return false; 146 return false;
147 } 147 }
148 148
149 string result = string.Empty; 149 string result = string.Empty;
150 UserClassifiedAdd ad = new UserClassifiedAdd(); 150 UserClassifiedAdd ad = new UserClassifiedAdd();
151 object Ad = (object)ad; 151 object Ad = (object)ad;
@@ -155,13 +155,13 @@ namespace OpenSim.Server.Handlers
155 response.Result = OSD.SerializeMembers(ad); 155 response.Result = OSD.SerializeMembers(ad);
156 return true; 156 return true;
157 } 157 }
158 158
159 response.Error.Code = ErrorCode.InternalError; 159 response.Error.Code = ErrorCode.InternalError;
160 response.Error.Message = string.Format("{0}", result); 160 response.Error.Message = string.Format("{0}", result);
161 return false; 161 return false;
162 } 162 }
163 #endregion Classifieds 163 #endregion Classifieds
164 164
165 #region Picks 165 #region Picks
166 public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response) 166 public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response)
167 { 167 {
@@ -171,17 +171,17 @@ namespace OpenSim.Server.Handlers
171 m_log.DebugFormat ("Avatar Picks Request"); 171 m_log.DebugFormat ("Avatar Picks Request");
172 return false; 172 return false;
173 } 173 }
174 174
175 OSDMap request = (OSDMap)json["params"]; 175 OSDMap request = (OSDMap)json["params"];
176 UUID creatorId = new UUID(request["creatorId"].AsString()); 176 UUID creatorId = new UUID(request["creatorId"].AsString());
177 177
178 178
179 OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId); 179 OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId);
180 response.Result = data; 180 response.Result = data;
181 181
182 return true; 182 return true;
183 } 183 }
184 184
185 public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response) 185 public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response)
186 { 186 {
187 if(!json.ContainsKey("params")) 187 if(!json.ContainsKey("params"))
@@ -191,7 +191,7 @@ namespace OpenSim.Server.Handlers
191 m_log.DebugFormat ("Avatar Picks Info Request"); 191 m_log.DebugFormat ("Avatar Picks Info Request");
192 return false; 192 return false;
193 } 193 }
194 194
195 string result = string.Empty; 195 string result = string.Empty;
196 UserProfilePick pick = new UserProfilePick(); 196 UserProfilePick pick = new UserProfilePick();
197 object Pick = (object)pick; 197 object Pick = (object)pick;
@@ -201,12 +201,12 @@ namespace OpenSim.Server.Handlers
201 response.Result = OSD.SerializeMembers(pick); 201 response.Result = OSD.SerializeMembers(pick);
202 return true; 202 return true;
203 } 203 }
204 204
205 response.Error.Code = ErrorCode.InternalError; 205 response.Error.Code = ErrorCode.InternalError;
206 response.Error.Message = string.Format("{0}", result); 206 response.Error.Message = string.Format("{0}", result);
207 return false; 207 return false;
208 } 208 }
209 209
210 public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response) 210 public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response)
211 { 211 {
212 if(!json.ContainsKey("params")) 212 if(!json.ContainsKey("params"))
@@ -216,7 +216,7 @@ namespace OpenSim.Server.Handlers
216 m_log.DebugFormat ("Avatar Picks Update Request"); 216 m_log.DebugFormat ("Avatar Picks Update Request");
217 return false; 217 return false;
218 } 218 }
219 219
220 string result = string.Empty; 220 string result = string.Empty;
221 UserProfilePick pick = new UserProfilePick(); 221 UserProfilePick pick = new UserProfilePick();
222 object Pick = (object)pick; 222 object Pick = (object)pick;
@@ -226,13 +226,13 @@ namespace OpenSim.Server.Handlers
226 response.Result = OSD.SerializeMembers(pick); 226 response.Result = OSD.SerializeMembers(pick);
227 return true; 227 return true;
228 } 228 }
229 229
230 response.Error.Code = ErrorCode.InternalError; 230 response.Error.Code = ErrorCode.InternalError;
231 response.Error.Message = "unable to update pick"; 231 response.Error.Message = "unable to update pick";
232 232
233 return false; 233 return false;
234 } 234 }
235 235
236 public bool PicksDelete(OSDMap json, ref JsonRpcResponse response) 236 public bool PicksDelete(OSDMap json, ref JsonRpcResponse response)
237 { 237 {
238 if(!json.ContainsKey("params")) 238 if(!json.ContainsKey("params"))
@@ -241,18 +241,18 @@ namespace OpenSim.Server.Handlers
241 m_log.DebugFormat ("Avatar Picks Delete Request"); 241 m_log.DebugFormat ("Avatar Picks Delete Request");
242 return false; 242 return false;
243 } 243 }
244 244
245 OSDMap request = (OSDMap)json["params"]; 245 OSDMap request = (OSDMap)json["params"];
246 UUID pickId = new UUID(request["pickId"].AsString()); 246 UUID pickId = new UUID(request["pickId"].AsString());
247 if(Service.PicksDelete(pickId)) 247 if(Service.PicksDelete(pickId))
248 return true; 248 return true;
249 249
250 response.Error.Code = ErrorCode.InternalError; 250 response.Error.Code = ErrorCode.InternalError;
251 response.Error.Message = "data error removing record"; 251 response.Error.Message = "data error removing record";
252 return false; 252 return false;
253 } 253 }
254 #endregion Picks 254 #endregion Picks
255 255
256 #region Notes 256 #region Notes
257 public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response) 257 public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response)
258 { 258 {
@@ -277,7 +277,7 @@ namespace OpenSim.Server.Handlers
277 response.Error.Message = "Error reading notes"; 277 response.Error.Message = "Error reading notes";
278 return false; 278 return false;
279 } 279 }
280 280
281 public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response) 281 public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response)
282 { 282 {
283 if(!json.ContainsKey("params")) 283 if(!json.ContainsKey("params"))
@@ -287,7 +287,7 @@ namespace OpenSim.Server.Handlers
287 m_log.DebugFormat ("Avatar Notes Update Request"); 287 m_log.DebugFormat ("Avatar Notes Update Request");
288 return false; 288 return false;
289 } 289 }
290 290
291 string result = string.Empty; 291 string result = string.Empty;
292 UserProfileNotes note = new UserProfileNotes(); 292 UserProfileNotes note = new UserProfileNotes();
293 object Notes = (object) note; 293 object Notes = (object) note;
@@ -300,7 +300,7 @@ namespace OpenSim.Server.Handlers
300 return true; 300 return true;
301 } 301 }
302 #endregion Notes 302 #endregion Notes
303 303
304 #region Profile Properties 304 #region Profile Properties
305 public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response) 305 public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response)
306 { 306 {
@@ -311,7 +311,7 @@ namespace OpenSim.Server.Handlers
311 m_log.DebugFormat ("Avatar Properties Request"); 311 m_log.DebugFormat ("Avatar Properties Request");
312 return false; 312 return false;
313 } 313 }
314 314
315 string result = string.Empty; 315 string result = string.Empty;
316 UserProfileProperties props = new UserProfileProperties(); 316 UserProfileProperties props = new UserProfileProperties();
317 object Props = (object)props; 317 object Props = (object)props;
@@ -321,12 +321,12 @@ namespace OpenSim.Server.Handlers
321 response.Result = OSD.SerializeMembers(props); 321 response.Result = OSD.SerializeMembers(props);
322 return true; 322 return true;
323 } 323 }
324 324
325 response.Error.Code = ErrorCode.InternalError; 325 response.Error.Code = ErrorCode.InternalError;
326 response.Error.Message = string.Format("{0}", result); 326 response.Error.Message = string.Format("{0}", result);
327 return false; 327 return false;
328 } 328 }
329 329
330 public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response) 330 public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response)
331 { 331 {
332 if(!json.ContainsKey("params")) 332 if(!json.ContainsKey("params"))
@@ -336,7 +336,7 @@ namespace OpenSim.Server.Handlers
336 m_log.DebugFormat ("Avatar Properties Update Request"); 336 m_log.DebugFormat ("Avatar Properties Update Request");
337 return false; 337 return false;
338 } 338 }
339 339
340 string result = string.Empty; 340 string result = string.Empty;
341 UserProfileProperties props = new UserProfileProperties(); 341 UserProfileProperties props = new UserProfileProperties();
342 object Props = (object)props; 342 object Props = (object)props;
@@ -346,13 +346,13 @@ namespace OpenSim.Server.Handlers
346 response.Result = OSD.SerializeMembers(props); 346 response.Result = OSD.SerializeMembers(props);
347 return true; 347 return true;
348 } 348 }
349 349
350 response.Error.Code = ErrorCode.InternalError; 350 response.Error.Code = ErrorCode.InternalError;
351 response.Error.Message = string.Format("{0}", result); 351 response.Error.Message = string.Format("{0}", result);
352 return false; 352 return false;
353 } 353 }
354 #endregion Profile Properties 354 #endregion Profile Properties
355 355
356 #region Interests 356 #region Interests
357 public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response) 357 public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response)
358 { 358 {
@@ -363,7 +363,7 @@ namespace OpenSim.Server.Handlers
363 m_log.DebugFormat ("Avatar Interests Update Request"); 363 m_log.DebugFormat ("Avatar Interests Update Request");
364 return false; 364 return false;
365 } 365 }
366 366
367 string result = string.Empty; 367 string result = string.Empty;
368 UserProfileProperties props = new UserProfileProperties(); 368 UserProfileProperties props = new UserProfileProperties();
369 object Props = (object)props; 369 object Props = (object)props;
@@ -373,7 +373,7 @@ namespace OpenSim.Server.Handlers
373 response.Result = OSD.SerializeMembers(props); 373 response.Result = OSD.SerializeMembers(props);
374 return true; 374 return true;
375 } 375 }
376 376
377 response.Error.Code = ErrorCode.InternalError; 377 response.Error.Code = ErrorCode.InternalError;
378 response.Error.Message = string.Format("{0}", result); 378 response.Error.Message = string.Format("{0}", result);
379 return false; 379 return false;
@@ -399,7 +399,7 @@ namespace OpenSim.Server.Handlers
399 response.Result = OSD.SerializeMembers(prefs); 399 response.Result = OSD.SerializeMembers(prefs);
400 return true; 400 return true;
401 } 401 }
402 402
403 response.Error.Code = ErrorCode.InternalError; 403 response.Error.Code = ErrorCode.InternalError;
404 response.Error.Message = string.Format("{0}", result); 404 response.Error.Message = string.Format("{0}", result);
405// m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); 405// m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message);
@@ -415,7 +415,7 @@ namespace OpenSim.Server.Handlers
415 m_log.DebugFormat ("User Preferences Update Request"); 415 m_log.DebugFormat ("User Preferences Update Request");
416 return false; 416 return false;
417 } 417 }
418 418
419 string result = string.Empty; 419 string result = string.Empty;
420 UserPreferences prefs = new UserPreferences(); 420 UserPreferences prefs = new UserPreferences();
421 object Prefs = (object)prefs; 421 object Prefs = (object)prefs;
@@ -425,7 +425,7 @@ namespace OpenSim.Server.Handlers
425 response.Result = OSD.SerializeMembers(prefs); 425 response.Result = OSD.SerializeMembers(prefs);
426 return true; 426 return true;
427 } 427 }
428 428
429 response.Error.Code = ErrorCode.InternalError; 429 response.Error.Code = ErrorCode.InternalError;
430 response.Error.Message = string.Format("{0}", result); 430 response.Error.Message = string.Format("{0}", result);
431 m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); 431 m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message);
@@ -433,6 +433,7 @@ namespace OpenSim.Server.Handlers
433 } 433 }
434 #endregion User Preferences 434 #endregion User Preferences
435 435
436
436 #region Utility 437 #region Utility
437 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) 438 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
438 { 439 {
@@ -442,13 +443,13 @@ namespace OpenSim.Server.Handlers
442 m_log.DebugFormat ("Avatar Image Assets Request"); 443 m_log.DebugFormat ("Avatar Image Assets Request");
443 return false; 444 return false;
444 } 445 }
445 446
446 OSDMap request = (OSDMap)json["params"]; 447 OSDMap request = (OSDMap)json["params"];
447 UUID avatarId = new UUID(request["avatarId"].AsString()); 448 UUID avatarId = new UUID(request["avatarId"].AsString());
448 449
449 OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId); 450 OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId);
450 response.Result = data; 451 response.Result = data;
451 452
452 return true; 453 return true;
453 } 454 }
454 #endregion Utiltiy 455 #endregion Utiltiy
@@ -463,7 +464,7 @@ namespace OpenSim.Server.Handlers
463 m_log.DebugFormat ("User Application Service URL Request: No Parameters!"); 464 m_log.DebugFormat ("User Application Service URL Request: No Parameters!");
464 return false; 465 return false;
465 } 466 }
466 467
467 string result = string.Empty; 468 string result = string.Empty;
468 UserAppData props = new UserAppData(); 469 UserAppData props = new UserAppData();
469 object Props = (object)props; 470 object Props = (object)props;
@@ -474,15 +475,15 @@ namespace OpenSim.Server.Handlers
474 res["result"] = OSD.FromString("success"); 475 res["result"] = OSD.FromString("success");
475 res["token"] = OSD.FromString (result); 476 res["token"] = OSD.FromString (result);
476 response.Result = res; 477 response.Result = res;
477 478
478 return true; 479 return true;
479 } 480 }
480 481
481 response.Error.Code = ErrorCode.InternalError; 482 response.Error.Code = ErrorCode.InternalError;
482 response.Error.Message = string.Format("{0}", result); 483 response.Error.Message = string.Format("{0}", result);
483 return false; 484 return false;
484 } 485 }
485 486
486 public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response) 487 public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response)
487 { 488 {
488 if(!json.ContainsKey("params")) 489 if(!json.ContainsKey("params"))
@@ -492,7 +493,7 @@ namespace OpenSim.Server.Handlers
492 m_log.DebugFormat ("User App Data Update Request"); 493 m_log.DebugFormat ("User App Data Update Request");
493 return false; 494 return false;
494 } 495 }
495 496
496 string result = string.Empty; 497 string result = string.Empty;
497 UserAppData props = new UserAppData(); 498 UserAppData props = new UserAppData();
498 object Props = (object)props; 499 object Props = (object)props;
@@ -502,7 +503,7 @@ namespace OpenSim.Server.Handlers
502 response.Result = OSD.SerializeMembers(props); 503 response.Result = OSD.SerializeMembers(props);
503 return true; 504 return true;
504 } 505 }
505 506
506 response.Error.Code = ErrorCode.InternalError; 507 response.Error.Code = ErrorCode.InternalError;
507 response.Error.Message = string.Format("{0}", result); 508 response.Error.Message = string.Format("{0}", result);
508 return false; 509 return false;
diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
index f0b36c1..4d6402f 100644
--- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Server.Handlers")] 8[assembly: AssemblyTitle("OpenSim.Server.Handlers")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
@@ -25,9 +25,9 @@ using System.Runtime.InteropServices;
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.3.*")] 32[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
33 33
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 98c5312..c52a1ab 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -120,6 +120,10 @@ namespace OpenSim.Server.Handlers.Simulation
120 120
121 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) 121 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID)
122 { 122 {
123 Culture.SetCurrentCulture();
124
125 EntityTransferContext ctx = new EntityTransferContext();
126
123 if (m_SimulationService == null) 127 if (m_SimulationService == null)
124 { 128 {
125 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); 129 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
@@ -155,6 +159,9 @@ namespace OpenSim.Server.Handlers.Simulation
155 theirVersion = float.Parse(parts[1]); 159 theirVersion = float.Parse(parts[1]);
156 } 160 }
157 161
162 if (args.ContainsKey("context"))
163 ctx.Unpack((OSDMap)args["context"]);
164
158 // Decode the new versioning data 165 // Decode the new versioning data
159 float minVersionRequired = 0f; 166 float minVersionRequired = 0f;
160 float maxVersionRequired = 0f; 167 float maxVersionRequired = 0f;
@@ -183,7 +190,7 @@ namespace OpenSim.Server.Handlers.Simulation
183 { 190 {
184 // If there is no version in the packet at all we're looking at 0.6 or 191 // If there is no version in the packet at all we're looking at 0.6 or
185 // even more ancient. Refuse it. 192 // even more ancient. Refuse it.
186 if(theirVersion == 0f) 193 if(theirVersion == 0f)
187 { 194 {
188 resp["success"] = OSD.FromBoolean(false); 195 resp["success"] = OSD.FromBoolean(false);
189 resp["reason"] = OSD.FromString("Your region is running a old version of opensim no longer supported. Consider updating it"); 196 resp["reason"] = OSD.FromString("Your region is running a old version of opensim no longer supported. Consider updating it");
@@ -192,8 +199,8 @@ namespace OpenSim.Server.Handlers.Simulation
192 } 199 }
193 200
194 version = theirVersion; 201 version = theirVersion;
195 202
196 if (version < VersionInfo.SimulationServiceVersionAcceptedMin || 203 if (version < VersionInfo.SimulationServiceVersionAcceptedMin ||
197 version > VersionInfo.SimulationServiceVersionAcceptedMax ) 204 version > VersionInfo.SimulationServiceVersionAcceptedMax )
198 { 205 {
199 resp["success"] = OSD.FromBoolean(false); 206 resp["success"] = OSD.FromBoolean(false);
@@ -245,7 +252,6 @@ namespace OpenSim.Server.Handlers.Simulation
245 252
246 string reason; 253 string reason;
247 // We're sending the version numbers down to the local connector to do the varregion check. 254 // We're sending the version numbers down to the local connector to do the varregion check.
248 EntityTransferContext ctx = new EntityTransferContext();
249 ctx.InboundVersion = inboundVersion; 255 ctx.InboundVersion = inboundVersion;
250 ctx.OutboundVersion = outboundVersion; 256 ctx.OutboundVersion = outboundVersion;
251 if (minVersionProvided == 0f) 257 if (minVersionProvided == 0f)
@@ -255,6 +261,8 @@ namespace OpenSim.Server.Handlers.Simulation
255 } 261 }
256 262
257 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); 263 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason);
264 m_log.DebugFormat("[AGENT HANDLER]: QueryAccess returned {0} ({1}). Version={2}, {3}/{4}",
265 result, reason, version, inboundVersion, outboundVersion);
258 266
259 resp["success"] = OSD.FromBoolean(result); 267 resp["success"] = OSD.FromBoolean(result);
260 resp["reason"] = OSD.FromString(reason); 268 resp["reason"] = OSD.FromString(reason);
@@ -262,12 +270,11 @@ namespace OpenSim.Server.Handlers.Simulation
262 resp["version"] = OSD.FromString(legacyVersion); 270 resp["version"] = OSD.FromString(legacyVersion);
263 resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion); 271 resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion);
264 resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); 272 resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion);
265 resp["variable_wearables_count_supported"] = OSD.FromBoolean(true);
266 273
267 OSDArray featuresWanted = new OSDArray(); 274 OSDArray featuresWanted = new OSDArray();
268 foreach (UUID feature in features) 275 foreach (UUID feature in features)
269 featuresWanted.Add(OSD.FromString(feature.ToString())); 276 featuresWanted.Add(OSD.FromString(feature.ToString()));
270 277
271 resp["features"] = featuresWanted; 278 resp["features"] = featuresWanted;
272 279
273 // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map! 280 // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map!
@@ -407,6 +414,8 @@ namespace OpenSim.Server.Handlers.Simulation
407 414
408 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) 415 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
409 { 416 {
417 EntityTransferContext ctx = new EntityTransferContext();
418
410 OSDMap args = Utils.GetOSDMap((string)request["body"]); 419 OSDMap args = Utils.GetOSDMap((string)request["body"]);
411 if (args == null) 420 if (args == null)
412 { 421 {
@@ -415,6 +424,9 @@ namespace OpenSim.Server.Handlers.Simulation
415 return; 424 return;
416 } 425 }
417 426
427 if (args.ContainsKey("context"))
428 ctx.Unpack((OSDMap)args["context"]);
429
418 AgentDestinationData data = CreateAgentDestinationData(); 430 AgentDestinationData data = CreateAgentDestinationData();
419 UnpackData(args, data, request); 431 UnpackData(args, data, request);
420 432
@@ -448,7 +460,7 @@ namespace OpenSim.Server.Handlers.Simulation
448 source.RegionLocY = Int32.Parse(args["source_y"].AsString()); 460 source.RegionLocY = Int32.Parse(args["source_y"].AsString());
449 source.RegionName = args["source_name"].AsString(); 461 source.RegionName = args["source_name"].AsString();
450 source.RegionID = UUID.Parse(args["source_uuid"].AsString()); 462 source.RegionID = UUID.Parse(args["source_uuid"].AsString());
451 463
452 if (args.ContainsKey("source_server_uri")) 464 if (args.ContainsKey("source_server_uri"))
453 source.RawServerURI = args["source_server_uri"].AsString(); 465 source.RawServerURI = args["source_server_uri"].AsString();
454 else 466 else
@@ -461,7 +473,8 @@ namespace OpenSim.Server.Handlers.Simulation
461 // This is the meaning of POST agent 473 // This is the meaning of POST agent
462 //m_regionClient.AdjustUserInformation(aCircuit); 474 //m_regionClient.AdjustUserInformation(aCircuit);
463 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); 475 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
464 bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); 476
477 bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, ctx, out reason);
465 478
466 resp["reason"] = OSD.FromString(reason); 479 resp["reason"] = OSD.FromString(reason);
467 resp["success"] = OSD.FromBoolean(result); 480 resp["success"] = OSD.FromBoolean(result);
@@ -504,41 +517,62 @@ namespace OpenSim.Server.Handlers.Simulation
504 517
505 protected string GetCallerIP(Hashtable request) 518 protected string GetCallerIP(Hashtable request)
506 { 519 {
507 if (!m_Proxy) 520 if (request.ContainsKey("headers"))
508 return Util.GetCallerIP(request); 521 {
509 522 Hashtable headers = (Hashtable)request["headers"];
510 // We're behind a proxy
511 Hashtable headers = (Hashtable)request["headers"];
512 523
513 //// DEBUG 524 //// DEBUG
514 //foreach (object o in headers.Keys) 525 //foreach (object o in headers.Keys)
515 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); 526 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
516 527
517 string xff = "X-Forwarded-For"; 528 string xff = "X-Forwarded-For";
518 if (headers.ContainsKey(xff.ToLower())) 529 if (!headers.ContainsKey(xff))
519 xff = xff.ToLower(); 530 xff = xff.ToLower();
520 531
521 if (!headers.ContainsKey(xff) || headers[xff] == null) 532 if (!headers.ContainsKey(xff) || headers[xff] == null)
522 { 533 {
523 m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); 534// m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
524 return Util.GetCallerIP(request); 535 return Util.GetCallerIP(request);
525 } 536 }
526
527 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
528 537
529 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); 538// m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
530 if (ep != null)
531 return ep.Address.ToString();
532 539
540 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
541 if (ep != null)
542 return ep.Address.ToString();
543 }
533 // Oops 544 // Oops
534 return Util.GetCallerIP(request); 545 return Util.GetCallerIP(request);
535 } 546 }
536 547
537 // subclasses can override this 548 // subclasses can override this
538 protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, 549 protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
539 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) 550 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, EntityTransferContext ctx, out string reason)
540 { 551 {
541 return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); 552 reason = String.Empty;
553 // The data and protocols are already defined so this is just a dummy to satisfy the interface
554 // TODO: make this end-to-end
555
556/* this needs to be sync
557 if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0)
558 {
559 Util.FireAndForget(x =>
560 {
561 string r;
562 m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out r);
563 m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r);
564 });
565
566 return true;
567 }
568 else
569 {
570*/
571
572 bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason);
573// m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason);
574 return ret;
575// }
542 } 576 }
543 } 577 }
544 578
@@ -639,6 +673,9 @@ namespace OpenSim.Server.Handlers.Simulation
639 673
640 protected void DoAgentPut(Hashtable request, Hashtable responsedata) 674 protected void DoAgentPut(Hashtable request, Hashtable responsedata)
641 { 675 {
676 // TODO: Encode the ENtityTransferContext
677 EntityTransferContext ctx = new EntityTransferContext();
678
642 OSDMap args = Utils.GetOSDMap((string)request["body"]); 679 OSDMap args = Utils.GetOSDMap((string)request["body"]);
643 if (args == null) 680 if (args == null)
644 { 681 {
@@ -659,6 +696,8 @@ namespace OpenSim.Server.Handlers.Simulation
659 UUID.TryParse(args["destination_uuid"].AsString(), out uuid); 696 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
660 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 697 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
661 regionname = args["destination_name"].ToString(); 698 regionname = args["destination_name"].ToString();
699 if (args.ContainsKey("context"))
700 ctx.Unpack((OSDMap)args["context"]);
662 701
663 GridRegion destination = new GridRegion(); 702 GridRegion destination = new GridRegion();
664 destination.RegionID = uuid; 703 destination.RegionID = uuid;
@@ -681,7 +720,7 @@ namespace OpenSim.Server.Handlers.Simulation
681 AgentData agent = new AgentData(); 720 AgentData agent = new AgentData();
682 try 721 try
683 { 722 {
684 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); 723 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID), ctx);
685 } 724 }
686 catch (Exception ex) 725 catch (Exception ex)
687 { 726 {
@@ -700,7 +739,7 @@ namespace OpenSim.Server.Handlers.Simulation
700 AgentPosition agent = new AgentPosition(); 739 AgentPosition agent = new AgentPosition();
701 try 740 try
702 { 741 {
703 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); 742 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID), ctx);
704 } 743 }
705 catch (Exception ex) 744 catch (Exception ex)
706 { 745 {
@@ -721,7 +760,10 @@ namespace OpenSim.Server.Handlers.Simulation
721 // subclasses can override this 760 // subclasses can override this
722 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) 761 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
723 { 762 {
724 return m_SimulationService.UpdateAgent(destination, agent); 763 // The data and protocols are already defined so this is just a dummy to satisfy the interface
764 // TODO: make this end-to-end
765 EntityTransferContext ctx = new EntityTransferContext();
766 return m_SimulationService.UpdateAgent(destination, agent, ctx);
725 } 767 }
726 } 768 }
727 769
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
index dbb1a15..1b545ac 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -69,6 +69,8 @@ namespace OpenSim.Server.Handlers.Simulation
69 //m_log.Debug(" >> http-method=" + request["http-method"]); 69 //m_log.Debug(" >> http-method=" + request["http-method"]);
70 //m_log.Debug("---------------------------\n"); 70 //m_log.Debug("---------------------------\n");
71 71
72 Culture.SetCurrentCulture();
73
72 Hashtable responsedata = new Hashtable(); 74 Hashtable responsedata = new Hashtable();
73 responsedata["content_type"] = "text/html"; 75 responsedata["content_type"] = "text/html";
74 76
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 21eb790..bc12ef9 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -72,9 +72,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
72 protected override byte[] ProcessRequest(string path, Stream requestData, 72 protected override byte[] ProcessRequest(string path, Stream requestData,
73 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 73 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
74 { 74 {
75 StreamReader sr = new StreamReader(requestData); 75 string body;
76 string body = sr.ReadToEnd(); 76 using(StreamReader sr = new StreamReader(requestData))
77 sr.Close(); 77 body = sr.ReadToEnd();
78 body = body.Trim(); 78 body = body.Trim();
79 79
80 // We need to check the authorization header 80 // We need to check the authorization header
@@ -98,16 +98,18 @@ namespace OpenSim.Server.Handlers.UserAccounts
98 if (m_AllowCreateUser) 98 if (m_AllowCreateUser)
99 return CreateUser(request); 99 return CreateUser(request);
100 else 100 else
101 break; 101 return FailureResult();
102 case "getaccount": 102 case "getaccount":
103 return GetAccount(request); 103 return GetAccount(request);
104 case "getaccounts": 104 case "getaccounts":
105 return GetAccounts(request); 105 return GetAccounts(request);
106 case "getmultiaccounts":
107 return GetMultiAccounts(request);
106 case "setaccount": 108 case "setaccount":
107 if (m_AllowSetAccount) 109 if (m_AllowSetAccount)
108 return StoreAccount(request); 110 return StoreAccount(request);
109 else 111 else
110 break; 112 return FailureResult();
111 } 113 }
112 114
113 m_log.DebugFormat("[USER SERVICE HANDLER]: unknown method request: {0}", method); 115 m_log.DebugFormat("[USER SERVICE HANDLER]: unknown method request: {0}", method);
@@ -201,6 +203,52 @@ namespace OpenSim.Server.Handlers.UserAccounts
201 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 203 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
202 } 204 }
203 205
206 byte[] GetMultiAccounts(Dictionary<string, object> request)
207 {
208 UUID scopeID = UUID.Zero;
209 if (request.ContainsKey("ScopeID") && !UUID.TryParse(request["ScopeID"].ToString(), out scopeID))
210 return FailureResult();
211
212 if (!request.ContainsKey("IDS"))
213 {
214 m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts called without required uuids argument");
215 return FailureResult();
216 }
217
218 if (!(request["IDS"] is List<string>))
219 {
220 m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts input argument was of unexpected type {0}", request["IDS"].GetType().ToString());
221 return FailureResult();
222 }
223
224 List<string> userIDs = (List<string>)request["IDS"];
225
226 List<UserAccount> accounts = m_UserAccountService.GetUserAccounts(scopeID, userIDs);
227
228 Dictionary<string, object> result = new Dictionary<string, object>();
229 if ((accounts == null) || ((accounts != null) && (accounts.Count == 0)))
230 {
231 result["result"] = "null";
232 }
233 else
234 {
235 int i = 0;
236 foreach (UserAccount acc in accounts)
237 {
238 if(acc == null)
239 continue;
240 Dictionary<string, object> rinfoDict = acc.ToKeyValuePairs();
241 result["account" + i] = rinfoDict;
242 i++;
243 }
244 }
245
246 string xmlString = ServerUtils.BuildXmlResponse(result);
247
248 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
249 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
250 }
251
204 byte[] StoreAccount(Dictionary<string, object> request) 252 byte[] StoreAccount(Dictionary<string, object> request)
205 { 253 {
206 UUID principalID = UUID.Zero; 254 UUID principalID = UUID.Zero;
@@ -280,12 +328,16 @@ namespace OpenSim.Server.Handlers.UserAccounts
280 if (request.ContainsKey("Email")) 328 if (request.ContainsKey("Email"))
281 email = request["Email"].ToString(); 329 email = request["Email"].ToString();
282 330
331 string model = "";
332 if (request.ContainsKey("Model"))
333 model = request["Model"].ToString();
334
283 UserAccount createdUserAccount = null; 335 UserAccount createdUserAccount = null;
284 336
285 if (m_UserAccountService is UserAccountService) 337 if (m_UserAccountService is UserAccountService)
286 createdUserAccount 338 createdUserAccount
287 = ((UserAccountService)m_UserAccountService).CreateUser( 339 = ((UserAccountService)m_UserAccountService).CreateUser(
288 scopeID, principalID, firstName, lastName, password, email); 340 scopeID, principalID, firstName, lastName, password, email, model);
289 341
290 if (createdUserAccount == null) 342 if (createdUserAccount == null)
291 return FailureResult(); 343 return FailureResult();
@@ -345,4 +397,4 @@ namespace OpenSim.Server.Handlers.UserAccounts
345 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 397 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
346 } 398 }
347 } 399 }
348} \ No newline at end of file 400}
diff --git a/OpenSim/Server/Properties/AssemblyInfo.cs b/OpenSim/Server/Properties/AssemblyInfo.cs
index ee45e10..6d15078 100644
--- a/OpenSim/Server/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("Robust")] 8[assembly: AssemblyTitle("Robust")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index 65e9287..69d0b74 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -29,7 +29,9 @@ using Nini.Config;
29using log4net; 29using log4net;
30using System.Reflection; 30using System.Reflection;
31using System; 31using System;
32using System.Net;
32using System.Collections.Generic; 33using System.Collections.Generic;
34using OpenSim.Framework;
33using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
34using OpenSim.Framework.Servers.HttpServer; 36using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Server.Base; 37using OpenSim.Server.Base;
@@ -53,8 +55,14 @@ namespace OpenSim.Server
53 55
54 public static int Main(string[] args) 56 public static int Main(string[] args)
55 { 57 {
58 ServicePointManager.DefaultConnectionLimit = 64;
59 ServicePointManager.Expect100Continue = false;
60 ServicePointManager.UseNagleAlgorithm = false;
61
62 try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
63
56 m_Server = new HttpServerBase("R.O.B.U.S.T.", args); 64 m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
57 65
58 string registryLocation; 66 string registryLocation;
59 67
60 IConfig serverConfig = m_Server.Config.Configs["Startup"]; 68 IConfig serverConfig = m_Server.Config.Configs["Startup"];
@@ -65,7 +73,7 @@ namespace OpenSim.Server
65 } 73 }
66 74
67 string connList = serverConfig.GetString("ServiceConnectors", String.Empty); 75 string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
68 76
69 registryLocation = serverConfig.GetString("RegistryLocation","."); 77 registryLocation = serverConfig.GetString("RegistryLocation",".");
70 78
71 IConfig servicesConfig = m_Server.Config.Configs["ServiceList"]; 79 IConfig servicesConfig = m_Server.Config.Configs["ServiceList"];
@@ -153,6 +161,11 @@ namespace OpenSim.Server
153 161
154 int res = m_Server.Run(); 162 int res = m_Server.Run();
155 163
164 if(m_Server != null)
165 m_Server.Shutdown();
166
167 Util.StopThreadPool();
168
156 Environment.Exit(res); 169 Environment.Exit(res);
157 170
158 return 0; 171 return 0;