diff options
Diffstat (limited to 'OpenSim/Framework')
4 files changed, 117 insertions, 20 deletions
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 1b71367..168f7a6 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs | |||
@@ -182,7 +182,7 @@ namespace OpenSim.Framework.Communications.Services | |||
182 | // Reject the login | 182 | // Reject the login |
183 | 183 | ||
184 | m_log.InfoFormat( | 184 | m_log.InfoFormat( |
185 | "[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in", | 185 | "[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in", |
186 | firstname, lastname); | 186 | firstname, lastname); |
187 | 187 | ||
188 | return logResponse.CreateAlreadyLoggedInResponse(); | 188 | return logResponse.CreateAlreadyLoggedInResponse(); |
diff --git a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs new file mode 100644 index 0000000..1cfeaf1 --- /dev/null +++ b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs | |||
@@ -0,0 +1,88 @@ | |||
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 OpenSim 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 OpenMetaverse; | ||
31 | using OpenSim.Data; | ||
32 | |||
33 | namespace OpenSim.Framework.Communications | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Plugin for managing temporary user profiles. | ||
37 | /// </summary> | ||
38 | public class TemporaryUserProfilePlugin : IUserDataPlugin | ||
39 | { | ||
40 | protected Dictionary<UUID, UserProfileData> m_profiles = new Dictionary<UUID, UserProfileData>(); | ||
41 | |||
42 | public string Name { get { return "TemporaryUserProfilePlugin"; } } | ||
43 | public string Version { get { return "0.1"; } } | ||
44 | public void Initialise() {} | ||
45 | public void Initialise(string connect) {} | ||
46 | public void Dispose() {} | ||
47 | |||
48 | public UserProfileData GetUserByUUID(UUID user) | ||
49 | { | ||
50 | lock (m_profiles) | ||
51 | { | ||
52 | if (m_profiles.ContainsKey(user)) | ||
53 | return m_profiles[user]; | ||
54 | else | ||
55 | return null; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public UserProfileData GetUserByName(string fname, string lname) | ||
60 | { | ||
61 | // We deliberately don't look up a temporary profile by name so that we don't obscure non-temporary | ||
62 | // profiles. | ||
63 | |||
64 | return null; | ||
65 | } | ||
66 | |||
67 | public UserProfileData GetUserByUri(Uri uri) { return null; } | ||
68 | public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } | ||
69 | public UserAgentData GetAgentByUUID(UUID user) { return null; } | ||
70 | public UserAgentData GetAgentByName(string name) { return null; } | ||
71 | public UserAgentData GetAgentByName(string fname, string lname) { return null; } | ||
72 | public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {} | ||
73 | public void AddNewUserProfile(UserProfileData user) {} | ||
74 | public bool UpdateUserProfile(UserProfileData user) { return false; } | ||
75 | public void AddNewUserAgent(UserAgentData agent) {} | ||
76 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) {} | ||
77 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) {} | ||
78 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {} | ||
79 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return null; } | ||
80 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; } | ||
81 | public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; } | ||
82 | public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; } | ||
83 | public AvatarAppearance GetUserAppearance(UUID user) { return null; } | ||
84 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {} | ||
85 | public void ResetAttachments(UUID userID) {} | ||
86 | public void LogoutUsers(UUID regionID) {} | ||
87 | } | ||
88 | } | ||
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index e7dbf2d..42fdea5 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -280,6 +280,9 @@ namespace OpenSim.Framework.Communications.Tests | |||
280 | [Test] | 280 | [Test] |
281 | public void T023_TestAuthenticatedLoginAlreadyLoggedIn() | 281 | public void T023_TestAuthenticatedLoginAlreadyLoggedIn() |
282 | { | 282 | { |
283 | Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | ||
284 | log4net.Config.XmlConfigurator.Configure(); | ||
285 | |||
283 | string error_already_logged = "You appear to be already logged in. " + | 286 | string error_already_logged = "You appear to be already logged in. " + |
284 | "If this is not the case please wait for your session to timeout. " + | 287 | "If this is not the case please wait for your session to timeout. " + |
285 | "If this takes longer than a few minutes please contact the grid owner. " + | 288 | "If this takes longer than a few minutes please contact the grid owner. " + |
@@ -303,7 +306,6 @@ namespace OpenSim.Framework.Communications.Tests | |||
303 | 306 | ||
304 | // Then we try again, this time expecting failure. | 307 | // Then we try again, this time expecting failure. |
305 | request = new XmlRpcRequest("login_to_simulator", sendParams); | 308 | request = new XmlRpcRequest("login_to_simulator", sendParams); |
306 | |||
307 | response = m_loginService.XmlRpcLoginMethod(request); | 309 | response = m_loginService.XmlRpcLoginMethod(request); |
308 | responseData = (Hashtable)response.Value; | 310 | responseData = (Hashtable)response.Value; |
309 | Assert.That(responseData["message"], Is.EqualTo(error_already_logged)); | 311 | Assert.That(responseData["message"], Is.EqualTo(error_already_logged)); |
@@ -314,11 +316,12 @@ namespace OpenSim.Framework.Communications.Tests | |||
314 | response = m_loginService.XmlRpcLoginMethod(request); | 316 | response = m_loginService.XmlRpcLoginMethod(request); |
315 | responseData = (Hashtable)response.Value; | 317 | responseData = (Hashtable)response.Value; |
316 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); | 318 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); |
319 | |||
320 | Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | ||
317 | } | 321 | } |
318 | 322 | ||
319 | public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector | 323 | public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector |
320 | { | 324 | { |
321 | |||
322 | private List<RegionInfo> m_regionsList = new List<RegionInfo>(); | 325 | private List<RegionInfo> m_regionsList = new List<RegionInfo>(); |
323 | 326 | ||
324 | public void AddRegion(RegionInfo regionInfo) | 327 | public void AddRegion(RegionInfo regionInfo) |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 9cd7658..b6a7362 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -208,7 +208,7 @@ namespace OpenSim.Framework.Communications | |||
208 | } | 208 | } |
209 | catch (Exception e) | 209 | catch (Exception e) |
210 | { | 210 | { |
211 | m_log.InfoFormat( | 211 | m_log.ErrorFormat( |
212 | "[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", | 212 | "[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", |
213 | data.FirstName, data.SurName, plugin.Name, e.ToString()); | 213 | data.FirstName, data.SurName, plugin.Name, e.ToString()); |
214 | } | 214 | } |
@@ -239,7 +239,7 @@ namespace OpenSim.Framework.Communications | |||
239 | } | 239 | } |
240 | catch (Exception e) | 240 | catch (Exception e) |
241 | { | 241 | { |
242 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); | 242 | m_log.Error("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
@@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications | |||
264 | } | 264 | } |
265 | catch (Exception e) | 265 | catch (Exception e) |
266 | { | 266 | { |
267 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); | 267 | m_log.Error("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
@@ -290,7 +290,7 @@ namespace OpenSim.Framework.Communications | |||
290 | } | 290 | } |
291 | catch (Exception e) | 291 | catch (Exception e) |
292 | { | 292 | { |
293 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); | 293 | m_log.Error("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | 296 | ||
@@ -334,7 +334,7 @@ namespace OpenSim.Framework.Communications | |||
334 | } | 334 | } |
335 | catch (Exception e) | 335 | catch (Exception e) |
336 | { | 336 | { |
337 | m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")"); | 337 | m_log.Error("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")"); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
@@ -351,7 +351,7 @@ namespace OpenSim.Framework.Communications | |||
351 | } | 351 | } |
352 | catch (Exception e) | 352 | catch (Exception e) |
353 | { | 353 | { |
354 | m_log.Info("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Name + "(" + e.ToString() + ")"); | 354 | m_log.Error("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Name + "(" + e.ToString() + ")"); |
355 | } | 355 | } |
356 | } | 356 | } |
357 | } | 357 | } |
@@ -366,7 +366,7 @@ namespace OpenSim.Framework.Communications | |||
366 | } | 366 | } |
367 | catch (Exception e) | 367 | catch (Exception e) |
368 | { | 368 | { |
369 | m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Name + "(" + e.ToString() + ")"); | 369 | m_log.Error("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Name + "(" + e.ToString() + ")"); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | } | 372 | } |
@@ -381,7 +381,7 @@ namespace OpenSim.Framework.Communications | |||
381 | } | 381 | } |
382 | catch (Exception e) | 382 | catch (Exception e) |
383 | { | 383 | { |
384 | m_log.Info("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Name + "(" + e.ToString() + ")"); | 384 | m_log.Error("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Name + "(" + e.ToString() + ")"); |
385 | } | 385 | } |
386 | } | 386 | } |
387 | } | 387 | } |
@@ -396,7 +396,7 @@ namespace OpenSim.Framework.Communications | |||
396 | } | 396 | } |
397 | catch (Exception e) | 397 | catch (Exception e) |
398 | { | 398 | { |
399 | m_log.Info("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Name + "(" + e.ToString() + ")"); | 399 | m_log.Error("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Name + "(" + e.ToString() + ")"); |
400 | } | 400 | } |
401 | } | 401 | } |
402 | } | 402 | } |
@@ -707,24 +707,30 @@ namespace OpenSim.Framework.Communications | |||
707 | public abstract UserProfileData SetupMasterUser(UUID uuid); | 707 | public abstract UserProfileData SetupMasterUser(UUID uuid); |
708 | 708 | ||
709 | /// <summary> | 709 | /// <summary> |
710 | /// Add agent to DB | 710 | /// Add an agent using data plugins. |
711 | /// </summary> | 711 | /// </summary> |
712 | /// <param name="agentdata">The agent data to be added</param> | 712 | /// <param name="agentdata">The agent data to be added</param> |
713 | /// <returns> | ||
714 | /// true if at least one plugin added the user agent. false if no plugin successfully added the agent | ||
715 | /// </returns> | ||
713 | public virtual bool AddUserAgent(UserAgentData agentdata) | 716 | public virtual bool AddUserAgent(UserAgentData agentdata) |
714 | { | 717 | { |
718 | bool result = false; | ||
719 | |||
715 | foreach (IUserDataPlugin plugin in m_plugins) | 720 | foreach (IUserDataPlugin plugin in m_plugins) |
716 | { | 721 | { |
717 | try | 722 | try |
718 | { | 723 | { |
719 | plugin.AddNewUserAgent(agentdata); | 724 | plugin.AddNewUserAgent(agentdata); |
720 | return true; | 725 | result = true; |
721 | } | 726 | } |
722 | catch (Exception e) | 727 | catch (Exception e) |
723 | { | 728 | { |
724 | m_log.Info("[USERSTORAGE]: Unable to add agent via " + plugin.Name + "(" + e.ToString() + ")"); | 729 | m_log.Error("[USERSTORAGE]: Unable to add agent via " + plugin.Name + "(" + e.ToString() + ")"); |
725 | } | 730 | } |
726 | } | 731 | } |
727 | return false; | 732 | |
733 | return result; | ||
728 | } | 734 | } |
729 | 735 | ||
730 | /// <summary> | 736 | /// <summary> |
@@ -745,7 +751,7 @@ namespace OpenSim.Framework.Communications | |||
745 | } | 751 | } |
746 | catch (Exception e) | 752 | catch (Exception e) |
747 | { | 753 | { |
748 | m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); | 754 | m_log.ErrorFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); |
749 | } | 755 | } |
750 | } | 756 | } |
751 | 757 | ||
@@ -762,7 +768,7 @@ namespace OpenSim.Framework.Communications | |||
762 | } | 768 | } |
763 | catch (Exception e) | 769 | catch (Exception e) |
764 | { | 770 | { |
765 | m_log.InfoFormat("[USERSTORAGE]: Unable to update user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); | 771 | m_log.ErrorFormat("[USERSTORAGE]: Unable to update user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); |
766 | } | 772 | } |
767 | } | 773 | } |
768 | } | 774 | } |
@@ -811,10 +817,10 @@ namespace OpenSim.Framework.Communications | |||
811 | m_log.InfoFormat("[USERAUTH]: Successfully generated new auth key for user {0}", userID); | 817 | m_log.InfoFormat("[USERAUTH]: Successfully generated new auth key for user {0}", userID); |
812 | } | 818 | } |
813 | else | 819 | else |
814 | m_log.Info("[USERAUTH]: Unauthorized key generation request. Denying new key."); | 820 | m_log.Warn("[USERAUTH]: Unauthorized key generation request. Denying new key."); |
815 | } | 821 | } |
816 | else | 822 | else |
817 | m_log.Info("[USERAUTH]: User not found."); | 823 | m_log.Warn("[USERAUTH]: User not found."); |
818 | 824 | ||
819 | return url + newKey; | 825 | return url + newKey; |
820 | } | 826 | } |