diff options
Diffstat (limited to 'OpenSim/Framework/Communications')
17 files changed, 110 insertions, 199 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 238810a..aa71536 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
55 | /// Stores user profile and inventory data received from backend services for a particular user. | 55 | /// Stores user profile and inventory data received from backend services for a particular user. |
56 | /// </summary> | 56 | /// </summary> |
57 | public class CachedUserInfo | 57 | public class CachedUserInfo |
58 | { | 58 | { |
59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
60 | 60 | ||
61 | //// <value> | 61 | //// <value> |
@@ -190,7 +190,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
190 | resolvedFolders.Add(folder); | 190 | resolvedFolders.Add(folder); |
191 | resolvedFolderDictionary[folder.ID] = folder; | 191 | resolvedFolderDictionary[folder.ID] = folder; |
192 | parentFolder.AddChildFolder(folder); | 192 | parentFolder.AddChildFolder(folder); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | } // foreach (folder in pendingCategorizationFolders[parentFolder.ID]) | 195 | } // foreach (folder in pendingCategorizationFolders[parentFolder.ID]) |
196 | 196 | ||
@@ -219,7 +219,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
219 | /// <summary> | 219 | /// <summary> |
220 | /// Fetch inventory for this user. | 220 | /// Fetch inventory for this user. |
221 | /// </summary> | 221 | /// </summary> |
222 | /// This has to be executed as a separate step once user information is retreived. | 222 | /// This has to be executed as a separate step once user information is retreived. |
223 | /// This will occur synchronously if the inventory service is in the same process as this class, and | 223 | /// This will occur synchronously if the inventory service is in the same process as this class, and |
224 | /// asynchronously otherwise. | 224 | /// asynchronously otherwise. |
225 | public void FetchInventory() | 225 | public void FetchInventory() |
@@ -422,7 +422,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
422 | /// | 422 | /// |
423 | /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE | 423 | /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE |
424 | /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, | 424 | /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, |
425 | /// and needs to be changed. | 425 | /// and needs to be changed. |
426 | /// | 426 | /// |
427 | /// <param name="folderID"></param> | 427 | /// <param name="folderID"></param> |
428 | /// <param name="type"></param> | 428 | /// <param name="type"></param> |
@@ -500,7 +500,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
500 | InventoryFolderImpl oldParentFolder = RootFolder.FindFolder(folder.ParentID); | 500 | InventoryFolderImpl oldParentFolder = RootFolder.FindFolder(folder.ParentID); |
501 | 501 | ||
502 | if (oldParentFolder != null) | 502 | if (oldParentFolder != null) |
503 | { | 503 | { |
504 | oldParentFolder.RemoveChildFolder(folderID); | 504 | oldParentFolder.RemoveChildFolder(folderID); |
505 | parentFolder.AddChildFolder(folder); | 505 | parentFolder.AddChildFolder(folder); |
506 | } | 506 | } |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 7f1c7e9..9e12d948 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
60 | /// User profiles indexed by name | 60 | /// User profiles indexed by name |
61 | /// </summary> | 61 | /// </summary> |
62 | private readonly Dictionary<string, CachedUserInfo> m_userProfilesByName | 62 | private readonly Dictionary<string, CachedUserInfo> m_userProfilesByName |
63 | = new Dictionary<string, CachedUserInfo>(); | 63 | = new Dictionary<string, CachedUserInfo>(); |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// The root library folder. | 66 | /// The root library folder. |
@@ -123,35 +123,35 @@ namespace OpenSim.Framework.Communications.Cache | |||
123 | /// <summary> | 123 | /// <summary> |
124 | /// Get details of the given user. | 124 | /// Get details of the given user. |
125 | /// </summary> | 125 | /// </summary> |
126 | /// If the user isn't in cache then the user is requested from the profile service. | 126 | /// If the user isn't in cache then the user is requested from the profile service. |
127 | /// <param name="userID"></param> | 127 | /// <param name="userID"></param> |
128 | /// <returns>null if no user details are found</returns> | 128 | /// <returns>null if no user details are found</returns> |
129 | public CachedUserInfo GetUserDetails(string fname, string lname) | 129 | public CachedUserInfo GetUserDetails(string fname, string lname) |
130 | { | 130 | { |
131 | lock (m_userProfilesByName) | 131 | lock (m_userProfilesByName) |
132 | { | 132 | { |
133 | CachedUserInfo userInfo; | 133 | CachedUserInfo userInfo; |
134 | 134 | ||
135 | if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo)) | 135 | if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo)) |
136 | { | 136 | { |
137 | return userInfo; | 137 | return userInfo; |
138 | } | 138 | } |
139 | else | 139 | else |
140 | { | 140 | { |
141 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname); | 141 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname); |
142 | 142 | ||
143 | if (userProfile != null) | 143 | if (userProfile != null) |
144 | return AddToCaches(userProfile); | 144 | return AddToCaches(userProfile); |
145 | else | 145 | else |
146 | return null; | 146 | return null; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | /// <summary> | 151 | /// <summary> |
152 | /// Get details of the given user. | 152 | /// Get details of the given user. |
153 | /// </summary> | 153 | /// </summary> |
154 | /// If the user isn't in cache then the user is requested from the profile service. | 154 | /// If the user isn't in cache then the user is requested from the profile service. |
155 | /// <param name="userID"></param> | 155 | /// <param name="userID"></param> |
156 | /// <returns>null if no user details are found</returns> | 156 | /// <returns>null if no user details are found</returns> |
157 | public CachedUserInfo GetUserDetails(UUID userID) | 157 | public CachedUserInfo GetUserDetails(UUID userID) |
@@ -185,20 +185,20 @@ namespace OpenSim.Framework.Communications.Cache | |||
185 | // probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via | 185 | // probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via |
186 | // returning a read only class from the cache). | 186 | // returning a read only class from the cache). |
187 | // public bool StoreProfile(UserProfileData userProfile) | 187 | // public bool StoreProfile(UserProfileData userProfile) |
188 | // { | 188 | // { |
189 | // lock (m_userProfilesById) | 189 | // lock (m_userProfilesById) |
190 | // { | 190 | // { |
191 | // CachedUserInfo userInfo = GetUserDetails(userProfile.ID); | 191 | // CachedUserInfo userInfo = GetUserDetails(userProfile.ID); |
192 | // | 192 | // |
193 | // if (userInfo != null) | 193 | // if (userInfo != null) |
194 | // { | 194 | // { |
195 | // userInfo.m_userProfile = userProfile; | 195 | // userInfo.m_userProfile = userProfile; |
196 | // m_commsManager.UserService.UpdateUserProfile(userProfile); | 196 | // m_commsManager.UserService.UpdateUserProfile(userProfile); |
197 | // | 197 | // |
198 | // return true; | 198 | // return true; |
199 | // } | 199 | // } |
200 | // } | 200 | // } |
201 | // | 201 | // |
202 | // return false; | 202 | // return false; |
203 | // } | 203 | // } |
204 | 204 | ||
@@ -220,7 +220,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | return createdUserInfo; | 223 | return createdUserInfo; |
224 | } | 224 | } |
225 | 225 | ||
226 | /// <summary> | 226 | /// <summary> |
@@ -234,7 +234,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
234 | { | 234 | { |
235 | if (m_userProfilesById.ContainsKey(userId)) | 235 | if (m_userProfilesById.ContainsKey(userId)) |
236 | { | 236 | { |
237 | CachedUserInfo userInfo = m_userProfilesById[userId]; | 237 | CachedUserInfo userInfo = m_userProfilesById[userId]; |
238 | m_userProfilesById.Remove(userId); | 238 | m_userProfilesById.Remove(userId); |
239 | 239 | ||
240 | lock (m_userProfilesByName) | 240 | lock (m_userProfilesByName) |
@@ -244,7 +244,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
244 | 244 | ||
245 | return true; | 245 | return true; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | return false; | 249 | return false; |
250 | } | 250 | } |
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 73e2db0..3419ce2 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs | |||
@@ -35,6 +35,8 @@ using System.Text; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | 37 | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | |||
38 | using log4net; | 40 | using log4net; |
39 | 41 | ||
40 | namespace OpenSim.Framework.Communications.Clients | 42 | namespace OpenSim.Framework.Communications.Clients |
@@ -43,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
43 | { | 45 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | ||
46 | public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason) | 48 | public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, out string reason) |
47 | { | 49 | { |
48 | reason = String.Empty; | 50 | reason = String.Empty; |
49 | 51 | ||
@@ -166,7 +168,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
166 | 168 | ||
167 | } | 169 | } |
168 | 170 | ||
169 | public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData) | 171 | public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData) |
170 | { | 172 | { |
171 | // Eventually, we want to use a caps url instead of the agentID | 173 | // Eventually, we want to use a caps url instead of the agentID |
172 | string uri = string.Empty; | 174 | string uri = string.Empty; |
@@ -260,7 +262,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
260 | return true; | 262 | return true; |
261 | } | 263 | } |
262 | 264 | ||
263 | public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent) | 265 | public bool DoRetrieveRootAgentCall(GridRegion region, UUID id, out IAgentData agent) |
264 | { | 266 | { |
265 | agent = null; | 267 | agent = null; |
266 | // Eventually, we want to use a caps url instead of the agentID | 268 | // Eventually, we want to use a caps url instead of the agentID |
@@ -348,7 +350,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
348 | } | 350 | } |
349 | 351 | ||
350 | 352 | ||
351 | public bool DoCloseAgentCall(RegionInfo region, UUID id) | 353 | public bool DoCloseAgentCall(GridRegion region, UUID id) |
352 | { | 354 | { |
353 | string uri = string.Empty; | 355 | string uri = string.Empty; |
354 | try | 356 | try |
@@ -391,7 +393,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
391 | return true; | 393 | return true; |
392 | } | 394 | } |
393 | 395 | ||
394 | public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, string sogXml2, bool allowScriptCrossing) | 396 | public bool DoCreateObjectCall(GridRegion region, ISceneObject sog, string sogXml2, bool allowScriptCrossing) |
395 | { | 397 | { |
396 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 398 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
397 | string uri | 399 | string uri |
@@ -474,7 +476,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
474 | 476 | ||
475 | } | 477 | } |
476 | 478 | ||
477 | public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID) | 479 | public bool DoCreateObjectCall(GridRegion region, UUID userID, UUID itemID) |
478 | { | 480 | { |
479 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 481 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
480 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/"; | 482 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/"; |
@@ -646,7 +648,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
646 | return false; | 648 | return false; |
647 | } | 649 | } |
648 | 650 | ||
649 | public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) | 651 | public virtual void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit) |
650 | { | 652 | { |
651 | } | 653 | } |
652 | 654 | ||
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index e9a6adb..2410f31 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -59,11 +59,6 @@ namespace OpenSim.Framework.Communications | |||
59 | } | 59 | } |
60 | protected IMessagingService m_messageService; | 60 | protected IMessagingService m_messageService; |
61 | 61 | ||
62 | public IGridServices GridService | ||
63 | { | ||
64 | get { return m_gridService; } | ||
65 | } | ||
66 | protected IGridServices m_gridService; | ||
67 | 62 | ||
68 | public UserProfileCacheService UserProfileCacheService | 63 | public UserProfileCacheService UserProfileCacheService |
69 | { | 64 | { |
@@ -95,8 +90,8 @@ namespace OpenSim.Framework.Communications | |||
95 | public IUserAdminService UserAdminService | 90 | public IUserAdminService UserAdminService |
96 | { | 91 | { |
97 | get { return m_userAdminService; } | 92 | get { return m_userAdminService; } |
98 | } | 93 | } |
99 | protected IUserAdminService m_userAdminService; | 94 | protected IUserAdminService m_userAdminService; |
100 | 95 | ||
101 | /// <summary> | 96 | /// <summary> |
102 | /// Constructor | 97 | /// Constructor |
diff --git a/OpenSim/Framework/Communications/IAvatarService.cs b/OpenSim/Framework/Communications/IAvatarService.cs index 4afc58f..760aa62 100644 --- a/OpenSim/Framework/Communications/IAvatarService.cs +++ b/OpenSim/Framework/Communications/IAvatarService.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications | |||
42 | /// Update avatar appearance information | 42 | /// Update avatar appearance information |
43 | /// </summary> | 43 | /// </summary> |
44 | /// <param name="user"></param> | 44 | /// <param name="user"></param> |
45 | /// <param name="appearance"></param> | 45 | /// <param name="appearance"></param> |
46 | void UpdateUserAppearance(UUID user, AvatarAppearance appearance); | 46 | void UpdateUserAppearance(UUID user, AvatarAppearance appearance); |
47 | } | 47 | } |
48 | } | 48 | } |
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs deleted file mode 100644 index 6365919..0000000 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ /dev/null | |||
@@ -1,92 +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.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework.Communications | ||
32 | { | ||
33 | public interface IGridServices | ||
34 | { | ||
35 | string gdebugRegionName { get; set; } | ||
36 | |||
37 | /// <summary> | ||
38 | /// If true, then regions will accept logins from the user service. If false, then they will not. | ||
39 | /// </summary> | ||
40 | bool RegionLoginsEnabled { get; set; } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Register a region with the grid service. | ||
44 | /// </summary> | ||
45 | /// <param name="regionInfos"> </param> | ||
46 | /// <returns></returns> | ||
47 | /// <exception cref="System.Exception">Thrown if region registration failed</exception> | ||
48 | RegionCommsListener RegisterRegion(RegionInfo regionInfos); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Deregister a region with the grid service. | ||
52 | /// </summary> | ||
53 | /// <param name="regionInfo"></param> | ||
54 | /// <returns></returns> | ||
55 | /// <exception cref="System.Exception">Thrown if region deregistration failed</exception> | ||
56 | bool DeregisterRegion(RegionInfo regionInfo); | ||
57 | |||
58 | /// <summary> | ||
59 | /// Get information about the regions neighbouring the given co-ordinates. | ||
60 | /// </summary> | ||
61 | /// <param name="x"></param> | ||
62 | /// <param name="y"></param> | ||
63 | /// <returns></returns> | ||
64 | List<SimpleRegionInfo> RequestNeighbours(uint x, uint y); | ||
65 | |||
66 | RegionInfo RequestNeighbourInfo(ulong regionHandle); | ||
67 | RegionInfo RequestNeighbourInfo(UUID regionID); | ||
68 | RegionInfo RequestNeighbourInfo(string name); | ||
69 | RegionInfo RequestNeighbourInfo(string host, uint port); | ||
70 | |||
71 | RegionInfo RequestClosestRegion(string regionName); | ||
72 | Dictionary<string, string> GetGridSettings(); | ||
73 | List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); | ||
74 | // not complete yet, only contains the fields needed for ParcelInfoReqeust | ||
75 | LandData RequestLandData(ulong regionHandle, uint x, uint y); | ||
76 | |||
77 | /// <summary> | ||
78 | /// Get information about regions starting with the provided name. | ||
79 | /// </summary> | ||
80 | /// <param name="name"> | ||
81 | /// The name to match against. | ||
82 | /// </param> | ||
83 | /// <param name="maxNumber"> | ||
84 | /// The maximum number of results to return. | ||
85 | /// </param> | ||
86 | /// <returns> | ||
87 | /// A list of <see cref="RegionInfo"/>s of regions with matching name. If the | ||
88 | /// grid-server couldn't be contacted or returned an error, return null. | ||
89 | /// </returns> | ||
90 | List<RegionInfo> RequestNamedRegions(string name, int maxNumber); | ||
91 | } | ||
92 | } | ||
diff --git a/OpenSim/Framework/Communications/IHyperlink.cs b/OpenSim/Framework/Communications/IHyperlink.cs deleted file mode 100644 index 5057386..0000000 --- a/OpenSim/Framework/Communications/IHyperlink.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 | namespace OpenSim.Framework.Communications | ||
29 | { | ||
30 | public interface IHyperlink | ||
31 | { | ||
32 | bool IsHyperlinkRegion(ulong handle); | ||
33 | RegionInfo GetHyperlinkRegion(ulong handle); | ||
34 | ulong FindRegionHandle(ulong handle); | ||
35 | bool SendUserInformation(RegionInfo region, AgentCircuitData aCircuit); | ||
36 | void AdjustUserInformation(AgentCircuitData aCircuit); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Framework/Communications/IUserAdminService.cs b/OpenSim/Framework/Communications/IUserAdminService.cs index 15b989d..423b49b 100644 --- a/OpenSim/Framework/Communications/IUserAdminService.cs +++ b/OpenSim/Framework/Communications/IUserAdminService.cs | |||
@@ -66,6 +66,6 @@ namespace OpenSim.Framework.Communications | |||
66 | /// <param name="lastName"></param> | 66 | /// <param name="lastName"></param> |
67 | /// <param name="newPassword"></param> | 67 | /// <param name="newPassword"></param> |
68 | /// <returns>true if the update was successful, false otherwise</returns> | 68 | /// <returns>true if the update was successful, false otherwise</returns> |
69 | bool ResetUserPassword(string firstName, string lastName, string newPassword); | 69 | bool ResetUserPassword(string firstName, string lastName, string newPassword); |
70 | } | 70 | } |
71 | } | 71 | } |
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index 725225d..dfa059d 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs | |||
@@ -128,18 +128,30 @@ namespace OpenSim.Framework.Communications | |||
128 | /// | 128 | /// |
129 | /// <param name="friendlistowner">The agent for whom we're retreiving the friends Data.</param> | 129 | /// <param name="friendlistowner">The agent for whom we're retreiving the friends Data.</param> |
130 | /// <returns> | 130 | /// <returns> |
131 | /// A List of FriendListItems that contains info about the user's friends. | 131 | /// A List of FriendListItems that contains info about the user's friends. |
132 | /// Always returns a list even if the user has no friends | 132 | /// Always returns a list even if the user has no friends |
133 | /// </returns> | 133 | /// </returns> |
134 | List<FriendListItem> GetUserFriendList(UUID friendlistowner); | 134 | List<FriendListItem> GetUserFriendList(UUID friendlistowner); |
135 | 135 | ||
136 | // This probably shouldn't be here, it belongs to IAuthentication | 136 | // This probably shouldn't be here, it belongs to IAuthentication |
137 | // But since Scenes only have IUserService references, I'm placing it here for now. | 137 | // But since Scenes only have IUserService references, I'm placing it here for now. |
138 | bool VerifySession(UUID userID, UUID sessionID); | 138 | bool VerifySession(UUID userID, UUID sessionID); |
139 | 139 | ||
140 | /// <summary> | ||
141 | /// Authenticate a user by their password. | ||
142 | /// </summary> | ||
143 | /// | ||
144 | /// This is used by callers outside the login process that want to | ||
145 | /// verify a user who has given their password. | ||
146 | /// | ||
147 | /// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is | ||
148 | /// | ||
149 | /// <param name="userID"></param> | ||
150 | /// <param name="password"></param> | ||
151 | /// <returns></returns> | ||
152 | bool AuthenticateUserByPassword(UUID userID, string password); | ||
140 | 153 | ||
141 | // Temporary Hack until we move everything to the new service model | 154 | // Temporary Hack until we move everything to the new service model |
142 | void SetInventoryService(IInventoryService invService); | 155 | void SetInventoryService(IInventoryService invService); |
143 | |||
144 | } | 156 | } |
145 | } | 157 | } |
diff --git a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs index 98d0e0f..e96c5e8 100644 --- a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs +++ b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
47 | 47 | ||
48 | public string Name { get { return "OspInventoryWrapperPlugin"; } } | 48 | public string Name { get { return "OspInventoryWrapperPlugin"; } } |
49 | public string Version { get { return "0.1"; } } | 49 | public string Version { get { return "0.1"; } } |
50 | public void Initialise() {} | 50 | public void Initialise() {} |
51 | public void Initialise(string connect) {} | 51 | public void Initialise(string connect) {} |
52 | public void Dispose() {} | 52 | public void Dispose() {} |
53 | 53 | ||
@@ -80,9 +80,9 @@ namespace OpenSim.Framework.Communications.Osp | |||
80 | } | 80 | } |
81 | 81 | ||
82 | protected InventoryItemBase PostProcessItem(InventoryItemBase item) | 82 | protected InventoryItemBase PostProcessItem(InventoryItemBase item) |
83 | { | 83 | { |
84 | item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); | 84 | item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); |
85 | return item; | 85 | return item; |
86 | } | 86 | } |
87 | 87 | ||
88 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); } | 88 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); } |
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index e98317a..32f0efc 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs | |||
@@ -33,13 +33,13 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Communications.Osp | 35 | namespace OpenSim.Framework.Communications.Osp |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for | 38 | /// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for |
39 | /// identifying user profiles or supplying a simple name if no profile is available. | 39 | /// identifying user profiles or supplying a simple name if no profile is available. |
40 | /// </summary> | 40 | /// </summary> |
41 | public class OspResolver | 41 | public class OspResolver |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | public const string OSPA_PREFIX = "ospa:"; | 45 | public const string OSPA_PREFIX = "ospa:"; |
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
73 | { | 73 | { |
74 | return | 74 | return |
75 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; | 75 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; |
76 | } | 76 | } |
77 | 77 | ||
78 | /// <summary> | 78 | /// <summary> |
79 | /// Resolve an osp string into the most suitable internal OpenSim identifier. | 79 | /// Resolve an osp string into the most suitable internal OpenSim identifier. |
@@ -89,13 +89,13 @@ namespace OpenSim.Framework.Communications.Osp | |||
89 | /// is returned. | 89 | /// is returned. |
90 | /// </returns> | 90 | /// </returns> |
91 | public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager) | 91 | public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager) |
92 | { | 92 | { |
93 | if (!ospa.StartsWith(OSPA_PREFIX)) | 93 | if (!ospa.StartsWith(OSPA_PREFIX)) |
94 | return UUID.Zero; | 94 | return UUID.Zero; |
95 | 95 | ||
96 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); | 96 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); |
97 | 97 | ||
98 | string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); | 98 | string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); |
99 | string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); | 99 | string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); |
100 | 100 | ||
101 | foreach (string tuple in ospaTuples) | 101 | foreach (string tuple in ospaTuples) |
@@ -162,7 +162,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
162 | tempUserProfile.ID = HashName(tempUserProfile.Name); | 162 | tempUserProfile.ID = HashName(tempUserProfile.Name); |
163 | 163 | ||
164 | m_log.DebugFormat( | 164 | m_log.DebugFormat( |
165 | "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); | 165 | "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); |
166 | commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); | 166 | commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); |
167 | 167 | ||
168 | return tempUserProfile.ID; | 168 | return tempUserProfile.ID; |
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index bf59f8e..922cd49 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs | |||
@@ -1072,7 +1072,7 @@ namespace OpenSim.Framework.Communications.Services | |||
1072 | /// <param name="user"></param> | 1072 | /// <param name="user"></param> |
1073 | /// <param name="response"></param> | 1073 | /// <param name="response"></param> |
1074 | /// <param name="remoteClient"></param> | 1074 | /// <param name="remoteClient"></param> |
1075 | /// <returns>true if the region was successfully contacted, false otherwise</returns> | 1075 | /// <returns>true if the region was successfully contacted, false otherwise</returns> |
1076 | protected abstract bool PrepareLoginToRegion( | 1076 | protected abstract bool PrepareLoginToRegion( |
1077 | RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client); | 1077 | RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client); |
1078 | 1078 | ||
@@ -1221,11 +1221,13 @@ namespace OpenSim.Framework.Communications.Services | |||
1221 | { | 1221 | { |
1222 | return Util.CreateUnknownUserErrorResponse(); | 1222 | return Util.CreateUnknownUserErrorResponse(); |
1223 | } | 1223 | } |
1224 | |||
1224 | UUID.TryParse((string)requestData["session_id"], out guess_sid); | 1225 | UUID.TryParse((string)requestData["session_id"], out guess_sid); |
1225 | if (guess_sid == UUID.Zero) | 1226 | if (guess_sid == UUID.Zero) |
1226 | { | 1227 | { |
1227 | return Util.CreateUnknownUserErrorResponse(); | 1228 | return Util.CreateUnknownUserErrorResponse(); |
1228 | } | 1229 | } |
1230 | |||
1229 | if (m_userManager.VerifySession(guess_aid, guess_sid)) | 1231 | if (m_userManager.VerifySession(guess_aid, guess_sid)) |
1230 | { | 1232 | { |
1231 | authed = "TRUE"; | 1233 | authed = "TRUE"; |
@@ -1243,6 +1245,5 @@ namespace OpenSim.Framework.Communications.Services | |||
1243 | response.Value = responseData; | 1245 | response.Value = responseData; |
1244 | return response; | 1246 | return response; |
1245 | } | 1247 | } |
1246 | |||
1247 | } | 1248 | } |
1248 | } | 1249 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs index 43f1440..2413055 100644 --- a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs +++ b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs | |||
@@ -33,9 +33,9 @@ using OpenMetaverse; | |||
33 | using OpenSim.Data; | 33 | using OpenSim.Data; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Communications | 35 | namespace OpenSim.Framework.Communications |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Plugin for managing temporary user profiles. | 38 | /// Plugin for managing temporary user profiles. |
39 | /// </summary> | 39 | /// </summary> |
40 | public class TemporaryUserProfilePlugin : IUserDataPlugin | 40 | public class TemporaryUserProfilePlugin : IUserDataPlugin |
41 | { | 41 | { |
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications | |||
45 | 45 | ||
46 | public string Name { get { return "TemporaryUserProfilePlugin"; } } | 46 | public string Name { get { return "TemporaryUserProfilePlugin"; } } |
47 | public string Version { get { return "0.1"; } } | 47 | public string Version { get { return "0.1"; } } |
48 | public void Initialise() {} | 48 | public void Initialise() {} |
49 | public void Initialise(string connect) {} | 49 | public void Initialise(string connect) {} |
50 | public void Dispose() {} | 50 | public void Dispose() {} |
51 | 51 | ||
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs index ac0dc6d..caaebd7 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | |||
@@ -149,6 +149,11 @@ namespace OpenSim.Framework.Communications.Tests | |||
149 | { | 149 | { |
150 | throw new NotImplementedException(); | 150 | throw new NotImplementedException(); |
151 | } | 151 | } |
152 | |||
153 | public virtual bool AuthenticateUserByPassword(UUID userID, string password) | ||
154 | { | ||
155 | throw new NotImplementedException(); | ||
156 | } | ||
152 | } | 157 | } |
153 | } | 158 | } |
154 | } | 159 | } |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index e5d8895..830c877 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -133,7 +133,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
133 | 133 | ||
134 | timedOut = true; | 134 | timedOut = true; |
135 | lock (this) | 135 | lock (this) |
136 | { | 136 | { |
137 | UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); | 137 | UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
138 | Monitor.Wait(this, 60000); | 138 | Monitor.Wait(this, 60000); |
139 | } | 139 | } |
@@ -150,7 +150,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
150 | CachedUserInfo userInfo; | 150 | CachedUserInfo userInfo; |
151 | 151 | ||
152 | lock (this) | 152 | lock (this) |
153 | { | 153 | { |
154 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); | 154 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
155 | Monitor.Wait(this, 60000); | 155 | Monitor.Wait(this, 60000); |
156 | } | 156 | } |
@@ -171,7 +171,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
171 | CachedUserInfo userInfo; | 171 | CachedUserInfo userInfo; |
172 | 172 | ||
173 | lock (this) | 173 | lock (this) |
174 | { | 174 | { |
175 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); | 175 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
176 | Monitor.Wait(this, 60000); | 176 | Monitor.Wait(this, 60000); |
177 | } | 177 | } |
@@ -206,7 +206,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
206 | CachedUserInfo userInfo; | 206 | CachedUserInfo userInfo; |
207 | 207 | ||
208 | lock (this) | 208 | lock (this) |
209 | { | 209 | { |
210 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); | 210 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
211 | Monitor.Wait(this, 60000); | 211 | Monitor.Wait(this, 60000); |
212 | } | 212 | } |
@@ -271,7 +271,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
271 | CachedUserInfo userInfo; | 271 | CachedUserInfo userInfo; |
272 | 272 | ||
273 | lock (this) | 273 | lock (this) |
274 | { | 274 | { |
275 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); | 275 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
276 | Monitor.Wait(this, 60000); | 276 | Monitor.Wait(this, 60000); |
277 | } | 277 | } |
@@ -311,7 +311,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
311 | CachedUserInfo userInfo; | 311 | CachedUserInfo userInfo; |
312 | 312 | ||
313 | lock (this) | 313 | lock (this) |
314 | { | 314 | { |
315 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); | 315 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
316 | Monitor.Wait(this, 60000); | 316 | Monitor.Wait(this, 60000); |
317 | } | 317 | } |
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 0a9d2ae..e891d9c 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -318,7 +318,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
318 | { | 318 | { |
319 | TestHelper.InMethod(); | 319 | TestHelper.InMethod(); |
320 | 320 | ||
321 | //Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | 321 | //Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); |
322 | //log4net.Config.XmlConfigurator.Configure(); | 322 | //log4net.Config.XmlConfigurator.Configure(); |
323 | 323 | ||
324 | string error_already_logged = "You appear to be already logged in. " + | 324 | string error_already_logged = "You appear to be already logged in. " + |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 58174a0..bf4f331 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -44,7 +44,8 @@ namespace OpenSim.Framework.Communications | |||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Base class for user management (create, read, etc) | 45 | /// Base class for user management (create, read, etc) |
46 | /// </summary> | 46 | /// </summary> |
47 | public abstract class UserManagerBase : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication | 47 | public abstract class UserManagerBase |
48 | : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication | ||
48 | { | 49 | { |
49 | private static readonly ILog m_log | 50 | private static readonly ILog m_log |
50 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -649,15 +650,17 @@ namespace OpenSim.Framework.Communications | |||
649 | public virtual UUID AddUser( | 650 | public virtual UUID AddUser( |
650 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) | 651 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) |
651 | { | 652 | { |
652 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); | ||
653 | 653 | ||
654 | UserProfileData user = new UserProfileData(); | 654 | UserProfileData user = new UserProfileData(); |
655 | |||
656 | user.PasswordSalt = Util.Md5Hash(UUID.Random().ToString()); | ||
657 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + user.PasswordSalt); | ||
658 | |||
655 | user.HomeLocation = new Vector3(128, 128, 100); | 659 | user.HomeLocation = new Vector3(128, 128, 100); |
656 | user.ID = SetUUID; | 660 | user.ID = SetUUID; |
657 | user.FirstName = firstName; | 661 | user.FirstName = firstName; |
658 | user.SurName = lastName; | 662 | user.SurName = lastName; |
659 | user.PasswordHash = md5PasswdHash; | 663 | user.PasswordHash = md5PasswdHash; |
660 | user.PasswordSalt = String.Empty; | ||
661 | user.Created = Util.UnixTimeSinceEpoch(); | 664 | user.Created = Util.UnixTimeSinceEpoch(); |
662 | user.HomeLookAt = new Vector3(100, 100, 100); | 665 | user.HomeLookAt = new Vector3(100, 100, 100); |
663 | user.HomeRegionX = regX; | 666 | user.HomeRegionX = regX; |
@@ -891,7 +894,10 @@ namespace OpenSim.Framework.Communications | |||
891 | 894 | ||
892 | if (userProfile != null && userProfile.CurrentAgent != null) | 895 | if (userProfile != null && userProfile.CurrentAgent != null) |
893 | { | 896 | { |
894 | m_log.DebugFormat("[USER AUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID); | 897 | m_log.DebugFormat( |
898 | "[USER AUTH]: Verifying session {0} for {1}; current session {2}", | ||
899 | sessionID, userID, userProfile.CurrentAgent.SessionID); | ||
900 | |||
895 | if (userProfile.CurrentAgent.SessionID == sessionID) | 901 | if (userProfile.CurrentAgent.SessionID == sessionID) |
896 | { | 902 | { |
897 | return true; | 903 | return true; |
@@ -901,6 +907,26 @@ namespace OpenSim.Framework.Communications | |||
901 | return false; | 907 | return false; |
902 | } | 908 | } |
903 | 909 | ||
910 | public virtual bool AuthenticateUserByPassword(UUID userID, string password) | ||
911 | { | ||
912 | // m_log.DebugFormat("[USER AUTH]: Authenticating user {0} given password {1}", userID, password); | ||
913 | |||
914 | UserProfileData userProfile = GetUserProfile(userID); | ||
915 | |||
916 | if (null == userProfile) | ||
917 | return false; | ||
918 | |||
919 | string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt); | ||
920 | |||
921 | // m_log.DebugFormat( | ||
922 | // "[USER AUTH]: Submitted hash {0}, stored hash {1}", md5PasswordHash, userProfile.PasswordHash); | ||
923 | |||
924 | if (md5PasswordHash == userProfile.PasswordHash) | ||
925 | return true; | ||
926 | else | ||
927 | return false; | ||
928 | } | ||
929 | |||
904 | #endregion | 930 | #endregion |
905 | } | 931 | } |
906 | } | 932 | } |