diff options
Diffstat (limited to '')
13 files changed, 20 insertions, 1500 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index d6d5700..a82d25a 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -591,24 +591,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
591 | if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar | 591 | if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar |
592 | { | 592 | { |
593 | // no client supplied UUID: look it up... | 593 | // no client supplied UUID: look it up... |
594 | CachedUserInfo userInfo | 594 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
595 | = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails( | 595 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, masterFirst, masterLast); |
596 | masterFirst, masterLast); | 596 | if (null == account) |
597 | |||
598 | if (null == userInfo) | ||
599 | { | 597 | { |
600 | m_log.InfoFormat("master avatar does not exist, creating it"); | 598 | m_log.InfoFormat("master avatar does not exist, creating it"); |
601 | // ...or create new user | 599 | // ...or create new user |
602 | userID = m_app.CommunicationsManager.UserAdminService.AddUser( | ||
603 | masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY); | ||
604 | 600 | ||
605 | if (userID == UUID.Zero) | 601 | account = new UserAccount(scopeID, masterFirst, masterLast, ""); |
602 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); | ||
603 | if (success) | ||
604 | { | ||
605 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | ||
606 | (int)(region.RegionLocX * Constants.RegionSize), (int)(region.RegionLocY * Constants.RegionSize)); | ||
607 | |||
608 | m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
609 | } | ||
610 | else | ||
606 | throw new Exception(String.Format("failed to create new user {0} {1}", | 611 | throw new Exception(String.Format("failed to create new user {0} {1}", |
607 | masterFirst, masterLast)); | 612 | masterFirst, masterLast)); |
613 | |||
608 | } | 614 | } |
609 | else | 615 | else |
610 | { | 616 | { |
611 | userID = userInfo.UserProfile.ID; | 617 | userID = account.PrincipalID; |
612 | } | 618 | } |
613 | } | 619 | } |
614 | } | 620 | } |
@@ -2591,10 +2597,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2591 | 2597 | ||
2592 | foreach (UUID user in acl) | 2598 | foreach (UUID user in acl) |
2593 | { | 2599 | { |
2594 | CachedUserInfo udata = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user); | 2600 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2595 | if (udata != null) | 2601 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); |
2602 | if (account != null) | ||
2596 | { | 2603 | { |
2597 | users[user.ToString()] = udata.UserProfile.Name; | 2604 | users[user.ToString()] = account.FirstName + " " + account.LastName; |
2598 | } | 2605 | } |
2599 | } | 2606 | } |
2600 | 2607 | ||
diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs deleted file mode 100644 index 9075f15..0000000 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ /dev/null | |||
@@ -1,364 +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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using Nwc.XmlRpc; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using System.Reflection; | ||
36 | using System.Security.Authentication; | ||
37 | using log4net; | ||
38 | using Nini.Config; | ||
39 | using OpenMetaverse; | ||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Framework.Communications; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Region.Framework.Interfaces; | ||
44 | using OpenSim.Region.Framework.Scenes; | ||
45 | |||
46 | namespace OpenSim.Client.Linden | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// Handles login user (expect user) and logoff user messages from the remote LL login server | ||
50 | /// </summary> | ||
51 | public class LLProxyLoginModule : ISharedRegionModule | ||
52 | { | ||
53 | private uint m_port = 0; | ||
54 | |||
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | |||
57 | public LLProxyLoginModule(uint port) | ||
58 | { | ||
59 | m_log.DebugFormat("[CLIENT]: LLProxyLoginModule port {0}", port); | ||
60 | m_port = port; | ||
61 | } | ||
62 | |||
63 | protected bool RegionLoginsEnabled | ||
64 | { | ||
65 | get | ||
66 | { | ||
67 | if (m_firstScene != null) | ||
68 | { | ||
69 | return m_firstScene.SceneGridService.RegionLoginsEnabled; | ||
70 | } | ||
71 | else | ||
72 | { | ||
73 | return false; | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | |||
78 | protected List<Scene> m_scenes = new List<Scene>(); | ||
79 | protected Scene m_firstScene; | ||
80 | |||
81 | protected bool m_enabled = false; // Module is only enabled if running in grid mode | ||
82 | |||
83 | #region IRegionModule Members | ||
84 | |||
85 | public void Initialise(IConfigSource source) | ||
86 | { | ||
87 | IConfig startupConfig = source.Configs["Modules"]; | ||
88 | if (startupConfig != null) | ||
89 | { | ||
90 | m_enabled = startupConfig.GetBoolean("LLProxyLoginModule", false); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public void AddRegion(Scene scene) | ||
95 | { | ||
96 | if (m_firstScene == null) | ||
97 | { | ||
98 | m_firstScene = scene; | ||
99 | |||
100 | if (m_enabled) | ||
101 | { | ||
102 | AddHttpHandlers(); | ||
103 | } | ||
104 | } | ||
105 | |||
106 | if (m_enabled) | ||
107 | { | ||
108 | AddScene(scene); | ||
109 | } | ||
110 | |||
111 | } | ||
112 | |||
113 | public void RemoveRegion(Scene scene) | ||
114 | { | ||
115 | if (m_enabled) | ||
116 | { | ||
117 | RemoveScene(scene); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | public void PostInitialise() | ||
122 | { | ||
123 | |||
124 | } | ||
125 | |||
126 | public void Close() | ||
127 | { | ||
128 | |||
129 | } | ||
130 | |||
131 | public void RegionLoaded(Scene scene) | ||
132 | { | ||
133 | |||
134 | } | ||
135 | |||
136 | public Type ReplaceableInterface | ||
137 | { | ||
138 | get { return null; } | ||
139 | } | ||
140 | |||
141 | public string Name | ||
142 | { | ||
143 | get { return "LLProxyLoginModule"; } | ||
144 | } | ||
145 | |||
146 | public bool IsSharedModule | ||
147 | { | ||
148 | get { return true; } | ||
149 | } | ||
150 | |||
151 | #endregion | ||
152 | |||
153 | /// <summary> | ||
154 | /// Adds "expect_user" and "logoff_user" xmlrpc method handlers | ||
155 | /// </summary> | ||
156 | protected void AddHttpHandlers() | ||
157 | { | ||
158 | //we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change? | ||
159 | MainServer.GetHttpServer(m_port).AddXmlRPCHandler("expect_user", ExpectUser, false); | ||
160 | MainServer.GetHttpServer(m_port).AddXmlRPCHandler("logoff_user", LogOffUser, false); | ||
161 | } | ||
162 | |||
163 | protected void AddScene(Scene scene) | ||
164 | { | ||
165 | lock (m_scenes) | ||
166 | { | ||
167 | if (!m_scenes.Contains(scene)) | ||
168 | { | ||
169 | m_scenes.Add(scene); | ||
170 | } | ||
171 | } | ||
172 | } | ||
173 | |||
174 | protected void RemoveScene(Scene scene) | ||
175 | { | ||
176 | lock (m_scenes) | ||
177 | { | ||
178 | if (m_scenes.Contains(scene)) | ||
179 | { | ||
180 | m_scenes.Remove(scene); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | /// <summary> | ||
185 | /// Received from the user server when a user starts logging in. This call allows | ||
186 | /// the region to prepare for direct communication from the client. Sends back an empty | ||
187 | /// xmlrpc response on completion. | ||
188 | /// </summary> | ||
189 | /// <param name="request"></param> | ||
190 | /// <returns></returns> | ||
191 | public XmlRpcResponse ExpectUser(XmlRpcRequest request, IPEndPoint remoteClient) | ||
192 | { | ||
193 | XmlRpcResponse resp = new XmlRpcResponse(); | ||
194 | |||
195 | try | ||
196 | { | ||
197 | ulong regionHandle = 0; | ||
198 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
199 | AgentCircuitData agentData = new AgentCircuitData(); | ||
200 | if (requestData.ContainsKey("session_id")) | ||
201 | agentData.SessionID = new UUID((string)requestData["session_id"]); | ||
202 | if (requestData.ContainsKey("secure_session_id")) | ||
203 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); | ||
204 | if (requestData.ContainsKey("firstname")) | ||
205 | agentData.firstname = (string)requestData["firstname"]; | ||
206 | if (requestData.ContainsKey("lastname")) | ||
207 | agentData.lastname = (string)requestData["lastname"]; | ||
208 | if (requestData.ContainsKey("agent_id")) | ||
209 | agentData.AgentID = new UUID((string)requestData["agent_id"]); | ||
210 | if (requestData.ContainsKey("circuit_code")) | ||
211 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
212 | if (requestData.ContainsKey("caps_path")) | ||
213 | agentData.CapsPath = (string)requestData["caps_path"]; | ||
214 | if (requestData.ContainsKey("regionhandle")) | ||
215 | regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
216 | else | ||
217 | m_log.Warn("[CLIENT]: request from login server did not contain regionhandle"); | ||
218 | |||
219 | // Appearance | ||
220 | if (requestData.ContainsKey("appearance")) | ||
221 | agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]); | ||
222 | |||
223 | m_log.DebugFormat( | ||
224 | "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", | ||
225 | agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); | ||
226 | |||
227 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
228 | { | ||
229 | //m_log.Debug("[CLIENT]: Child agent detected"); | ||
230 | agentData.child = true; | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | //m_log.Debug("[CLIENT]: Main agent detected"); | ||
235 | agentData.startpos = | ||
236 | new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), | ||
237 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), | ||
238 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); | ||
239 | agentData.child = false; | ||
240 | } | ||
241 | |||
242 | if (!RegionLoginsEnabled) | ||
243 | { | ||
244 | m_log.InfoFormat( | ||
245 | "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", | ||
246 | agentData.firstname, agentData.lastname); | ||
247 | |||
248 | Hashtable respdata = new Hashtable(); | ||
249 | respdata["success"] = "FALSE"; | ||
250 | respdata["reason"] = "region login currently disabled"; | ||
251 | resp.Value = respdata; | ||
252 | } | ||
253 | else | ||
254 | { | ||
255 | bool success = false; | ||
256 | string denyMess = ""; | ||
257 | |||
258 | Scene scene; | ||
259 | if (TryGetRegion(regionHandle, out scene)) | ||
260 | { | ||
261 | if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) | ||
262 | { | ||
263 | denyMess = "User is banned from this region"; | ||
264 | m_log.InfoFormat( | ||
265 | "[CLIENT]: Denying access for user {0} {1} because user is banned", | ||
266 | agentData.firstname, agentData.lastname); | ||
267 | } | ||
268 | else | ||
269 | { | ||
270 | string reason; | ||
271 | if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) | ||
272 | { | ||
273 | success = true; | ||
274 | } | ||
275 | else | ||
276 | { | ||
277 | denyMess = String.Format("Login refused by region: {0}", reason); | ||
278 | m_log.InfoFormat( | ||
279 | "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", | ||
280 | agentData.firstname, agentData.lastname); | ||
281 | } | ||
282 | } | ||
283 | |||
284 | } | ||
285 | else | ||
286 | { | ||
287 | denyMess = "Region not found"; | ||
288 | } | ||
289 | |||
290 | if (success) | ||
291 | { | ||
292 | Hashtable respdata = new Hashtable(); | ||
293 | respdata["success"] = "TRUE"; | ||
294 | resp.Value = respdata; | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | Hashtable respdata = new Hashtable(); | ||
299 | respdata["success"] = "FALSE"; | ||
300 | respdata["reason"] = denyMess; | ||
301 | resp.Value = respdata; | ||
302 | } | ||
303 | } | ||
304 | } | ||
305 | catch (Exception e) | ||
306 | { | ||
307 | m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0} ({1})", e, e.StackTrace); | ||
308 | Hashtable respdata = new Hashtable(); | ||
309 | respdata["success"] = "FALSE"; | ||
310 | respdata["reason"] = "Exception occurred"; | ||
311 | resp.Value = respdata; | ||
312 | } | ||
313 | |||
314 | return resp; | ||
315 | } | ||
316 | |||
317 | // Grid Request Processing | ||
318 | /// <summary> | ||
319 | /// Ooops, our Agent must be dead if we're getting this request! | ||
320 | /// </summary> | ||
321 | /// <param name="request"></param> | ||
322 | /// <returns></returns> | ||
323 | public XmlRpcResponse LogOffUser(XmlRpcRequest request, IPEndPoint remoteClient) | ||
324 | { | ||
325 | m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called"); | ||
326 | |||
327 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
328 | string message = (string)requestData["message"]; | ||
329 | UUID agentID = UUID.Zero; | ||
330 | UUID RegionSecret = UUID.Zero; | ||
331 | UUID.TryParse((string)requestData["agent_id"], out agentID); | ||
332 | UUID.TryParse((string)requestData["region_secret"], out RegionSecret); | ||
333 | |||
334 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
335 | |||
336 | Scene scene; | ||
337 | if (TryGetRegion(regionHandle, out scene)) | ||
338 | { | ||
339 | scene.HandleLogOffUserFromGrid(agentID, RegionSecret, message); | ||
340 | } | ||
341 | |||
342 | return new XmlRpcResponse(); | ||
343 | } | ||
344 | |||
345 | protected bool TryGetRegion(ulong regionHandle, out Scene scene) | ||
346 | { | ||
347 | lock (m_scenes) | ||
348 | { | ||
349 | foreach (Scene nextScene in m_scenes) | ||
350 | { | ||
351 | if (nextScene.RegionInfo.RegionHandle == regionHandle) | ||
352 | { | ||
353 | scene = nextScene; | ||
354 | return true; | ||
355 | } | ||
356 | } | ||
357 | } | ||
358 | |||
359 | scene = null; | ||
360 | return false; | ||
361 | } | ||
362 | |||
363 | } | ||
364 | } | ||
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs deleted file mode 100644 index 8047f74..0000000 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ /dev/null | |||
@@ -1,305 +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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Framework.Communications.Cache; | ||
40 | using OpenSim.Framework.Capabilities; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Region.Framework.Interfaces; | ||
44 | |||
45 | namespace OpenSim.Client.Linden | ||
46 | { | ||
47 | public class LLStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector | ||
48 | { | ||
49 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | protected List<Scene> m_scenes = new List<Scene>(); | ||
52 | protected Scene m_firstScene; | ||
53 | |||
54 | protected bool m_enabled = false; // Module is only enabled if running in standalone mode | ||
55 | |||
56 | protected bool authenticate; | ||
57 | protected string welcomeMessage; | ||
58 | |||
59 | public bool RegionLoginsEnabled | ||
60 | { | ||
61 | get | ||
62 | { | ||
63 | if (m_firstScene != null) | ||
64 | { | ||
65 | return m_firstScene.SceneGridService.RegionLoginsEnabled; | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | return false; | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | protected LLStandaloneLoginService m_loginService; | ||
75 | |||
76 | #region IRegionModule Members | ||
77 | |||
78 | public void Initialise(IConfigSource source) | ||
79 | { | ||
80 | IConfig startupConfig = source.Configs["Startup"]; | ||
81 | if (startupConfig != null) | ||
82 | { | ||
83 | m_enabled = !startupConfig.GetBoolean("gridmode", false); | ||
84 | } | ||
85 | |||
86 | if (m_enabled) | ||
87 | { | ||
88 | authenticate = true; | ||
89 | welcomeMessage = "Welcome to OpenSim"; | ||
90 | IConfig standaloneConfig = source.Configs["StandAlone"]; | ||
91 | if (standaloneConfig != null) | ||
92 | { | ||
93 | authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true); | ||
94 | welcomeMessage = standaloneConfig.GetString("welcome_message"); | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | |||
99 | public void AddRegion(Scene scene) | ||
100 | { | ||
101 | } | ||
102 | |||
103 | public void RemoveRegion(Scene scene) | ||
104 | { | ||
105 | if (m_enabled) | ||
106 | { | ||
107 | RemoveScene(scene); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | public void PostInitialise() | ||
112 | { | ||
113 | |||
114 | } | ||
115 | |||
116 | public void Close() | ||
117 | { | ||
118 | |||
119 | } | ||
120 | |||
121 | public void RegionLoaded(Scene scene) | ||
122 | { | ||
123 | if (m_firstScene == null) | ||
124 | { | ||
125 | m_firstScene = scene; | ||
126 | |||
127 | if (m_enabled) | ||
128 | { | ||
129 | //TODO: fix casting. | ||
130 | LibraryRootFolder rootFolder | ||
131 | = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; | ||
132 | |||
133 | IHttpServer httpServer = MainServer.Instance; | ||
134 | |||
135 | //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference | ||
136 | m_loginService | ||
137 | = new LLStandaloneLoginService( | ||
138 | (UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage, | ||
139 | m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, | ||
140 | rootFolder, this); | ||
141 | |||
142 | httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | ||
143 | |||
144 | // provides the web form login | ||
145 | httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); | ||
146 | |||
147 | // Provides the LLSD login | ||
148 | httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | if (m_enabled) | ||
153 | { | ||
154 | AddScene(scene); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | public Type ReplaceableInterface | ||
159 | { | ||
160 | get { return null; } | ||
161 | } | ||
162 | |||
163 | public string Name | ||
164 | { | ||
165 | get { return "LLStandaloneLoginModule"; } | ||
166 | } | ||
167 | |||
168 | public bool IsSharedModule | ||
169 | { | ||
170 | get { return true; } | ||
171 | } | ||
172 | |||
173 | #endregion | ||
174 | |||
175 | protected void AddScene(Scene scene) | ||
176 | { | ||
177 | lock (m_scenes) | ||
178 | { | ||
179 | if (!m_scenes.Contains(scene)) | ||
180 | { | ||
181 | m_scenes.Add(scene); | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | |||
186 | protected void RemoveScene(Scene scene) | ||
187 | { | ||
188 | lock (m_scenes) | ||
189 | { | ||
190 | if (m_scenes.Contains(scene)) | ||
191 | { | ||
192 | m_scenes.Remove(scene); | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | |||
197 | public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason) | ||
198 | { | ||
199 | Scene scene; | ||
200 | if (TryGetRegion(regionHandle, out scene)) | ||
201 | { | ||
202 | return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); | ||
203 | } | ||
204 | reason = "Region not found."; | ||
205 | return false; | ||
206 | } | ||
207 | |||
208 | public void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message) | ||
209 | { | ||
210 | Scene scene; | ||
211 | if (TryGetRegion(regionHandle, out scene)) | ||
212 | { | ||
213 | scene.HandleLogOffUserFromGrid(AvatarID, RegionSecret, message); | ||
214 | } | ||
215 | } | ||
216 | |||
217 | public RegionInfo RequestNeighbourInfo(ulong regionhandle) | ||
218 | { | ||
219 | Scene scene; | ||
220 | if (TryGetRegion(regionhandle, out scene)) | ||
221 | { | ||
222 | return scene.RegionInfo; | ||
223 | } | ||
224 | return null; | ||
225 | } | ||
226 | |||
227 | public RegionInfo RequestClosestRegion(string region) | ||
228 | { | ||
229 | Scene scene; | ||
230 | if (TryGetRegion(region, out scene)) | ||
231 | { | ||
232 | return scene.RegionInfo; | ||
233 | } | ||
234 | else if (m_scenes.Count > 0) | ||
235 | { | ||
236 | return m_scenes[0].RegionInfo; | ||
237 | } | ||
238 | return null; | ||
239 | } | ||
240 | |||
241 | public RegionInfo RequestNeighbourInfo(UUID regionID) | ||
242 | { | ||
243 | Scene scene; | ||
244 | if (TryGetRegion(regionID, out scene)) | ||
245 | { | ||
246 | return scene.RegionInfo; | ||
247 | } | ||
248 | return null; | ||
249 | } | ||
250 | |||
251 | protected bool TryGetRegion(ulong regionHandle, out Scene scene) | ||
252 | { | ||
253 | lock (m_scenes) | ||
254 | { | ||
255 | foreach (Scene nextScene in m_scenes) | ||
256 | { | ||
257 | if (nextScene.RegionInfo.RegionHandle == regionHandle) | ||
258 | { | ||
259 | scene = nextScene; | ||
260 | return true; | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | |||
265 | scene = null; | ||
266 | return false; | ||
267 | } | ||
268 | |||
269 | protected bool TryGetRegion(UUID regionID, out Scene scene) | ||
270 | { | ||
271 | lock (m_scenes) | ||
272 | { | ||
273 | foreach (Scene nextScene in m_scenes) | ||
274 | { | ||
275 | if (nextScene.RegionInfo.RegionID == regionID) | ||
276 | { | ||
277 | scene = nextScene; | ||
278 | return true; | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | |||
283 | scene = null; | ||
284 | return false; | ||
285 | } | ||
286 | |||
287 | protected bool TryGetRegion(string regionName, out Scene scene) | ||
288 | { | ||
289 | lock (m_scenes) | ||
290 | { | ||
291 | foreach (Scene nextScene in m_scenes) | ||
292 | { | ||
293 | if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase)) | ||
294 | { | ||
295 | scene = nextScene; | ||
296 | return true; | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | |||
301 | scene = null; | ||
302 | return false; | ||
303 | } | ||
304 | } | ||
305 | } | ||
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs deleted file mode 100644 index a975fa2..0000000 --- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs +++ /dev/null | |||
@@ -1,245 +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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Framework.Communications.Services; | ||
40 | using LoginResponse = OpenSim.Framework.Communications.Services.LoginResponse; | ||
41 | using OpenSim.Framework.Communications.Cache; | ||
42 | using OpenSim.Framework.Capabilities; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using OpenSim.Region.Framework.Scenes; | ||
45 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | |||
48 | namespace OpenSim.Client.Linden | ||
49 | { | ||
50 | public class LLStandaloneLoginService : LoginService | ||
51 | { | ||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | protected NetworkServersInfo m_serversInfo; | ||
55 | protected bool m_authUsers = false; | ||
56 | |||
57 | /// <summary> | ||
58 | /// Used to make requests to the local regions. | ||
59 | /// </summary> | ||
60 | protected ILoginServiceToRegionsConnector m_regionsConnector; | ||
61 | |||
62 | public LLStandaloneLoginService( | ||
63 | UserManagerBase userManager, string welcomeMess, | ||
64 | IInventoryService interServiceInventoryService, | ||
65 | NetworkServersInfo serversInfo, | ||
66 | bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector) | ||
67 | : base(userManager, libraryRootFolder, welcomeMess) | ||
68 | { | ||
69 | this.m_serversInfo = serversInfo; | ||
70 | m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX; | ||
71 | m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY; | ||
72 | m_authUsers = authenticate; | ||
73 | |||
74 | m_InventoryService = interServiceInventoryService; | ||
75 | m_regionsConnector = regionsConnector; | ||
76 | // Standard behavior: In StandAlone, silent logout of last hung session | ||
77 | m_warn_already_logged = false; | ||
78 | } | ||
79 | |||
80 | public override UserProfileData GetTheUser(string firstname, string lastname) | ||
81 | { | ||
82 | UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname); | ||
83 | if (profile != null) | ||
84 | { | ||
85 | return profile; | ||
86 | } | ||
87 | |||
88 | if (!m_authUsers) | ||
89 | { | ||
90 | //no current user account so make one | ||
91 | m_log.Info("[LOGIN]: No user account found so creating a new one."); | ||
92 | |||
93 | m_userManager.AddUser(firstname, lastname, "test", "", m_defaultHomeX, m_defaultHomeY); | ||
94 | |||
95 | return m_userManager.GetUserProfile(firstname, lastname); | ||
96 | } | ||
97 | |||
98 | return null; | ||
99 | } | ||
100 | |||
101 | public override bool AuthenticateUser(UserProfileData profile, string password) | ||
102 | { | ||
103 | if (!m_authUsers) | ||
104 | { | ||
105 | //for now we will accept any password in sandbox mode | ||
106 | m_log.Info("[LOGIN]: Authorising user (no actual password check)"); | ||
107 | |||
108 | return true; | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | m_log.Info( | ||
113 | "[LOGIN]: Authenticating " + profile.FirstName + " " + profile.SurName); | ||
114 | |||
115 | if (!password.StartsWith("$1$")) | ||
116 | password = "$1$" + Util.Md5Hash(password); | ||
117 | |||
118 | password = password.Remove(0, 3); //remove $1$ | ||
119 | |||
120 | string s = Util.Md5Hash(password + ":" + profile.PasswordSalt); | ||
121 | |||
122 | bool loginresult = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) | ||
123 | || profile.PasswordHash.Equals(password, StringComparison.InvariantCulture)); | ||
124 | return loginresult; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | protected override RegionInfo RequestClosestRegion(string region) | ||
129 | { | ||
130 | return m_regionsConnector.RequestClosestRegion(region); | ||
131 | } | ||
132 | |||
133 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) | ||
134 | { | ||
135 | return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle); | ||
136 | } | ||
137 | |||
138 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) | ||
139 | { | ||
140 | return m_regionsConnector.RequestNeighbourInfo(homeRegionId); | ||
141 | } | ||
142 | |||
143 | protected override bool PrepareLoginToRegion( | ||
144 | RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) | ||
145 | { | ||
146 | IPEndPoint endPoint = regionInfo.ExternalEndPoint; | ||
147 | response.SimAddress = endPoint.Address.ToString(); | ||
148 | response.SimPort = (uint)endPoint.Port; | ||
149 | response.RegionX = regionInfo.RegionLocX; | ||
150 | response.RegionY = regionInfo.RegionLocY; | ||
151 | |||
152 | string capsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
153 | string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath); | ||
154 | |||
155 | // Don't use the following! It Fails for logging into any region not on the same port as the http server! | ||
156 | // Kept here so it doesn't happen again! | ||
157 | // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; | ||
158 | |||
159 | string seedcap = "http://"; | ||
160 | |||
161 | if (m_serversInfo.HttpUsesSSL) | ||
162 | { | ||
163 | // For NAT | ||
164 | string host = NetworkUtil.GetHostFor(remoteClient.Address, m_serversInfo.HttpSSLCN); | ||
165 | |||
166 | seedcap = "https://" + host + ":" + m_serversInfo.httpSSLPort + capsSeedPath; | ||
167 | } | ||
168 | else | ||
169 | { | ||
170 | // For NAT | ||
171 | string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ExternalHostName); | ||
172 | |||
173 | seedcap = "http://" + host + ":" + m_serversInfo.HttpListenerPort + capsSeedPath; | ||
174 | } | ||
175 | |||
176 | response.SeedCapability = seedcap; | ||
177 | |||
178 | // Notify the target of an incoming user | ||
179 | m_log.InfoFormat( | ||
180 | "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", | ||
181 | regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI); | ||
182 | |||
183 | // Update agent with target sim | ||
184 | user.CurrentAgent.Region = regionInfo.RegionID; | ||
185 | user.CurrentAgent.Handle = regionInfo.RegionHandle; | ||
186 | |||
187 | AgentCircuitData agent = new AgentCircuitData(); | ||
188 | agent.AgentID = user.ID; | ||
189 | agent.firstname = user.FirstName; | ||
190 | agent.lastname = user.SurName; | ||
191 | agent.SessionID = user.CurrentAgent.SessionID; | ||
192 | agent.SecureSessionID = user.CurrentAgent.SecureSessionID; | ||
193 | agent.circuitcode = Convert.ToUInt32(response.CircuitCode); | ||
194 | agent.BaseFolder = UUID.Zero; | ||
195 | agent.InventoryFolder = UUID.Zero; | ||
196 | agent.startpos = user.CurrentAgent.Position; | ||
197 | agent.CapsPath = capsPath; | ||
198 | agent.Appearance = m_userManager.GetUserAppearance(user.ID); | ||
199 | if (agent.Appearance == null) | ||
200 | { | ||
201 | m_log.WarnFormat( | ||
202 | "[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname); | ||
203 | agent.Appearance = new AvatarAppearance(agent.AgentID); | ||
204 | } | ||
205 | |||
206 | if (m_regionsConnector.RegionLoginsEnabled) | ||
207 | { | ||
208 | string reason; | ||
209 | bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); | ||
210 | if (!success) | ||
211 | { | ||
212 | response.ErrorReason = "key"; | ||
213 | response.ErrorMessage = reason; | ||
214 | } | ||
215 | return success; | ||
216 | // return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); | ||
217 | } | ||
218 | |||
219 | return false; | ||
220 | } | ||
221 | |||
222 | public override void LogOffUser(UserProfileData theUser, string message) | ||
223 | { | ||
224 | RegionInfo SimInfo; | ||
225 | try | ||
226 | { | ||
227 | SimInfo = this.m_regionsConnector.RequestNeighbourInfo(theUser.CurrentAgent.Handle); | ||
228 | |||
229 | if (SimInfo == null) | ||
230 | { | ||
231 | m_log.Error("[LOCAL LOGIN]: Region user was in isn't currently logged in"); | ||
232 | return; | ||
233 | } | ||
234 | } | ||
235 | catch (Exception) | ||
236 | { | ||
237 | m_log.Error("[LOCAL LOGIN]: Unable to look up region to log user off"); | ||
238 | return; | ||
239 | } | ||
240 | |||
241 | m_regionsConnector.LogOffUserFromGrid( | ||
242 | SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off"); | ||
243 | } | ||
244 | } | ||
245 | } | ||
diff --git a/OpenSim/Client/Linden/Resources/LindenModules.addin.xml b/OpenSim/Client/Linden/Resources/LindenModules.addin.xml index a07a00f..af41e98 100644 --- a/OpenSim/Client/Linden/Resources/LindenModules.addin.xml +++ b/OpenSim/Client/Linden/Resources/LindenModules.addin.xml | |||
@@ -8,10 +8,6 @@ | |||
8 | </Dependencies> | 8 | </Dependencies> |
9 | 9 | ||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <!-- | ||
12 | <RegionModule id="LLStandaloneLoginModule" type="OpenSim.Client.Linden.LLStandaloneLoginModule" /> | ||
13 | <RegionModule id="LLProxyLoginModule" type="OpenSim.Client.Linden.LLProxyLoginModule" /> | ||
14 | --> | ||
15 | <RegionModule id="LLClientStackModule" type="OpenSim.Client.Linden.LLClientStackModule" /> | 11 | <RegionModule id="LLClientStackModule" type="OpenSim.Client.Linden.LLClientStackModule" /> |
16 | </Extension> | 12 | </Extension> |
17 | </Addin> | 13 | </Addin> |
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 4bf9018..52f6202 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -53,13 +53,6 @@ namespace OpenSim.Framework.Communications | |||
53 | } | 53 | } |
54 | protected IUserService m_userService; | 54 | protected IUserService m_userService; |
55 | 55 | ||
56 | public IMessagingService MessageService | ||
57 | { | ||
58 | get { return m_messageService; } | ||
59 | } | ||
60 | protected IMessagingService m_messageService; | ||
61 | |||
62 | |||
63 | public UserProfileCacheService UserProfileCacheService | 56 | public UserProfileCacheService UserProfileCacheService |
64 | { | 57 | { |
65 | get { return m_userProfileCacheService; } | 58 | get { return m_userProfileCacheService; } |
@@ -105,18 +98,6 @@ namespace OpenSim.Framework.Communications | |||
105 | } | 98 | } |
106 | 99 | ||
107 | 100 | ||
108 | #region Friend Methods | ||
109 | |||
110 | /// <summary> | ||
111 | /// Adds a new friend to the database for XUser | ||
112 | /// </summary> | ||
113 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | ||
114 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | ||
115 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
116 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
117 | { | ||
118 | m_userService.AddNewUserFriend(friendlistowner, friend, perms); | ||
119 | } | ||
120 | 101 | ||
121 | /// <summary> | 102 | /// <summary> |
122 | /// Logs off a user and does the appropriate communications | 103 | /// Logs off a user and does the appropriate communications |
@@ -145,42 +126,6 @@ namespace OpenSim.Framework.Communications | |||
145 | m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | 126 | m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); |
146 | } | 127 | } |
147 | 128 | ||
148 | /// <summary> | ||
149 | /// Delete friend on friendlistowner's friendlist. | ||
150 | /// </summary> | ||
151 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
152 | /// <param name="friend">The Ex-friend agent</param> | ||
153 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
154 | { | ||
155 | m_userService.RemoveUserFriend(friendlistowner, friend); | ||
156 | } | ||
157 | |||
158 | /// <summary> | ||
159 | /// Update permissions for friend on friendlistowner's friendlist. | ||
160 | /// </summary> | ||
161 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
162 | /// <param name="friend">The agent that is getting or loosing permissions</param> | ||
163 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
164 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
165 | { | ||
166 | m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
167 | } | ||
168 | |||
169 | /// <summary> | ||
170 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner | ||
171 | /// </summary> | ||
172 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | ||
173 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
174 | { | ||
175 | return m_userService.GetUserFriendList(friendlistowner); | ||
176 | } | ||
177 | |||
178 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
179 | { | ||
180 | return m_messageService.GetFriendRegionInfos(uuids); | ||
181 | } | ||
182 | |||
183 | #endregion | ||
184 | 129 | ||
185 | #region Packet Handlers | 130 | #region Packet Handlers |
186 | 131 | ||
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs deleted file mode 100644 index 60f0ba8..0000000 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ /dev/null | |||
@@ -1,461 +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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using NUnit.Framework; | ||
34 | using NUnit.Framework.SyntaxHelpers; | ||
35 | using Nwc.XmlRpc; | ||
36 | using OpenSim.Framework.Communications.Cache; | ||
37 | using OpenSim.Framework.Communications.Services; | ||
38 | using OpenSim.Region.Communications.Local; | ||
39 | using OpenSim.Tests.Common.Setup; | ||
40 | using OpenSim.Tests.Common.Mock; | ||
41 | using OpenSim.Client.Linden; | ||
42 | using OpenSim.Tests.Common; | ||
43 | using OpenSim.Services.Interfaces; | ||
44 | using OpenMetaverse; | ||
45 | |||
46 | namespace OpenSim.Framework.Communications.Tests | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// Test the login service. For now, most of this will be done through the LocalLoginService as LoginService | ||
50 | /// is abstract | ||
51 | /// </summary> | ||
52 | |||
53 | [TestFixture] | ||
54 | public class LoginServiceTests | ||
55 | { | ||
56 | private string m_firstName = "Adam"; | ||
57 | private string m_lastName = "West"; | ||
58 | private string m_regionExternalName = "localhost"; | ||
59 | |||
60 | private IPEndPoint m_capsEndPoint; | ||
61 | private TestCommunicationsManager m_commsManager; | ||
62 | private TestLoginToRegionConnector m_regionConnector; | ||
63 | private LocalUserServices m_localUserServices; | ||
64 | private LoginService m_loginService; | ||
65 | private UserProfileData m_userProfileData; | ||
66 | private TestScene m_testScene; | ||
67 | |||
68 | [SetUp] | ||
69 | public void SetUpLoginEnviroment() | ||
70 | { | ||
71 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); | ||
72 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); | ||
73 | m_regionConnector = new TestLoginToRegionConnector(); | ||
74 | m_testScene = SceneSetupHelpers.SetupScene(m_commsManager, ""); | ||
75 | |||
76 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); | ||
77 | |||
78 | //IInventoryService m_inventoryService = new MockInventoryService(); | ||
79 | |||
80 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; | ||
81 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); | ||
82 | |||
83 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_testScene.InventoryService, | ||
84 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); | ||
85 | |||
86 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); | ||
87 | } | ||
88 | |||
89 | /// <summary> | ||
90 | /// Test the normal response to a login. Does not test authentication. | ||
91 | /// </summary> | ||
92 | [Test] | ||
93 | public void T010_TestUnauthenticatedLogin() | ||
94 | { | ||
95 | TestHelper.InMethod(); | ||
96 | // We want to use our own LoginService for this test, one that | ||
97 | // doesn't require authentication. | ||
98 | new LLStandaloneLoginService( | ||
99 | (UserManagerBase)m_commsManager.UserService, "Hello folks", new MockInventoryService(), | ||
100 | m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector); | ||
101 | |||
102 | Hashtable loginParams = new Hashtable(); | ||
103 | loginParams["first"] = m_firstName; | ||
104 | loginParams["last"] = m_lastName; | ||
105 | loginParams["passwd"] = "boingboing"; | ||
106 | |||
107 | ArrayList sendParams = new ArrayList(); | ||
108 | sendParams.Add(loginParams); | ||
109 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
110 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
111 | |||
112 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
113 | |||
114 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
115 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
116 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
117 | |||
118 | Hashtable responseData = (Hashtable)response.Value; | ||
119 | |||
120 | Assert.That(responseData["first_name"], Is.EqualTo(m_firstName)); | ||
121 | Assert.That(responseData["last_name"], Is.EqualTo(m_lastName)); | ||
122 | Assert.That( | ||
123 | responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(Int32.MaxValue)); | ||
124 | |||
125 | Regex capsSeedPattern | ||
126 | = new Regex("^http://" | ||
127 | + NetworkUtil.GetHostFor(tmpLocal, m_regionExternalName) | ||
128 | + ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}0000/$"); | ||
129 | |||
130 | Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True); | ||
131 | } | ||
132 | |||
133 | [Test] | ||
134 | public void T011_TestAuthenticatedLoginSuccess() | ||
135 | { | ||
136 | TestHelper.InMethod(); | ||
137 | // TODO: Not check inventory part of response yet. | ||
138 | // TODO: Not checking all of login response thoroughly yet. | ||
139 | |||
140 | // 1) Test for positive authentication | ||
141 | |||
142 | Hashtable loginParams = new Hashtable(); | ||
143 | loginParams["first"] = m_firstName; | ||
144 | loginParams["last"] = m_lastName; | ||
145 | loginParams["passwd"] = "boingboing"; | ||
146 | |||
147 | ArrayList sendParams = new ArrayList(); | ||
148 | sendParams.Add(loginParams); | ||
149 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
150 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
151 | |||
152 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
153 | |||
154 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
155 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
156 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
157 | |||
158 | Hashtable responseData = (Hashtable)response.Value; | ||
159 | |||
160 | UserAgentData uagent = m_userProfileData.CurrentAgent; | ||
161 | Assert.That(uagent,Is.Not.Null); | ||
162 | |||
163 | Assert.That(responseData["first_name"], Is.Not.Null); | ||
164 | Assert.That(responseData["first_name"], Is.EqualTo(m_firstName)); | ||
165 | Assert.That(responseData["last_name"], Is.EqualTo(m_lastName)); | ||
166 | Assert.That(responseData["agent_id"], Is.EqualTo(uagent.ProfileID.ToString())); | ||
167 | Assert.That(responseData["session_id"], Is.EqualTo(uagent.SessionID.ToString())); | ||
168 | Assert.That(responseData["secure_session_id"], Is.EqualTo(uagent.SecureSessionID.ToString())); | ||
169 | ArrayList invlibroot = (ArrayList) responseData["inventory-lib-root"]; | ||
170 | Hashtable invlibroothash = (Hashtable) invlibroot[0]; | ||
171 | Assert.That(invlibroothash["folder_id"],Is.EqualTo("00000112-000f-0000-0000-000100bba000")); | ||
172 | Assert.That( | ||
173 | responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(Int32.MaxValue)); | ||
174 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); | ||
175 | Assert.That(responseData["buddy-list"], Is.Empty); | ||
176 | Assert.That(responseData["start_location"], Is.EqualTo("last")); | ||
177 | |||
178 | Regex capsSeedPattern | ||
179 | = new Regex("^http://" | ||
180 | + NetworkUtil.GetHostFor(tmpLocal, m_regionExternalName) | ||
181 | + ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}0000/$"); | ||
182 | |||
183 | Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True); | ||
184 | } | ||
185 | |||
186 | [Test] | ||
187 | public void T012_TestAuthenticatedLoginForBuddies() | ||
188 | { | ||
189 | TestHelper.InMethod(); | ||
190 | // 1.1) Test for budddies! | ||
191 | m_localUserServices.AddUser("Friend","Number1","boingboing","abc@ftw.com",42,43); | ||
192 | m_localUserServices.AddUser("Friend","Number2","boingboing","abc@ftw.com",42,43); | ||
193 | |||
194 | UserProfileData friend1 = m_localUserServices.GetUserProfile("Friend","Number1"); | ||
195 | UserProfileData friend2 = m_localUserServices.GetUserProfile("Friend","Number2"); | ||
196 | m_localUserServices.AddNewUserFriend(friend1.ID,m_userProfileData.ID,1); | ||
197 | m_localUserServices.AddNewUserFriend(friend1.ID,friend2.ID,2); | ||
198 | |||
199 | Hashtable loginParams = new Hashtable(); | ||
200 | loginParams["first"] = "Friend"; | ||
201 | loginParams["last"] = "Number1"; | ||
202 | loginParams["passwd"] = "boingboing"; | ||
203 | |||
204 | ArrayList sendParams = new ArrayList(); | ||
205 | sendParams.Add(loginParams); | ||
206 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
207 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
208 | |||
209 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
210 | |||
211 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
212 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
213 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
214 | |||
215 | Hashtable responseData = (Hashtable)response.Value; | ||
216 | |||
217 | ArrayList friendslist = (ArrayList) responseData["buddy-list"]; | ||
218 | |||
219 | Assert.That(friendslist,Is.Not.Null); | ||
220 | |||
221 | Hashtable buddy1 = (Hashtable) friendslist[0]; | ||
222 | Hashtable buddy2 = (Hashtable) friendslist[1]; | ||
223 | Assert.That(friendslist.Count, Is.EqualTo(2)); | ||
224 | Assert.That(m_userProfileData.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"])); | ||
225 | Assert.That(friend2.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"])); | ||
226 | } | ||
227 | |||
228 | [Test] | ||
229 | public void T020_TestAuthenticatedLoginBadUsername() | ||
230 | { | ||
231 | TestHelper.InMethod(); | ||
232 | |||
233 | // 2) Test for negative authentication | ||
234 | // | ||
235 | string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist."; | ||
236 | //string error_region_unavailable = "The region you are attempting to log into is not responding. Please select another region and try again."; | ||
237 | // 2.1) Test for wrong user name | ||
238 | Hashtable loginParams = new Hashtable(); | ||
239 | loginParams["first"] = m_lastName; | ||
240 | loginParams["last"] = m_firstName; | ||
241 | loginParams["passwd"] = "boingboing"; | ||
242 | |||
243 | ArrayList sendParams = new ArrayList(); | ||
244 | sendParams.Add(loginParams); | ||
245 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
246 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
247 | |||
248 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
249 | |||
250 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
251 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
252 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
253 | |||
254 | Hashtable responseData = (Hashtable)response.Value; | ||
255 | Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); | ||
256 | |||
257 | } | ||
258 | |||
259 | [Test] | ||
260 | public void T021_TestAuthenticatedLoginBadPassword() | ||
261 | { | ||
262 | TestHelper.InMethod(); | ||
263 | |||
264 | string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist."; | ||
265 | // 2.2) Test for wrong password | ||
266 | Hashtable loginParams = new Hashtable(); | ||
267 | loginParams["first"] = "Friend"; | ||
268 | loginParams["last"] = "Number2"; | ||
269 | loginParams["passwd"] = "boing"; | ||
270 | |||
271 | ArrayList sendParams = new ArrayList(); | ||
272 | sendParams.Add(loginParams); | ||
273 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
274 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
275 | |||
276 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
277 | |||
278 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
279 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
280 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
281 | |||
282 | Hashtable responseData = (Hashtable)response.Value; | ||
283 | Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); | ||
284 | |||
285 | } | ||
286 | |||
287 | [Test] | ||
288 | public void T022_TestAuthenticatedLoginBadXml() | ||
289 | { | ||
290 | TestHelper.InMethod(); | ||
291 | |||
292 | string error_xml_message = "Error connecting to grid. Could not percieve credentials from login XML."; | ||
293 | // 2.3) Bad XML | ||
294 | Hashtable loginParams = new Hashtable(); | ||
295 | loginParams["first"] = "Friend"; | ||
296 | loginParams["banana"] = "Banana"; | ||
297 | loginParams["passwd"] = "boingboing"; | ||
298 | |||
299 | ArrayList sendParams = new ArrayList(); | ||
300 | sendParams.Add(loginParams); | ||
301 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
302 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
303 | |||
304 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
305 | |||
306 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
307 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
308 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
309 | |||
310 | Hashtable responseData = (Hashtable)response.Value; | ||
311 | Assert.That(responseData["message"], Is.EqualTo(error_xml_message)); | ||
312 | |||
313 | } | ||
314 | |||
315 | // [Test] | ||
316 | // Commenting out test now that LLStandAloneLoginService no longer replies with message in this case. | ||
317 | // Kept the code for future test with grid mode, which will keep this behavior. | ||
318 | public void T023_TestAuthenticatedLoginAlreadyLoggedIn() | ||
319 | { | ||
320 | TestHelper.InMethod(); | ||
321 | |||
322 | //Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | ||
323 | //log4net.Config.XmlConfigurator.Configure(); | ||
324 | |||
325 | string error_already_logged = "You appear to be already logged in. " + | ||
326 | "If this is not the case please wait for your session to timeout. " + | ||
327 | "If this takes longer than a few minutes please contact the grid owner. " + | ||
328 | "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously."; | ||
329 | // 2.4) Already logged in and sucessfull post login | ||
330 | Hashtable loginParams = new Hashtable(); | ||
331 | loginParams["first"] = "Adam"; | ||
332 | loginParams["last"] = "West"; | ||
333 | loginParams["passwd"] = "boingboing"; | ||
334 | |||
335 | ArrayList sendParams = new ArrayList(); | ||
336 | sendParams.Add(loginParams); | ||
337 | sendParams.Add(m_capsEndPoint); // is this parameter correct? | ||
338 | sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? | ||
339 | |||
340 | // First we log in. | ||
341 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
342 | |||
343 | IPAddress tmpLocal = Util.GetLocalHost(); | ||
344 | IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80); | ||
345 | XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
346 | |||
347 | Hashtable responseData = (Hashtable)response.Value; | ||
348 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); | ||
349 | |||
350 | // Then we try again, this time expecting failure. | ||
351 | request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
352 | response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
353 | responseData = (Hashtable)response.Value; | ||
354 | Assert.That(responseData["message"], Is.EqualTo(error_already_logged)); | ||
355 | |||
356 | // Finally the third time we should be able to get right back in. | ||
357 | request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
358 | |||
359 | response = m_loginService.XmlRpcLoginMethod(request, tmpEnd); | ||
360 | responseData = (Hashtable)response.Value; | ||
361 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); | ||
362 | |||
363 | //Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | ||
364 | } | ||
365 | |||
366 | [TearDown] | ||
367 | public void TearDown() | ||
368 | { | ||
369 | try | ||
370 | { | ||
371 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | ||
372 | } catch (NullReferenceException) | ||
373 | {} | ||
374 | } | ||
375 | |||
376 | public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector | ||
377 | { | ||
378 | private List<RegionInfo> m_regionsList = new List<RegionInfo>(); | ||
379 | |||
380 | public void AddRegion(RegionInfo regionInfo) | ||
381 | { | ||
382 | lock (m_regionsList) | ||
383 | { | ||
384 | if (!m_regionsList.Contains(regionInfo)) | ||
385 | { | ||
386 | m_regionsList.Add(regionInfo); | ||
387 | } | ||
388 | } | ||
389 | } | ||
390 | |||
391 | #region ILoginRegionsConnector Members | ||
392 | public bool RegionLoginsEnabled | ||
393 | { | ||
394 | get { return true; } | ||
395 | } | ||
396 | |||
397 | public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message) | ||
398 | { | ||
399 | } | ||
400 | |||
401 | public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason) | ||
402 | { | ||
403 | reason = String.Empty; | ||
404 | lock (m_regionsList) | ||
405 | { | ||
406 | foreach (RegionInfo regInfo in m_regionsList) | ||
407 | { | ||
408 | if (regInfo.RegionHandle == regionHandle) | ||
409 | return true; | ||
410 | } | ||
411 | } | ||
412 | reason = "Region not found"; | ||
413 | return false; | ||
414 | } | ||
415 | |||
416 | public RegionInfo RequestClosestRegion(string region) | ||
417 | { | ||
418 | lock (m_regionsList) | ||
419 | { | ||
420 | foreach (RegionInfo regInfo in m_regionsList) | ||
421 | { | ||
422 | if (regInfo.RegionName == region) | ||
423 | return regInfo; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | return null; | ||
428 | } | ||
429 | |||
430 | public RegionInfo RequestNeighbourInfo(OpenMetaverse.UUID regionID) | ||
431 | { | ||
432 | lock (m_regionsList) | ||
433 | { | ||
434 | foreach (RegionInfo regInfo in m_regionsList) | ||
435 | { | ||
436 | if (regInfo.RegionID == regionID) | ||
437 | return regInfo; | ||
438 | } | ||
439 | } | ||
440 | |||
441 | return null; | ||
442 | } | ||
443 | |||
444 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
445 | { | ||
446 | lock (m_regionsList) | ||
447 | { | ||
448 | foreach (RegionInfo regInfo in m_regionsList) | ||
449 | { | ||
450 | if (regInfo.RegionHandle == regionHandle) | ||
451 | return regInfo; | ||
452 | } | ||
453 | } | ||
454 | |||
455 | return null; | ||
456 | } | ||
457 | |||
458 | #endregion | ||
459 | } | ||
460 | } | ||
461 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index e80f6ab..3486c8b 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs | |||
@@ -53,7 +53,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
53 | userServices.AddPlugin(new HGUserDataPlugin(this, userServices)); | 53 | userServices.AddPlugin(new HGUserDataPlugin(this, userServices)); |
54 | 54 | ||
55 | m_userService = userServices; | 55 | m_userService = userServices; |
56 | m_messageService = userServices; | ||
57 | m_avatarService = userServices; | 56 | m_avatarService = userServices; |
58 | } | 57 | } |
59 | } | 58 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index 4e3f5a1..d979a01 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs | |||
@@ -60,9 +60,7 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
60 | 60 | ||
61 | m_userService = hgUserService; | 61 | m_userService = hgUserService; |
62 | m_userAdminService = hgUserService; | 62 | m_userAdminService = hgUserService; |
63 | m_avatarService = hgUserService; | 63 | m_avatarService = hgUserService; |
64 | m_messageService = hgUserService; | ||
65 | |||
66 | } | 64 | } |
67 | } | 65 | } |
68 | } | 66 | } |
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index eaf996d..4f83fdb 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -51,7 +51,6 @@ namespace OpenSim.Region.Communications.Local | |||
51 | m_userService = lus; | 51 | m_userService = lus; |
52 | m_userAdminService = lus; | 52 | m_userAdminService = lus; |
53 | m_avatarService = lus; | 53 | m_avatarService = lus; |
54 | m_messageService = lus; | ||
55 | 54 | ||
56 | //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService); | 55 | //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService); |
57 | } | 56 | } |
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 94e4ed2..111b7c0 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | |||
@@ -46,7 +46,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
46 | userServices.AddPlugin(new OGS1UserDataPlugin(this)); | 46 | userServices.AddPlugin(new OGS1UserDataPlugin(this)); |
47 | 47 | ||
48 | m_userService = userServices; | 48 | m_userService = userServices; |
49 | m_messageService = userServices; | ||
50 | m_avatarService = (IAvatarService)m_userService; | 49 | m_avatarService = (IAvatarService)m_userService; |
51 | } | 50 | } |
52 | 51 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e22dd2d..ef62b79 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3979,35 +3979,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3979 | objectCapacity = objects; | 3979 | objectCapacity = objects; |
3980 | } | 3980 | } |
3981 | 3981 | ||
3982 | public List<FriendListItem> GetFriendList(string id) | ||
3983 | { | ||
3984 | UUID avatarID; | ||
3985 | if (!UUID.TryParse(id, out avatarID)) | ||
3986 | return new List<FriendListItem>(); | ||
3987 | |||
3988 | return CommsManager.GetUserFriendList(avatarID); | ||
3989 | } | ||
3990 | |||
3991 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
3992 | { | ||
3993 | return CommsManager.GetFriendRegionInfos(uuids); | ||
3994 | } | ||
3995 | |||
3996 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) | ||
3997 | { | ||
3998 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); | ||
3999 | } | ||
4000 | |||
4001 | public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms) | ||
4002 | { | ||
4003 | m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms); | ||
4004 | } | ||
4005 | |||
4006 | public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID) | ||
4007 | { | ||
4008 | m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); | ||
4009 | } | ||
4010 | |||
4011 | #endregion | 3982 | #endregion |
4012 | 3983 | ||
4013 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 3984 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 53693e4..8b14f61 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -1455,25 +1455,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1455 | m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | 1455 | m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); |
1456 | } | 1456 | } |
1457 | 1457 | ||
1458 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
1459 | { | ||
1460 | m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms); | ||
1461 | } | ||
1462 | |||
1463 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
1464 | { | ||
1465 | m_commsProvider.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
1466 | } | ||
1467 | |||
1468 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
1469 | { | ||
1470 | m_commsProvider.RemoveUserFriend(friendlistowner, friend); | ||
1471 | } | ||
1472 | |||
1473 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
1474 | { | ||
1475 | return m_commsProvider.GetUserFriendList(friendlistowner); | ||
1476 | } | ||
1477 | 1458 | ||
1478 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) | 1459 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) |
1479 | { | 1460 | { |