diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/ACL.cs | 252 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 65 | ||||
-rw-r--r-- | OpenSim/Framework/ConfigBase.cs | 38 | ||||
-rwxr-xr-x | OpenSim/Framework/Console/ConsoleBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/FriendRegionInfo.cs | 38 | ||||
-rw-r--r-- | OpenSim/Framework/GridConfig.cs | 162 | ||||
-rw-r--r-- | OpenSim/Framework/HGNetworkServersInfo.cs | 107 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/IClientFileTransfer.cs | 40 | ||||
-rw-r--r-- | OpenSim/Framework/ILoginServiceToRegionsConnector.cs | 41 | ||||
-rw-r--r-- | OpenSim/Framework/IMoneyModule.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/MessageServerConfig.cs | 152 | ||||
-rw-r--r-- | OpenSim/Framework/NetworkUtil.cs | 84 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 15 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/ACLTest.cs | 125 | ||||
-rw-r--r-- | OpenSim/Framework/UserConfig.cs | 231 | ||||
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 7 |
18 files changed, 174 insertions, 1220 deletions
diff --git a/OpenSim/Framework/ACL.cs b/OpenSim/Framework/ACL.cs deleted file mode 100644 index f76e8b7..0000000 --- a/OpenSim/Framework/ACL.cs +++ /dev/null | |||
@@ -1,252 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | // ACL Class | ||
34 | // Modelled after the structure of the Zend ACL Framework Library | ||
35 | // with one key difference - the tree will search for all matching | ||
36 | // permissions rather than just the first. Deny permissions will | ||
37 | // override all others. | ||
38 | |||
39 | #region ACL Core Class | ||
40 | |||
41 | /// <summary> | ||
42 | /// Access Control List Engine | ||
43 | /// </summary> | ||
44 | public class ACL | ||
45 | { | ||
46 | private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); | ||
47 | private Dictionary<string, Role> Roles = new Dictionary<string, Role>(); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Adds a new role | ||
51 | /// </summary> | ||
52 | /// <param name="role"></param> | ||
53 | /// <returns></returns> | ||
54 | public ACL AddRole(Role role) | ||
55 | { | ||
56 | if (Roles.ContainsKey(role.Name)) | ||
57 | throw new AlreadyContainsRoleException(role); | ||
58 | |||
59 | Roles.Add(role.Name, role); | ||
60 | |||
61 | return this; | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Adds a new resource | ||
66 | /// </summary> | ||
67 | /// <param name="resource"></param> | ||
68 | /// <returns></returns> | ||
69 | public ACL AddResource(Resource resource) | ||
70 | { | ||
71 | Resources.Add(resource.Name, resource); | ||
72 | |||
73 | return this; | ||
74 | } | ||
75 | |||
76 | /// <summary> | ||
77 | /// Permision for user/roll on a resource | ||
78 | /// </summary> | ||
79 | /// <param name="role"></param> | ||
80 | /// <param name="resource"></param> | ||
81 | /// <returns></returns> | ||
82 | public Permission HasPermission(string role, string resource) | ||
83 | { | ||
84 | if (!Roles.ContainsKey(role)) | ||
85 | throw new KeyNotFoundException(); | ||
86 | |||
87 | if (!Resources.ContainsKey(resource)) | ||
88 | throw new KeyNotFoundException(); | ||
89 | |||
90 | return Roles[role].RequestPermission(resource); | ||
91 | } | ||
92 | |||
93 | public ACL GrantPermission(string role, string resource) | ||
94 | { | ||
95 | if (!Roles.ContainsKey(role)) | ||
96 | throw new KeyNotFoundException(); | ||
97 | |||
98 | if (!Resources.ContainsKey(resource)) | ||
99 | throw new KeyNotFoundException(); | ||
100 | |||
101 | Roles[role].GivePermission(resource, Permission.Allow); | ||
102 | |||
103 | return this; | ||
104 | } | ||
105 | |||
106 | public ACL DenyPermission(string role, string resource) | ||
107 | { | ||
108 | if (!Roles.ContainsKey(role)) | ||
109 | throw new KeyNotFoundException(); | ||
110 | |||
111 | if (!Resources.ContainsKey(resource)) | ||
112 | throw new KeyNotFoundException(); | ||
113 | |||
114 | Roles[role].GivePermission(resource, Permission.Deny); | ||
115 | |||
116 | return this; | ||
117 | } | ||
118 | |||
119 | public ACL ResetPermission(string role, string resource) | ||
120 | { | ||
121 | if (!Roles.ContainsKey(role)) | ||
122 | throw new KeyNotFoundException(); | ||
123 | |||
124 | if (!Resources.ContainsKey(resource)) | ||
125 | throw new KeyNotFoundException(); | ||
126 | |||
127 | Roles[role].GivePermission(resource, Permission.None); | ||
128 | |||
129 | return this; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | #endregion | ||
134 | |||
135 | #region Exceptions | ||
136 | |||
137 | /// <summary> | ||
138 | /// Thrown when an ACL attempts to add a duplicate role. | ||
139 | /// </summary> | ||
140 | public class AlreadyContainsRoleException : Exception | ||
141 | { | ||
142 | protected Role m_role; | ||
143 | |||
144 | public AlreadyContainsRoleException(Role role) | ||
145 | { | ||
146 | m_role = role; | ||
147 | } | ||
148 | |||
149 | public Role ErrorRole | ||
150 | { | ||
151 | get { return m_role; } | ||
152 | } | ||
153 | |||
154 | public override string ToString() | ||
155 | { | ||
156 | return "This ACL already contains a role called '" + m_role.Name + "'."; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | #endregion | ||
161 | |||
162 | #region Roles and Resources | ||
163 | |||
164 | /// <summary> | ||
165 | /// Does this Role have permission to access a specified Resource? | ||
166 | /// </summary> | ||
167 | public enum Permission | ||
168 | { | ||
169 | Deny, | ||
170 | None, | ||
171 | Allow | ||
172 | } ; | ||
173 | |||
174 | /// <summary> | ||
175 | /// A role class, for use with Users or Groups | ||
176 | /// </summary> | ||
177 | public class Role | ||
178 | { | ||
179 | private string m_name; | ||
180 | private Role[] m_parents; | ||
181 | private Dictionary<string, Permission> m_resources = new Dictionary<string, Permission>(); | ||
182 | |||
183 | public Role(string name) | ||
184 | { | ||
185 | m_name = name; | ||
186 | m_parents = null; | ||
187 | } | ||
188 | |||
189 | public Role(string name, Role[] parents) | ||
190 | { | ||
191 | m_name = name; | ||
192 | m_parents = parents; | ||
193 | } | ||
194 | |||
195 | public string Name | ||
196 | { | ||
197 | get { return m_name; } | ||
198 | } | ||
199 | |||
200 | public Permission RequestPermission(string resource) | ||
201 | { | ||
202 | return RequestPermission(resource, Permission.None); | ||
203 | } | ||
204 | |||
205 | public Permission RequestPermission(string resource, Permission current) | ||
206 | { | ||
207 | // Deny permissions always override any others | ||
208 | if (current == Permission.Deny) | ||
209 | return current; | ||
210 | |||
211 | Permission temp = Permission.None; | ||
212 | |||
213 | // Pickup non-None permissions | ||
214 | if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None) | ||
215 | temp = m_resources[resource]; | ||
216 | |||
217 | if (m_parents != null) | ||
218 | { | ||
219 | foreach (Role parent in m_parents) | ||
220 | { | ||
221 | temp = parent.RequestPermission(resource, temp); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | return temp; | ||
226 | } | ||
227 | |||
228 | public void GivePermission(string resource, Permission perm) | ||
229 | { | ||
230 | m_resources[resource] = perm; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | public class Resource | ||
235 | { | ||
236 | private string m_name; | ||
237 | |||
238 | public Resource(string name) | ||
239 | { | ||
240 | m_name = name; | ||
241 | } | ||
242 | |||
243 | public string Name | ||
244 | { | ||
245 | get { return m_name; } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | #endregion | ||
250 | |||
251 | |||
252 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 62a1e17..da953bb 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities | |||
814 | 814 | ||
815 | if (mm != null) | 815 | if (mm != null) |
816 | { | 816 | { |
817 | if (!mm.UploadCovered(client)) | 817 | if (!mm.UploadCovered(client, mm.UploadCharge)) |
818 | { | 818 | { |
819 | if (client != null) | 819 | if (client != null) |
820 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 820 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index a1ac84c..89ee39c 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -265,6 +265,46 @@ namespace OpenSim.Framework | |||
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | public class ControllerData | ||
269 | { | ||
270 | public UUID ItemID; | ||
271 | public uint IgnoreControls; | ||
272 | public uint EventControls; | ||
273 | |||
274 | public ControllerData(UUID item, uint ignore, uint ev) | ||
275 | { | ||
276 | ItemID = item; | ||
277 | IgnoreControls = ignore; | ||
278 | EventControls = ev; | ||
279 | } | ||
280 | |||
281 | public ControllerData(OSDMap args) | ||
282 | { | ||
283 | UnpackUpdateMessage(args); | ||
284 | } | ||
285 | |||
286 | public OSDMap PackUpdateMessage() | ||
287 | { | ||
288 | OSDMap controldata = new OSDMap(); | ||
289 | controldata["item"] = OSD.FromUUID(ItemID); | ||
290 | controldata["ignore"] = OSD.FromInteger(IgnoreControls); | ||
291 | controldata["event"] = OSD.FromInteger(EventControls); | ||
292 | |||
293 | return controldata; | ||
294 | } | ||
295 | |||
296 | |||
297 | public void UnpackUpdateMessage(OSDMap args) | ||
298 | { | ||
299 | if (args["item"] != null) | ||
300 | ItemID = args["item"].AsUUID(); | ||
301 | if (args["ignore"] != null) | ||
302 | IgnoreControls = (uint)args["ignore"].AsInteger(); | ||
303 | if (args["event"] != null) | ||
304 | EventControls = (uint)args["event"].AsInteger(); | ||
305 | } | ||
306 | } | ||
307 | |||
268 | public class AgentData : IAgentData | 308 | public class AgentData : IAgentData |
269 | { | 309 | { |
270 | private UUID m_id; | 310 | private UUID m_id; |
@@ -313,6 +353,9 @@ namespace OpenSim.Framework | |||
313 | public UUID[] Wearables; | 353 | public UUID[] Wearables; |
314 | public AttachmentData[] Attachments; | 354 | public AttachmentData[] Attachments; |
315 | 355 | ||
356 | // Scripted | ||
357 | public ControllerData[] Controllers; | ||
358 | |||
316 | public string CallbackURI; | 359 | public string CallbackURI; |
317 | 360 | ||
318 | public virtual OSDMap Pack() | 361 | public virtual OSDMap Pack() |
@@ -403,6 +446,14 @@ namespace OpenSim.Framework | |||
403 | args["attachments"] = attachs; | 446 | args["attachments"] = attachs; |
404 | } | 447 | } |
405 | 448 | ||
449 | if ((Controllers != null) && (Controllers.Length > 0)) | ||
450 | { | ||
451 | OSDArray controls = new OSDArray(Controllers.Length); | ||
452 | foreach (ControllerData ctl in Controllers) | ||
453 | controls.Add(ctl.PackUpdateMessage()); | ||
454 | args["controllers"] = controls; | ||
455 | } | ||
456 | |||
406 | 457 | ||
407 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) | 458 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) |
408 | args["callback_uri"] = OSD.FromString(CallbackURI); | 459 | args["callback_uri"] = OSD.FromString(CallbackURI); |
@@ -559,6 +610,20 @@ namespace OpenSim.Framework | |||
559 | } | 610 | } |
560 | } | 611 | } |
561 | 612 | ||
613 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) | ||
614 | { | ||
615 | OSDArray controls = (OSDArray)(args["controllers"]); | ||
616 | Controllers = new ControllerData[controls.Count]; | ||
617 | int i = 0; | ||
618 | foreach (OSD o in controls) | ||
619 | { | ||
620 | if (o.Type == OSDType.Map) | ||
621 | { | ||
622 | Controllers[i++] = new ControllerData((OSDMap)o); | ||
623 | } | ||
624 | } | ||
625 | } | ||
626 | |||
562 | if (args["callback_uri"] != null) | 627 | if (args["callback_uri"] != null) |
563 | CallbackURI = args["callback_uri"].AsString(); | 628 | CallbackURI = args["callback_uri"].AsString(); |
564 | } | 629 | } |
diff --git a/OpenSim/Framework/ConfigBase.cs b/OpenSim/Framework/ConfigBase.cs deleted file mode 100644 index 40ec32f..0000000 --- a/OpenSim/Framework/ConfigBase.cs +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Framework | ||
33 | { | ||
34 | public abstract class ConfigBase | ||
35 | { | ||
36 | protected ConfigurationMember m_configMember; | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index b70d1db..aab920b 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Framework.Console | |||
118 | // (Done with no echo and suitable for passwords) | 118 | // (Done with no echo and suitable for passwords) |
119 | public string PasswdPrompt(string p) | 119 | public string PasswdPrompt(string p) |
120 | { | 120 | { |
121 | return ReadLine(p, false, false); | 121 | return ReadLine(String.Format("{0}: ", p), false, false); |
122 | } | 122 | } |
123 | 123 | ||
124 | public virtual string ReadLine(string p, bool isCommand, bool e) | 124 | public virtual string ReadLine(string p, bool isCommand, bool e) |
diff --git a/OpenSim/Framework/FriendRegionInfo.cs b/OpenSim/Framework/FriendRegionInfo.cs deleted file mode 100644 index 68b5f3d..0000000 --- a/OpenSim/Framework/FriendRegionInfo.cs +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public class FriendRegionInfo | ||
33 | { | ||
34 | public bool isOnline; | ||
35 | public ulong regionHandle; | ||
36 | public UUID regionID; | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs deleted file mode 100644 index 3a43a14..0000000 --- a/OpenSim/Framework/GridConfig.cs +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public class GridConfig:ConfigBase | ||
33 | { | ||
34 | public string AllowForcefulBanlines = "TRUE"; | ||
35 | public bool AllowRegionRegistration = true; | ||
36 | public string AssetRecvKey = String.Empty; | ||
37 | public string AssetSendKey = String.Empty; | ||
38 | |||
39 | public string DatabaseProvider = String.Empty; | ||
40 | public string DatabaseConnect = String.Empty; | ||
41 | public string DefaultAssetServer = String.Empty; | ||
42 | public string DefaultUserServer = String.Empty; | ||
43 | public uint HttpPort = ConfigSettings.DefaultGridServerHttpPort; | ||
44 | public string SimRecvKey = String.Empty; | ||
45 | public string SimSendKey = String.Empty; | ||
46 | public string UserRecvKey = String.Empty; | ||
47 | public string UserSendKey = String.Empty; | ||
48 | public string ConsoleUser = String.Empty; | ||
49 | public string ConsolePass = String.Empty; | ||
50 | |||
51 | public GridConfig(string description, string filename) | ||
52 | { | ||
53 | m_configMember = | ||
54 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); | ||
55 | m_configMember.performConfigurationRetrieve(); | ||
56 | } | ||
57 | |||
58 | public void loadConfigurationOptions() | ||
59 | { | ||
60 | m_configMember.addConfigurationOption("default_asset_server", | ||
61 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
62 | "Default Asset Server URI", | ||
63 | "http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort.ToString() + "/", | ||
64 | false); | ||
65 | m_configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
66 | "Key to send to asset server", "null", false); | ||
67 | m_configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
68 | "Key to expect from asset server", "null", false); | ||
69 | |||
70 | m_configMember.addConfigurationOption("default_user_server", | ||
71 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
72 | "Default User Server URI", | ||
73 | "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString() + "/", false); | ||
74 | m_configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
75 | "Key to send to user server", "null", false); | ||
76 | m_configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
77 | "Key to expect from user server", "null", false); | ||
78 | |||
79 | m_configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
80 | "Key to send to a simulator", "null", false); | ||
81 | m_configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
82 | "Key to expect from a simulator", "null", false); | ||
83 | m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
84 | "DLL for database provider", "OpenSim.Data.MySQL.dll", false); | ||
85 | m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
86 | "Database connect string", "", false); | ||
87 | |||
88 | m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
89 | "Http Listener port", ConfigSettings.DefaultGridServerHttpPort.ToString(), false); | ||
90 | |||
91 | m_configMember.addConfigurationOption("allow_forceful_banlines", | ||
92 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
93 | "Allow Forceful Banlines", "TRUE", true); | ||
94 | |||
95 | m_configMember.addConfigurationOption("allow_region_registration", | ||
96 | ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
97 | "Allow regions to register immediately upon grid server startup? true/false", | ||
98 | "True", | ||
99 | false); | ||
100 | m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
101 | "Remote console access user name [Default: disabled]", "", false); | ||
102 | |||
103 | m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
104 | "Remote console access password [Default: disabled]", "", false); | ||
105 | |||
106 | } | ||
107 | |||
108 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
109 | { | ||
110 | switch (configuration_key) | ||
111 | { | ||
112 | case "default_asset_server": | ||
113 | DefaultAssetServer = (string) configuration_result; | ||
114 | break; | ||
115 | case "asset_send_key": | ||
116 | AssetSendKey = (string) configuration_result; | ||
117 | break; | ||
118 | case "asset_recv_key": | ||
119 | AssetRecvKey = (string) configuration_result; | ||
120 | break; | ||
121 | case "default_user_server": | ||
122 | DefaultUserServer = (string) configuration_result; | ||
123 | break; | ||
124 | case "user_send_key": | ||
125 | UserSendKey = (string) configuration_result; | ||
126 | break; | ||
127 | case "user_recv_key": | ||
128 | UserRecvKey = (string) configuration_result; | ||
129 | break; | ||
130 | case "sim_send_key": | ||
131 | SimSendKey = (string) configuration_result; | ||
132 | break; | ||
133 | case "sim_recv_key": | ||
134 | SimRecvKey = (string) configuration_result; | ||
135 | break; | ||
136 | case "database_provider": | ||
137 | DatabaseProvider = (string) configuration_result; | ||
138 | break; | ||
139 | case "database_connect": | ||
140 | DatabaseConnect = (string) configuration_result; | ||
141 | break; | ||
142 | case "http_port": | ||
143 | HttpPort = (uint) configuration_result; | ||
144 | break; | ||
145 | case "allow_forceful_banlines": | ||
146 | AllowForcefulBanlines = (string) configuration_result; | ||
147 | break; | ||
148 | case "allow_region_registration": | ||
149 | AllowRegionRegistration = (bool)configuration_result; | ||
150 | break; | ||
151 | case "console_user": | ||
152 | ConsoleUser = (string)configuration_result; | ||
153 | break; | ||
154 | case "console_pass": | ||
155 | ConsolePass = (string)configuration_result; | ||
156 | break; | ||
157 | } | ||
158 | |||
159 | return true; | ||
160 | } | ||
161 | } | ||
162 | } | ||
diff --git a/OpenSim/Framework/HGNetworkServersInfo.cs b/OpenSim/Framework/HGNetworkServersInfo.cs deleted file mode 100644 index 0865576..0000000 --- a/OpenSim/Framework/HGNetworkServersInfo.cs +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
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 | |||
28 | using System.Net; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public class HGNetworkServersInfo | ||
33 | { | ||
34 | |||
35 | public readonly string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI; | ||
36 | |||
37 | private static HGNetworkServersInfo m_singleton; | ||
38 | public static HGNetworkServersInfo Singleton | ||
39 | { | ||
40 | get { return m_singleton; } | ||
41 | } | ||
42 | |||
43 | public static void Init(string assetserver, string inventoryserver, string userserver) | ||
44 | { | ||
45 | m_singleton = new HGNetworkServersInfo(assetserver, inventoryserver, userserver); | ||
46 | |||
47 | } | ||
48 | |||
49 | private HGNetworkServersInfo(string a, string i, string u) | ||
50 | { | ||
51 | LocalAssetServerURI = ServerURI(a); | ||
52 | LocalInventoryServerURI = ServerURI(i); | ||
53 | LocalUserServerURI = ServerURI(u); | ||
54 | } | ||
55 | |||
56 | public bool IsLocalUser(string userserver) | ||
57 | { | ||
58 | string userServerURI = ServerURI(userserver); | ||
59 | bool ret = (((userServerURI == null) || (userServerURI == "") || (userServerURI == LocalUserServerURI))); | ||
60 | //m_log.Debug("-------------> HGNetworkServersInfo.IsLocalUser? " + ret + "(userServer=" + userServerURI + "; localuserserver=" + LocalUserServerURI + ")"); | ||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | public bool IsLocalUser(UserProfileData userData) | ||
65 | { | ||
66 | if (userData != null) | ||
67 | { | ||
68 | if (userData is ForeignUserProfileData) | ||
69 | return IsLocalUser(((ForeignUserProfileData)userData).UserServerURI); | ||
70 | else | ||
71 | return true; | ||
72 | } | ||
73 | else | ||
74 | // Something fishy; ignore it | ||
75 | return true; | ||
76 | } | ||
77 | |||
78 | public static string ServerURI(string uri) | ||
79 | { | ||
80 | // Get rid of eventual slashes at the end | ||
81 | try | ||
82 | { | ||
83 | if (uri.EndsWith("/")) | ||
84 | uri = uri.Substring(0, uri.Length - 1); | ||
85 | } | ||
86 | catch { } | ||
87 | |||
88 | IPAddress ipaddr1 = null; | ||
89 | string port1 = ""; | ||
90 | try | ||
91 | { | ||
92 | ipaddr1 = Util.GetHostFromURL(uri); | ||
93 | } | ||
94 | catch { } | ||
95 | |||
96 | try | ||
97 | { | ||
98 | port1 = uri.Split(new char[] { ':' })[2]; | ||
99 | } | ||
100 | catch { } | ||
101 | |||
102 | // We tried our best to convert the domain names to IP addresses | ||
103 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | ||
104 | } | ||
105 | |||
106 | } | ||
107 | } | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 556a532..db74548 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Framework | |||
57 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects); | 57 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects); |
58 | 58 | ||
59 | public delegate void ObjectAttach( | 59 | public delegate void ObjectAttach( |
60 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent); | 60 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); |
61 | 61 | ||
62 | public delegate void ModifyTerrain(UUID user, | 62 | public delegate void ModifyTerrain(UUID user, |
63 | float height, float seconds, byte size, byte action, float north, float west, float south, float east, | 63 | float height, float seconds, byte size, byte action, float north, float west, float south, float east, |
@@ -1017,7 +1017,6 @@ namespace OpenSim.Framework | |||
1017 | 1017 | ||
1018 | void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); | 1018 | void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); |
1019 | 1019 | ||
1020 | void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID); | ||
1021 | void SetChildAgentThrottle(byte[] throttle); | 1020 | void SetChildAgentThrottle(byte[] throttle); |
1022 | 1021 | ||
1023 | void SendAvatarDataImmediate(ISceneEntity avatar); | 1022 | void SendAvatarDataImmediate(ISceneEntity avatar); |
diff --git a/OpenSim/Framework/IClientFileTransfer.cs b/OpenSim/Framework/IClientFileTransfer.cs deleted file mode 100644 index f947b17..0000000 --- a/OpenSim/Framework/IClientFileTransfer.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public delegate void UploadComplete(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient); | ||
33 | public delegate void UploadAborted(string filename, UUID fileID, ulong transferID, IClientAPI remoteClient); | ||
34 | |||
35 | public interface IClientFileTransfer | ||
36 | { | ||
37 | bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback); | ||
38 | bool RequestUpload(UUID fileID, UploadComplete uploadCompleteCallback, UploadAborted abortCallback); | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs deleted file mode 100644 index 5a155c1..0000000 --- a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | public interface ILoginServiceToRegionsConnector | ||
34 | { | ||
35 | void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message); | ||
36 | bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason); | ||
37 | RegionInfo RequestClosestRegion(string region); | ||
38 | RegionInfo RequestNeighbourInfo(UUID regionID); | ||
39 | RegionInfo RequestNeighbourInfo(ulong regionhandle); | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 3480960..3d4873d 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs | |||
@@ -35,35 +35,15 @@ namespace OpenSim.Framework | |||
35 | bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, | 35 | bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, |
36 | int amount); | 36 | int amount); |
37 | 37 | ||
38 | int GetBalance(IClientAPI client); | 38 | int GetBalance(UUID agentID); |
39 | void ApplyUploadCharge(UUID agentID); | 39 | bool UploadCovered(IClientAPI client, int amount); |
40 | bool UploadCovered(IClientAPI client); | ||
41 | void ApplyGroupCreationCharge(UUID agentID); | ||
42 | bool GroupCreationCovered(IClientAPI client); | ||
43 | bool AmountCovered(IClientAPI client, int amount); | 40 | bool AmountCovered(IClientAPI client, int amount); |
44 | void ApplyCharge(UUID agentID, int amount, string text); | 41 | void ApplyCharge(UUID agentID, int amount, string text); |
42 | void ApplyUploadCharge(UUID agentID, int amount, string text); | ||
45 | 43 | ||
46 | EconomyData GetEconomyData(); | 44 | int UploadCharge { get; } |
45 | int GroupCreationCharge { get; } | ||
47 | 46 | ||
48 | event ObjectPaid OnObjectPaid; | 47 | event ObjectPaid OnObjectPaid; |
49 | } | 48 | } |
50 | |||
51 | public struct EconomyData | ||
52 | { | ||
53 | public int ObjectCapacity; | ||
54 | public int ObjectCount; | ||
55 | public int PriceEnergyUnit; | ||
56 | public int PriceGroupCreate; | ||
57 | public int PriceObjectClaim; | ||
58 | public float PriceObjectRent; | ||
59 | public float PriceObjectScaleFactor; | ||
60 | public int PriceParcelClaim; | ||
61 | public float PriceParcelClaimFactor; | ||
62 | public int PriceParcelRent; | ||
63 | public int PricePublicObjectDecay; | ||
64 | public int PricePublicObjectDelete; | ||
65 | public int PriceRentLight; | ||
66 | public int PriceUpload; | ||
67 | public int TeleportMinPrice; | ||
68 | } | ||
69 | } | 49 | } |
diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs deleted file mode 100644 index 884c0ea..0000000 --- a/OpenSim/Framework/MessageServerConfig.cs +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// Message Server Config - Configuration of the Message Server | ||
34 | /// </summary> | ||
35 | public class MessageServerConfig:ConfigBase | ||
36 | { | ||
37 | public string DatabaseProvider = String.Empty; | ||
38 | public string DatabaseConnect = String.Empty; | ||
39 | public string GridCommsProvider = String.Empty; | ||
40 | public string GridRecvKey = String.Empty; | ||
41 | public string GridSendKey = String.Empty; | ||
42 | public string GridServerURL = String.Empty; | ||
43 | public uint HttpPort = ConfigSettings.DefaultMessageServerHttpPort; | ||
44 | public bool HttpSSL = ConfigSettings.DefaultMessageServerHttpSSL; | ||
45 | public string MessageServerIP = String.Empty; | ||
46 | public string UserRecvKey = String.Empty; | ||
47 | public string UserSendKey = String.Empty; | ||
48 | public string UserServerURL = String.Empty; | ||
49 | public string ConsoleUser = String.Empty; | ||
50 | public string ConsolePass = String.Empty; | ||
51 | |||
52 | public MessageServerConfig(string description, string filename) | ||
53 | { | ||
54 | m_configMember = | ||
55 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); | ||
56 | m_configMember.performConfigurationRetrieve(); | ||
57 | } | ||
58 | |||
59 | public void loadConfigurationOptions() | ||
60 | { | ||
61 | m_configMember.addConfigurationOption("default_user_server", | ||
62 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
63 | "Default User Server URI", | ||
64 | "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString() + "/", false); | ||
65 | m_configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
66 | "Key to send to user server", "null", false); | ||
67 | m_configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
68 | "Key to expect from user server", "null", false); | ||
69 | m_configMember.addConfigurationOption("default_grid_server", | ||
70 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
71 | "Default Grid Server URI", | ||
72 | "http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort.ToString() + "/", false); | ||
73 | m_configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
74 | "Key to send to grid server", "null", false); | ||
75 | m_configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
76 | "Key to expect from grid server", "null", false); | ||
77 | |||
78 | m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
79 | "Connection String for Database", "", false); | ||
80 | |||
81 | m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
82 | "DLL for database provider", "OpenSim.Data.MySQL.dll", false); | ||
83 | |||
84 | m_configMember.addConfigurationOption("region_comms_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
85 | "DLL for comms provider", "OpenSim.Region.Communications.OGS1.dll", false); | ||
86 | |||
87 | m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
88 | "Http Listener port", ConfigSettings.DefaultMessageServerHttpPort.ToString(), false); | ||
89 | m_configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
90 | "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false); | ||
91 | m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
92 | "My Published IP Address", "127.0.0.1", false); | ||
93 | m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
94 | "Remote console access user name [Default: disabled]", "", false); | ||
95 | |||
96 | m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
97 | "Remote console access password [Default: disabled]", "", false); | ||
98 | |||
99 | } | ||
100 | |||
101 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
102 | { | ||
103 | switch (configuration_key) | ||
104 | { | ||
105 | case "default_user_server": | ||
106 | UserServerURL = (string) configuration_result; | ||
107 | break; | ||
108 | case "user_send_key": | ||
109 | UserSendKey = (string) configuration_result; | ||
110 | break; | ||
111 | case "user_recv_key": | ||
112 | UserRecvKey = (string) configuration_result; | ||
113 | break; | ||
114 | case "default_grid_server": | ||
115 | GridServerURL = (string) configuration_result; | ||
116 | break; | ||
117 | case "grid_send_key": | ||
118 | GridSendKey = (string) configuration_result; | ||
119 | break; | ||
120 | case "grid_recv_key": | ||
121 | GridRecvKey = (string) configuration_result; | ||
122 | break; | ||
123 | case "database_provider": | ||
124 | DatabaseProvider = (string) configuration_result; | ||
125 | break; | ||
126 | case "database_connect": | ||
127 | DatabaseConnect = (string)configuration_result; | ||
128 | break; | ||
129 | case "http_port": | ||
130 | HttpPort = (uint) configuration_result; | ||
131 | break; | ||
132 | case "http_ssl": | ||
133 | HttpSSL = (bool) configuration_result; | ||
134 | break; | ||
135 | case "region_comms_provider": | ||
136 | GridCommsProvider = (string) configuration_result; | ||
137 | break; | ||
138 | case "published_ip": | ||
139 | MessageServerIP = (string) configuration_result; | ||
140 | break; | ||
141 | case "console_user": | ||
142 | ConsoleUser = (string)configuration_result; | ||
143 | break; | ||
144 | case "console_pass": | ||
145 | ConsolePass = (string)configuration_result; | ||
146 | break; | ||
147 | } | ||
148 | |||
149 | return true; | ||
150 | } | ||
151 | } | ||
152 | } | ||
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs index 5fe343d..831ff70 100644 --- a/OpenSim/Framework/NetworkUtil.cs +++ b/OpenSim/Framework/NetworkUtil.cs | |||
@@ -31,6 +31,7 @@ using System.Net.Sockets; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.NetworkInformation; | 32 | using System.Net.NetworkInformation; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Text; | ||
34 | using log4net; | 35 | using log4net; |
35 | 36 | ||
36 | namespace OpenSim.Framework | 37 | namespace OpenSim.Framework |
@@ -180,10 +181,18 @@ namespace OpenSim.Framework | |||
180 | throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client"); | 181 | throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client"); |
181 | } | 182 | } |
182 | 183 | ||
184 | static IPAddress externalIPAddress; | ||
185 | |||
183 | static NetworkUtil() | 186 | static NetworkUtil() |
184 | { | 187 | { |
185 | try | 188 | try |
186 | { | 189 | { |
190 | externalIPAddress = GetExternalIP(); | ||
191 | } | ||
192 | catch { /* ignore */ } | ||
193 | |||
194 | try | ||
195 | { | ||
187 | foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) | 196 | foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) |
188 | { | 197 | { |
189 | foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) | 198 | foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) |
@@ -244,5 +253,80 @@ namespace OpenSim.Framework | |||
244 | } | 253 | } |
245 | return defaultHostname; | 254 | return defaultHostname; |
246 | } | 255 | } |
256 | |||
257 | public static IPAddress GetExternalIPOf(IPAddress user) | ||
258 | { | ||
259 | if (externalIPAddress == null) | ||
260 | return user; | ||
261 | |||
262 | if (user.ToString() == "127.0.0.1") | ||
263 | { | ||
264 | m_log.Info("[NetworkUtil] 127.0.0.1 user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); | ||
265 | return externalIPAddress; | ||
266 | } | ||
267 | // Check if we're accessing localhost. | ||
268 | foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName())) | ||
269 | { | ||
270 | if (host.Equals(user) && host.AddressFamily == AddressFamily.InterNetwork) | ||
271 | { | ||
272 | m_log.Info("[NetworkUtil] Localhost user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); | ||
273 | return externalIPAddress; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | // Check for same LAN segment | ||
278 | foreach (KeyValuePair<IPAddress, IPAddress> subnet in m_subnets) | ||
279 | { | ||
280 | byte[] subnetBytes = subnet.Value.GetAddressBytes(); | ||
281 | byte[] localBytes = subnet.Key.GetAddressBytes(); | ||
282 | byte[] destBytes = user.GetAddressBytes(); | ||
283 | |||
284 | if (subnetBytes.Length != destBytes.Length || subnetBytes.Length != localBytes.Length) | ||
285 | return user; | ||
286 | |||
287 | bool valid = true; | ||
288 | |||
289 | for (int i = 0; i < subnetBytes.Length; i++) | ||
290 | { | ||
291 | if ((localBytes[i] & subnetBytes[i]) != (destBytes[i] & subnetBytes[i])) | ||
292 | { | ||
293 | valid = false; | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | |||
298 | if (subnet.Key.AddressFamily != AddressFamily.InterNetwork) | ||
299 | valid = false; | ||
300 | |||
301 | if (valid) | ||
302 | { | ||
303 | m_log.Info("[NetworkUtil] Local LAN user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); | ||
304 | return externalIPAddress; | ||
305 | } | ||
306 | } | ||
307 | |||
308 | // Otherwise, return user address | ||
309 | return user; | ||
310 | } | ||
311 | |||
312 | private static IPAddress GetExternalIP() | ||
313 | { | ||
314 | string whatIsMyIp = "http://www.whatismyip.com/automation/n09230945.asp"; | ||
315 | WebClient wc = new WebClient(); | ||
316 | UTF8Encoding utf8 = new UTF8Encoding(); | ||
317 | string requestHtml = ""; | ||
318 | try | ||
319 | { | ||
320 | requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp)); | ||
321 | } | ||
322 | catch (WebException we) | ||
323 | { | ||
324 | m_log.Info("[NetworkUtil]: Exception in GetExternalIP: " + we.ToString()); | ||
325 | return null; | ||
326 | } | ||
327 | |||
328 | IPAddress externalIp = IPAddress.Parse(requestHtml); | ||
329 | return externalIp; | ||
330 | } | ||
247 | } | 331 | } |
248 | } | 332 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 1cc19c5..b91496b 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -73,7 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
73 | { | 73 | { |
74 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | 74 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
75 | { | 75 | { |
76 | StreamReader str = new StreamReader(req.Request.Body); | 76 | StreamReader str; |
77 | try | ||
78 | { | ||
79 | str = new StreamReader(req.Request.Body); | ||
80 | } | ||
81 | catch (System.ArgumentException) | ||
82 | { | ||
83 | // Stream was not readable means a child agent | ||
84 | // was closed due to logout, leaving the | ||
85 | // Event Queue request orphaned. | ||
86 | continue; | ||
87 | } | ||
77 | 88 | ||
78 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 89 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); |
79 | m_server.DoHTTPGruntWork(responsedata, | 90 | m_server.DoHTTPGruntWork(responsedata, |
@@ -106,4 +117,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
106 | m_request.Enqueue(pPollServiceHttpRequest); | 117 | m_request.Enqueue(pPollServiceHttpRequest); |
107 | } | 118 | } |
108 | } | 119 | } |
109 | } \ No newline at end of file | 120 | } |
diff --git a/OpenSim/Framework/Tests/ACLTest.cs b/OpenSim/Framework/Tests/ACLTest.cs deleted file mode 100644 index 06e860e..0000000 --- a/OpenSim/Framework/Tests/ACLTest.cs +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using NUnit.Framework; | ||
30 | using System.Collections.Generic; | ||
31 | |||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class ACLTest | ||
37 | { | ||
38 | #region Tests | ||
39 | |||
40 | /// <summary> | ||
41 | /// ACL Test class | ||
42 | /// </summary> | ||
43 | [Test] | ||
44 | public void ACLTest01() | ||
45 | { | ||
46 | ACL acl = new ACL(); | ||
47 | |||
48 | Role Guests = new Role("Guests"); | ||
49 | acl.AddRole(Guests); | ||
50 | |||
51 | Role[] parents = new Role[1]; | ||
52 | parents[0] = Guests; | ||
53 | |||
54 | Role JoeGuest = new Role("JoeGuest", parents); | ||
55 | acl.AddRole(JoeGuest); | ||
56 | |||
57 | Resource CanBuild = new Resource("CanBuild"); | ||
58 | acl.AddResource(CanBuild); | ||
59 | |||
60 | |||
61 | acl.GrantPermission("Guests", "CanBuild"); | ||
62 | |||
63 | Permission perm = acl.HasPermission("JoeGuest", "CanBuild"); | ||
64 | Assert.That(perm == Permission.Allow, "JoeGuest should have permission to build"); | ||
65 | perm = Permission.None; | ||
66 | try | ||
67 | { | ||
68 | perm = acl.HasPermission("unknownGuest", "CanBuild"); | ||
69 | |||
70 | } | ||
71 | catch (KeyNotFoundException) | ||
72 | { | ||
73 | |||
74 | |||
75 | } | ||
76 | catch (Exception) | ||
77 | { | ||
78 | Assert.That(false,"Exception thrown should have been KeyNotFoundException"); | ||
79 | } | ||
80 | Assert.That(perm == Permission.None,"Permission None should be set because exception should have been thrown"); | ||
81 | |||
82 | } | ||
83 | |||
84 | [Test] | ||
85 | public void KnownButPermissionDenyAndPermissionNoneUserTest() | ||
86 | { | ||
87 | ACL acl = new ACL(); | ||
88 | |||
89 | Role Guests = new Role("Guests"); | ||
90 | acl.AddRole(Guests); | ||
91 | Role Administrators = new Role("Administrators"); | ||
92 | acl.AddRole(Administrators); | ||
93 | Role[] Guestparents = new Role[1]; | ||
94 | Role[] Adminparents = new Role[1]; | ||
95 | |||
96 | Guestparents[0] = Guests; | ||
97 | Adminparents[0] = Administrators; | ||
98 | |||
99 | Role JoeGuest = new Role("JoeGuest", Guestparents); | ||
100 | acl.AddRole(JoeGuest); | ||
101 | |||
102 | Resource CanBuild = new Resource("CanBuild"); | ||
103 | acl.AddResource(CanBuild); | ||
104 | |||
105 | Resource CanScript = new Resource("CanScript"); | ||
106 | acl.AddResource(CanScript); | ||
107 | |||
108 | Resource CanRestart = new Resource("CanRestart"); | ||
109 | acl.AddResource(CanRestart); | ||
110 | |||
111 | acl.GrantPermission("Guests", "CanBuild"); | ||
112 | acl.DenyPermission("Guests", "CanRestart"); | ||
113 | |||
114 | acl.GrantPermission("Administrators", "CanScript"); | ||
115 | |||
116 | acl.GrantPermission("Administrators", "CanRestart"); | ||
117 | Permission setPermission = acl.HasPermission("JoeGuest", "CanRestart"); | ||
118 | Assert.That(setPermission == Permission.Deny, "Guests Should not be able to restart"); | ||
119 | Assert.That(acl.HasPermission("JoeGuest", "CanScript") == Permission.None, | ||
120 | "No Explicit Permissions set so should be Permission.None"); | ||
121 | } | ||
122 | |||
123 | #endregion | ||
124 | } | ||
125 | } | ||
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs deleted file mode 100644 index 0fa82cf..0000000 --- a/OpenSim/Framework/UserConfig.cs +++ /dev/null | |||
@@ -1,231 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// UserConfig -- For User Server Configuration | ||
35 | /// </summary> | ||
36 | public class UserConfig:ConfigBase | ||
37 | { | ||
38 | public string DatabaseProvider = String.Empty; | ||
39 | public string DatabaseConnect = String.Empty; | ||
40 | public string DefaultStartupMsg = String.Empty; | ||
41 | public uint DefaultX = 1000; | ||
42 | public uint DefaultY = 1000; | ||
43 | public string GridRecvKey = String.Empty; | ||
44 | public string GridSendKey = String.Empty; | ||
45 | public uint HttpPort = ConfigSettings.DefaultUserServerHttpPort; | ||
46 | public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL; | ||
47 | public uint DefaultUserLevel = 0; | ||
48 | public string LibraryXmlfile = ""; | ||
49 | public string ConsoleUser = String.Empty; | ||
50 | public string ConsolePass = String.Empty; | ||
51 | |||
52 | private Uri m_inventoryUrl; | ||
53 | |||
54 | public Uri InventoryUrl | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | return m_inventoryUrl; | ||
59 | } | ||
60 | set | ||
61 | { | ||
62 | m_inventoryUrl = value; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | private Uri m_authUrl; | ||
67 | public Uri AuthUrl | ||
68 | { | ||
69 | get | ||
70 | { | ||
71 | return m_authUrl; | ||
72 | } | ||
73 | set | ||
74 | { | ||
75 | m_authUrl = value; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | private Uri m_gridServerURL; | ||
80 | |||
81 | public Uri GridServerURL | ||
82 | { | ||
83 | get | ||
84 | { | ||
85 | return m_gridServerURL; | ||
86 | } | ||
87 | set | ||
88 | { | ||
89 | m_gridServerURL = value; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | public bool EnableLLSDLogin = true; | ||
94 | |||
95 | public bool EnableHGLogin = true; | ||
96 | |||
97 | public UserConfig() | ||
98 | { | ||
99 | // weird, but UserManagerBase needs this. | ||
100 | } | ||
101 | public UserConfig(string description, string filename) | ||
102 | { | ||
103 | m_configMember = | ||
104 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); | ||
105 | m_configMember.performConfigurationRetrieve(); | ||
106 | } | ||
107 | |||
108 | public void loadConfigurationOptions() | ||
109 | { | ||
110 | m_configMember.addConfigurationOption("default_startup_message", | ||
111 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
112 | "Default Startup Message", "Welcome to OGS", false); | ||
113 | |||
114 | m_configMember.addConfigurationOption("default_grid_server", | ||
115 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
116 | "Default Grid Server URI", | ||
117 | "http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort + "/", false); | ||
118 | m_configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
119 | "Key to send to grid server", "null", false); | ||
120 | m_configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
121 | "Key to expect from grid server", "null", false); | ||
122 | |||
123 | m_configMember.addConfigurationOption("default_inventory_server", | ||
124 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
125 | "Default Inventory Server URI", | ||
126 | "http://127.0.0.1:" + ConfigSettings.DefaultInventoryServerHttpPort + "/", | ||
127 | false); | ||
128 | m_configMember.addConfigurationOption("default_authentication_server", | ||
129 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
130 | "User Server (this) External URI for authentication keys", | ||
131 | "http://localhost:" + ConfigSettings.DefaultUserServerHttpPort + "/", | ||
132 | false); | ||
133 | m_configMember.addConfigurationOption("library_location", | ||
134 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
135 | "Path to library control file", | ||
136 | string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar), false); | ||
137 | |||
138 | m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
139 | "DLL for database provider", "OpenSim.Data.MySQL.dll", false); | ||
140 | m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
141 | "Connection String for Database", "", false); | ||
142 | |||
143 | m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
144 | "Http Listener port", ConfigSettings.DefaultUserServerHttpPort.ToString(), false); | ||
145 | m_configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
146 | "Use SSL? true/false", ConfigSettings.DefaultUserServerHttpSSL.ToString(), false); | ||
147 | m_configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
148 | "Known good region X", "1000", false); | ||
149 | m_configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
150 | "Known good region Y", "1000", false); | ||
151 | m_configMember.addConfigurationOption("enable_llsd_login", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
152 | "Enable LLSD login support [Currently used by libsl based clients/bots]? true/false", true.ToString(), false); | ||
153 | |||
154 | m_configMember.addConfigurationOption("enable_hg_login", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
155 | "Enable Hypergrid login support [Currently used by GridSurfer-proxied clients]? true/false", true.ToString(), false); | ||
156 | |||
157 | m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
158 | "Minimum Level a user should have to login [0 default]", "0", false); | ||
159 | |||
160 | m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
161 | "Remote console access user name [Default: disabled]", "", false); | ||
162 | |||
163 | m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
164 | "Remote console access password [Default: disabled]", "", false); | ||
165 | |||
166 | } | ||
167 | |||
168 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
169 | { | ||
170 | switch (configuration_key) | ||
171 | { | ||
172 | case "default_startup_message": | ||
173 | DefaultStartupMsg = (string) configuration_result; | ||
174 | break; | ||
175 | case "default_grid_server": | ||
176 | GridServerURL = new Uri((string) configuration_result); | ||
177 | break; | ||
178 | case "grid_send_key": | ||
179 | GridSendKey = (string) configuration_result; | ||
180 | break; | ||
181 | case "grid_recv_key": | ||
182 | GridRecvKey = (string) configuration_result; | ||
183 | break; | ||
184 | case "default_inventory_server": | ||
185 | InventoryUrl = new Uri((string) configuration_result); | ||
186 | break; | ||
187 | case "default_authentication_server": | ||
188 | AuthUrl = new Uri((string)configuration_result); | ||
189 | break; | ||
190 | case "database_provider": | ||
191 | DatabaseProvider = (string) configuration_result; | ||
192 | break; | ||
193 | case "database_connect": | ||
194 | DatabaseConnect = (string) configuration_result; | ||
195 | break; | ||
196 | case "http_port": | ||
197 | HttpPort = (uint) configuration_result; | ||
198 | break; | ||
199 | case "http_ssl": | ||
200 | HttpSSL = (bool) configuration_result; | ||
201 | break; | ||
202 | case "default_X": | ||
203 | DefaultX = (uint) configuration_result; | ||
204 | break; | ||
205 | case "default_Y": | ||
206 | DefaultY = (uint) configuration_result; | ||
207 | break; | ||
208 | case "enable_llsd_login": | ||
209 | EnableLLSDLogin = (bool)configuration_result; | ||
210 | break; | ||
211 | case "enable_hg_login": | ||
212 | EnableHGLogin = (bool)configuration_result; | ||
213 | break; | ||
214 | case "default_loginLevel": | ||
215 | DefaultUserLevel = (uint)configuration_result; | ||
216 | break; | ||
217 | case "library_location": | ||
218 | LibraryXmlfile = (string)configuration_result; | ||
219 | break; | ||
220 | case "console_user": | ||
221 | ConsoleUser = (string)configuration_result; | ||
222 | break; | ||
223 | case "console_pass": | ||
224 | ConsolePass = (string)configuration_result; | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | return true; | ||
229 | } | ||
230 | } | ||
231 | } | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index e20866e..d16f9bf 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -139,8 +139,9 @@ namespace OpenSim.Framework | |||
139 | request.ContentLength = requestData.Length; | 139 | request.ContentLength = requestData.Length; |
140 | request.ContentType = "application/x-www-form-urlencoded"; | 140 | request.ContentType = "application/x-www-form-urlencoded"; |
141 | 141 | ||
142 | using (Stream requestStream = request.GetRequestStream()) | 142 | Stream requestStream = request.GetRequestStream(); |
143 | requestStream.Write(requestData, 0, requestData.Length); | 143 | requestStream.Write(requestData, 0, requestData.Length); |
144 | requestStream.Close(); | ||
144 | 145 | ||
145 | using (WebResponse response = request.GetResponse()) | 146 | using (WebResponse response = request.GetResponse()) |
146 | { | 147 | { |
@@ -169,7 +170,7 @@ namespace OpenSim.Framework | |||
169 | } | 170 | } |
170 | catch (Exception ex) | 171 | catch (Exception ex) |
171 | { | 172 | { |
172 | m_log.Warn("POST to URL " + url + " failed: " + ex.Message); | 173 | m_log.Warn("POST to URL " + url + " failed: " + ex); |
173 | errorMessage = ex.Message; | 174 | errorMessage = ex.Message; |
174 | } | 175 | } |
175 | 176 | ||