diff options
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs | 448 |
1 files changed, 224 insertions, 224 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs index a910136..4811434 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs | |||
@@ -1,224 +1,224 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text.RegularExpressions; | 32 | using System.Text.RegularExpressions; |
33 | using log4net; | 33 | using log4net; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | 36 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Services; | 39 | using OpenSim.Framework.Communications.Services; |
40 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Communications.Capabilities; | 41 | using OpenSim.Framework.Communications.Capabilities; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | 43 | ||
44 | namespace OpenSim.Grid.UserServer.Modules | 44 | namespace OpenSim.Grid.UserServer.Modules |
45 | { | 45 | { |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Hypergrid login service used in grid mode. | 48 | /// Hypergrid login service used in grid mode. |
49 | /// </summary> | 49 | /// </summary> |
50 | public class UserLoginAuthService : HGLoginAuthService | 50 | public class UserLoginAuthService : HGLoginAuthService |
51 | { | 51 | { |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | public UserConfig m_config; | 54 | public UserConfig m_config; |
55 | private readonly IRegionProfileRouter m_regionProfileService; | 55 | private readonly IRegionProfileRouter m_regionProfileService; |
56 | 56 | ||
57 | protected BaseHttpServer m_httpServer; | 57 | protected BaseHttpServer m_httpServer; |
58 | 58 | ||
59 | public UserLoginAuthService( | 59 | public UserLoginAuthService( |
60 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, | 60 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, |
61 | LibraryRootFolder libraryRootFolder, | 61 | LibraryRootFolder libraryRootFolder, |
62 | UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService) | 62 | UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService) |
63 | : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null) | 63 | : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null) |
64 | { | 64 | { |
65 | m_config = config; | 65 | m_config = config; |
66 | m_defaultHomeX = m_config.DefaultX; | 66 | m_defaultHomeX = m_config.DefaultX; |
67 | m_defaultHomeY = m_config.DefaultY; | 67 | m_defaultHomeY = m_config.DefaultY; |
68 | m_inventoryService = inventoryService; | 68 | m_inventoryService = inventoryService; |
69 | m_regionProfileService = regionProfileService; | 69 | m_regionProfileService = regionProfileService; |
70 | 70 | ||
71 | NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000); | 71 | NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000); |
72 | serversinfo.GridRecvKey = m_config.GridRecvKey; | 72 | serversinfo.GridRecvKey = m_config.GridRecvKey; |
73 | serversinfo.GridSendKey = m_config.GridSendKey; | 73 | serversinfo.GridSendKey = m_config.GridSendKey; |
74 | serversinfo.GridURL = m_config.GridServerURL.ToString(); | 74 | serversinfo.GridURL = m_config.GridServerURL.ToString(); |
75 | serversinfo.InventoryURL = m_config.InventoryUrl.ToString(); | 75 | serversinfo.InventoryURL = m_config.InventoryUrl.ToString(); |
76 | serversinfo.UserURL = m_config.AuthUrl.ToString(); | 76 | serversinfo.UserURL = m_config.AuthUrl.ToString(); |
77 | SetServersInfo(serversinfo); | 77 | SetServersInfo(serversinfo); |
78 | } | 78 | } |
79 | 79 | ||
80 | public void RegisterHandlers(BaseHttpServer httpServer) | 80 | public void RegisterHandlers(BaseHttpServer httpServer) |
81 | { | 81 | { |
82 | m_httpServer = httpServer; | 82 | m_httpServer = httpServer; |
83 | 83 | ||
84 | httpServer.AddXmlRPCHandler("hg_login", XmlRpcLoginMethod); | 84 | httpServer.AddXmlRPCHandler("hg_login", XmlRpcLoginMethod); |
85 | httpServer.AddXmlRPCHandler("hg_new_auth_key", XmlRpcGenerateKeyMethod); | 85 | httpServer.AddXmlRPCHandler("hg_new_auth_key", XmlRpcGenerateKeyMethod); |
86 | httpServer.AddXmlRPCHandler("hg_verify_auth_key", XmlRpcVerifyKeyMethod); | 86 | httpServer.AddXmlRPCHandler("hg_verify_auth_key", XmlRpcVerifyKeyMethod); |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | public override void LogOffUser(UserProfileData theUser, string message) | 90 | public override void LogOffUser(UserProfileData theUser, string message) |
91 | { | 91 | { |
92 | RegionProfileData SimInfo; | 92 | RegionProfileData SimInfo; |
93 | try | 93 | try |
94 | { | 94 | { |
95 | SimInfo = m_regionProfileService.RequestSimProfileData( | 95 | SimInfo = m_regionProfileService.RequestSimProfileData( |
96 | theUser.CurrentAgent.Handle, m_config.GridServerURL, | 96 | theUser.CurrentAgent.Handle, m_config.GridServerURL, |
97 | m_config.GridSendKey, m_config.GridRecvKey); | 97 | m_config.GridSendKey, m_config.GridRecvKey); |
98 | 98 | ||
99 | if (SimInfo == null) | 99 | if (SimInfo == null) |
100 | { | 100 | { |
101 | m_log.Error("[GRID]: Region user was in isn't currently logged in"); | 101 | m_log.Error("[GRID]: Region user was in isn't currently logged in"); |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | catch (Exception) | 105 | catch (Exception) |
106 | { | 106 | { |
107 | m_log.Error("[GRID]: Unable to look up region to log user off"); | 107 | m_log.Error("[GRID]: Unable to look up region to log user off"); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | 110 | ||
111 | // Prepare notification | 111 | // Prepare notification |
112 | Hashtable SimParams = new Hashtable(); | 112 | Hashtable SimParams = new Hashtable(); |
113 | SimParams["agent_id"] = theUser.ID.ToString(); | 113 | SimParams["agent_id"] = theUser.ID.ToString(); |
114 | SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString(); | 114 | SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString(); |
115 | SimParams["region_secret2"] = SimInfo.regionSecret; | 115 | SimParams["region_secret2"] = SimInfo.regionSecret; |
116 | //m_log.Info(SimInfo.regionSecret); | 116 | //m_log.Info(SimInfo.regionSecret); |
117 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); | 117 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); |
118 | SimParams["message"] = message; | 118 | SimParams["message"] = message; |
119 | ArrayList SendParams = new ArrayList(); | 119 | ArrayList SendParams = new ArrayList(); |
120 | SendParams.Add(SimParams); | 120 | SendParams.Add(SimParams); |
121 | 121 | ||
122 | m_log.InfoFormat( | 122 | m_log.InfoFormat( |
123 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | 123 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", |
124 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | 124 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, |
125 | theUser.FirstName + " " + theUser.SurName); | 125 | theUser.FirstName + " " + theUser.SurName); |
126 | 126 | ||
127 | try | 127 | try |
128 | { | 128 | { |
129 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); | 129 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); |
130 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 130 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
131 | 131 | ||
132 | if (GridResp.IsFault) | 132 | if (GridResp.IsFault) |
133 | { | 133 | { |
134 | m_log.ErrorFormat( | 134 | m_log.ErrorFormat( |
135 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", | 135 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", |
136 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | 136 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | catch (Exception) | 139 | catch (Exception) |
140 | { | 140 | { |
141 | m_log.Error("[LOGIN]: Error telling region to logout user!"); | 141 | m_log.Error("[LOGIN]: Error telling region to logout user!"); |
142 | } | 142 | } |
143 | 143 | ||
144 | // Prepare notification | 144 | // Prepare notification |
145 | SimParams = new Hashtable(); | 145 | SimParams = new Hashtable(); |
146 | SimParams["agent_id"] = theUser.ID.ToString(); | 146 | SimParams["agent_id"] = theUser.ID.ToString(); |
147 | SimParams["region_secret"] = SimInfo.regionSecret; | 147 | SimParams["region_secret"] = SimInfo.regionSecret; |
148 | //m_log.Info(SimInfo.regionSecret); | 148 | //m_log.Info(SimInfo.regionSecret); |
149 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); | 149 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); |
150 | SimParams["message"] = message; | 150 | SimParams["message"] = message; |
151 | SendParams = new ArrayList(); | 151 | SendParams = new ArrayList(); |
152 | SendParams.Add(SimParams); | 152 | SendParams.Add(SimParams); |
153 | 153 | ||
154 | m_log.InfoFormat( | 154 | m_log.InfoFormat( |
155 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | 155 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", |
156 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | 156 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, |
157 | theUser.FirstName + " " + theUser.SurName); | 157 | theUser.FirstName + " " + theUser.SurName); |
158 | 158 | ||
159 | try | 159 | try |
160 | { | 160 | { |
161 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); | 161 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); |
162 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 162 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
163 | 163 | ||
164 | if (GridResp.IsFault) | 164 | if (GridResp.IsFault) |
165 | { | 165 | { |
166 | m_log.ErrorFormat( | 166 | m_log.ErrorFormat( |
167 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", | 167 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", |
168 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | 168 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | catch (Exception) | 171 | catch (Exception) |
172 | { | 172 | { |
173 | m_log.Error("[LOGIN]: Error telling region to logout user!"); | 173 | m_log.Error("[LOGIN]: Error telling region to logout user!"); |
174 | } | 174 | } |
175 | //base.LogOffUser(theUser); | 175 | //base.LogOffUser(theUser); |
176 | } | 176 | } |
177 | 177 | ||
178 | protected override RegionInfo RequestClosestRegion(string region) | 178 | protected override RegionInfo RequestClosestRegion(string region) |
179 | { | 179 | { |
180 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, | 180 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, |
181 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 181 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); |
182 | 182 | ||
183 | if (profileData != null) | 183 | if (profileData != null) |
184 | { | 184 | { |
185 | return profileData.ToRegionInfo(); | 185 | return profileData.ToRegionInfo(); |
186 | } | 186 | } |
187 | else | 187 | else |
188 | { | 188 | { |
189 | return null; | 189 | return null; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) | 193 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) |
194 | { | 194 | { |
195 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, | 195 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, |
196 | m_config.GridServerURL, m_config.GridSendKey, | 196 | m_config.GridServerURL, m_config.GridSendKey, |
197 | m_config.GridRecvKey); | 197 | m_config.GridRecvKey); |
198 | if (profileData != null) | 198 | if (profileData != null) |
199 | { | 199 | { |
200 | return profileData.ToRegionInfo(); | 200 | return profileData.ToRegionInfo(); |
201 | } | 201 | } |
202 | else | 202 | else |
203 | { | 203 | { |
204 | return null; | 204 | return null; |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) | 208 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) |
209 | { | 209 | { |
210 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, | 210 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, |
211 | m_config.GridServerURL, m_config.GridSendKey, | 211 | m_config.GridServerURL, m_config.GridSendKey, |
212 | m_config.GridRecvKey); | 212 | m_config.GridRecvKey); |
213 | if (profileData != null) | 213 | if (profileData != null) |
214 | { | 214 | { |
215 | return profileData.ToRegionInfo(); | 215 | return profileData.ToRegionInfo(); |
216 | } | 216 | } |
217 | else | 217 | else |
218 | { | 218 | { |
219 | return null; | 219 | return null; |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | } | 223 | } |
224 | } | 224 | } |