aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageService.cs86
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs2
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs2
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserLoginService.cs70
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserManager.cs56
-rw-r--r--OpenSim/Grid/UserServer/Main.cs8
-rw-r--r--OpenSim/Grid/UserServer/UserServerCommsManager.cs4
7 files changed, 146 insertions, 82 deletions
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
index 6f2c1ba..df5eaab 100644
--- a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
@@ -324,44 +324,53 @@ namespace OpenSim.Grid.MessagingServer.Modules
324 /// <returns></returns> 324 /// <returns></returns>
325 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request, IPEndPoint remoteClient) 325 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request, IPEndPoint remoteClient)
326 { 326 {
327 Hashtable requestData = (Hashtable)request.Params[0]; 327 try
328 {
329 Hashtable requestData = (Hashtable)request.Params[0];
330
331 AgentCircuitData agentData = new AgentCircuitData();
332 agentData.SessionID = new UUID((string)requestData["sessionid"]);
333 agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]);
334 agentData.firstname = (string)requestData["firstname"];
335 agentData.lastname = (string)requestData["lastname"];
336 agentData.AgentID = new UUID((string)requestData["agentid"]);
337 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
338 agentData.CapsPath = (string)requestData["caps_path"];
339
340 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
341 {
342 agentData.child = true;
343 }
344 else
345 {
346 agentData.startpos =
347 new Vector3(Convert.ToSingle(requestData["positionx"]),
348 Convert.ToSingle(requestData["positiony"]),
349 Convert.ToSingle(requestData["positionz"]));
350 agentData.child = false;
351 }
328 352
329 AgentCircuitData agentData = new AgentCircuitData(); 353 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
330 agentData.SessionID = new UUID((string)requestData["sessionid"]); 354
331 agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); 355 m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user",
332 agentData.firstname = (string)requestData["firstname"]; 356 agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root");
333 agentData.lastname = (string)requestData["lastname"]; 357
334 agentData.AgentID = new UUID((string)requestData["agentid"]); 358 UserPresenceData up = new UserPresenceData();
335 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 359 up.agentData = agentData;
336 agentData.CapsPath = (string)requestData["caps_path"]; 360 up.friendData = GetUserFriendList(agentData.AgentID);
361 up.regionData = m_regionModule.GetRegionInfo(regionHandle);
362 up.OnlineYN = true;
363 up.lookupUserRegionYN = false;
364 ProcessFriendListSubscriptions(up);
337 365
338 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
339 {
340 agentData.child = true;
341 } 366 }
342 else 367 catch (Exception e)
343 { 368 {
344 agentData.startpos = 369 m_log.WarnFormat("[LOGIN]: Exception on UserLoggedOn: {0}", e);
345 new Vector3(Convert.ToSingle(requestData["positionx"]),
346 Convert.ToSingle(requestData["positiony"]),
347 Convert.ToSingle(requestData["positionz"]));
348 agentData.child = false;
349 } 370 }
350 371
351 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
352
353 m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user",
354 agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root");
355
356 UserPresenceData up = new UserPresenceData();
357 up.agentData = agentData;
358 up.friendData = GetUserFriendList(agentData.AgentID);
359 up.regionData = m_regionModule.GetRegionInfo(regionHandle);
360 up.OnlineYN = true;
361 up.lookupUserRegionYN = false;
362 ProcessFriendListSubscriptions(up);
363
364 return new XmlRpcResponse(); 372 return new XmlRpcResponse();
373
365 } 374 }
366 375
367 /// <summary> 376 /// <summary>
@@ -372,11 +381,18 @@ namespace OpenSim.Grid.MessagingServer.Modules
372 /// <returns></returns> 381 /// <returns></returns>
373 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request, IPEndPoint remoteClient) 382 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request, IPEndPoint remoteClient)
374 { 383 {
375 m_log.Info("[USERLOGOFF]: User logged off called"); 384 try
376 Hashtable requestData = (Hashtable)request.Params[0]; 385 {
386 m_log.Info("[USERLOGOFF]: User logged off called");
387 Hashtable requestData = (Hashtable)request.Params[0];
377 388
378 UUID AgentID = new UUID((string)requestData["agentid"]); 389 UUID AgentID = new UUID((string)requestData["agentid"]);
379 ProcessLogOff(AgentID); 390 ProcessLogOff(AgentID);
391 }
392 catch (Exception e)
393 {
394 m_log.WarnFormat("[USERLOGOFF]: Exception on UserLoggedOff: {0}", e);
395 }
380 396
381 return new XmlRpcResponse(); 397 return new XmlRpcResponse();
382 } 398 }
diff --git a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs
index 8006119..76c4899 100644
--- a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs
@@ -70,6 +70,6 @@ namespace OpenSim.Grid.MessagingServer.Modules
70 { 70 {
71 //throw new Exception("The method or operation is not implemented."); 71 //throw new Exception("The method or operation is not implemented.");
72 return null; 72 return null;
73 } 73 }
74 } 74 }
75} 75}
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
index 9d31d81..77caf47 100644
--- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Grid.UserServer.Modules
47 47
48 /// <summary> 48 /// <summary>
49 /// Hypergrid login service used in grid mode. 49 /// Hypergrid login service used in grid mode.
50 /// </summary> 50 /// </summary>
51 public class UserLoginAuthService : HGLoginAuthService 51 public class UserLoginAuthService : HGLoginAuthService
52 { 52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
index 01d5537..7d0e0de 100644
--- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions;
34using log4net; 34using log4net;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenMetaverse; 36using OpenMetaverse;
37using Nini.Config;
37using OpenSim.Data; 38using OpenSim.Data;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Framework.Communications; 40using OpenSim.Framework.Communications;
@@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache;
42using OpenSim.Framework.Capabilities; 43using OpenSim.Framework.Capabilities;
43using OpenSim.Framework.Servers; 44using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer; 45using OpenSim.Framework.Servers.HttpServer;
46using OpenSim.Services.Interfaces;
47using OpenSim.Services.Connectors;
48using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45 49
46namespace OpenSim.Grid.UserServer.Modules 50namespace OpenSim.Grid.UserServer.Modules
47{ 51{
@@ -51,7 +55,7 @@ namespace OpenSim.Grid.UserServer.Modules
51 55
52 /// <summary> 56 /// <summary>
53 /// Login service used in grid mode. 57 /// Login service used in grid mode.
54 /// </summary> 58 /// </summary>
55 public class UserLoginService : LoginService 59 public class UserLoginService : LoginService
56 { 60 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules
63 public UserConfig m_config; 67 public UserConfig m_config;
64 private readonly IRegionProfileRouter m_regionProfileService; 68 private readonly IRegionProfileRouter m_regionProfileService;
65 69
70 private IGridService m_GridService;
71
66 protected BaseHttpServer m_httpServer; 72 protected BaseHttpServer m_httpServer;
67 73
68 public UserLoginService( 74 public UserLoginService(
@@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules
76 m_defaultHomeY = m_config.DefaultY; 82 m_defaultHomeY = m_config.DefaultY;
77 m_interInventoryService = inventoryService; 83 m_interInventoryService = inventoryService;
78 m_regionProfileService = regionProfileService; 84 m_regionProfileService = regionProfileService;
85
86 m_GridService = new GridServicesConnector(config.GridServerURL.ToString());
79 } 87 }
80 88
81 public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) 89 public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers)
@@ -203,47 +211,38 @@ namespace OpenSim.Grid.UserServer.Modules
203 211
204 protected override RegionInfo RequestClosestRegion(string region) 212 protected override RegionInfo RequestClosestRegion(string region)
205 { 213 {
206 RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, 214 return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region));
207 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
208
209 if (profileData != null)
210 {
211 return profileData.ToRegionInfo();
212 }
213 else
214 {
215 return null;
216 }
217 } 215 }
218 216
219 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) 217 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
220 { 218 {
221 RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, 219 uint x = 0, y = 0;
222 m_config.GridServerURL, m_config.GridSendKey, 220 Utils.LongToUInts(homeRegionHandle, out x, out y);
223 m_config.GridRecvKey); 221 return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y));
224 if (profileData != null)
225 {
226 return profileData.ToRegionInfo();
227 }
228 else
229 {
230 return null;
231 }
232 } 222 }
233 223
234 protected override RegionInfo GetRegionInfo(UUID homeRegionId) 224 protected override RegionInfo GetRegionInfo(UUID homeRegionId)
235 { 225 {
236 RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, 226 return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId));
237 m_config.GridServerURL, m_config.GridSendKey, 227 }
238 m_config.GridRecvKey); 228
239 if (profileData != null) 229 private RegionInfo GridRegionToRegionInfo(GridRegion gregion)
240 { 230 {
241 return profileData.ToRegionInfo(); 231 if (gregion == null)
242 }
243 else
244 {
245 return null; 232 return null;
246 } 233
234 RegionInfo rinfo = new RegionInfo();
235 rinfo.ExternalHostName = gregion.ExternalHostName;
236 rinfo.HttpPort = gregion.HttpPort;
237 rinfo.InternalEndPoint = gregion.InternalEndPoint;
238 rinfo.RegionID = gregion.RegionID;
239 rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize);
240 rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize);
241 rinfo.RegionName = gregion.RegionName;
242 rinfo.ScopeID = gregion.ScopeID;
243 rinfo.ServerURI = gregion.ServerURI;
244
245 return rinfo;
247 } 246 }
248 247
249 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) 248 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
@@ -280,9 +279,8 @@ namespace OpenSim.Grid.UserServer.Modules
280 //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); 279 //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath);
281 280
282 // Take off trailing / so that the caps path isn't //CAPS/someUUID 281 // Take off trailing / so that the caps path isn't //CAPS/someUUID
283 if (regionInfo.httpServerURI.EndsWith("/")) 282 string uri = regionInfo.httpServerURI.Trim(new char[] { '/' });
284 regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); 283 response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath);
285 response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath);
286 284
287 285
288 // Notify the target of an incoming user 286 // Notify the target of an incoming user
diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs
index 002f232..36c6297 100644
--- a/OpenSim/Grid/UserServer.Modules/UserManager.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs
@@ -108,6 +108,9 @@ namespace OpenSim.Grid.UserServer.Modules
108 m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); 108 m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID);
109 m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); 109 m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar);
110 110
111 // Used by IAR module to do password checks
112 m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword);
113
111 m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); 114 m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion);
112 m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); 115 m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID);
113 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); 116 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID);
@@ -203,6 +206,57 @@ namespace OpenSim.Grid.UserServer.Modules
203 206
204 #region XMLRPC User Methods 207 #region XMLRPC User Methods
205 208
209 /// <summary>
210 /// Authenticate a user using their password
211 /// </summary>
212 /// <param name="request">Must contain values for "user_uuid" and "password" keys</param>
213 /// <param name="remoteClient"></param>
214 /// <returns></returns>
215 public XmlRpcResponse XmlRPCAuthenticateUserMethodPassword(XmlRpcRequest request, IPEndPoint remoteClient)
216 {
217// m_log.DebugFormat("[USER MANAGER]: Received authenticated user by password request from {0}", remoteClient);
218
219 Hashtable requestData = (Hashtable)request.Params[0];
220 string userUuidRaw = (string)requestData["user_uuid"];
221 string password = (string)requestData["password"];
222
223 if (null == userUuidRaw)
224 return Util.CreateUnknownUserErrorResponse();
225
226 UUID userUuid;
227 if (!UUID.TryParse(userUuidRaw, out userUuid))
228 return Util.CreateUnknownUserErrorResponse();
229
230 UserProfileData userProfile = m_userDataBaseService.GetUserProfile(userUuid);
231 if (null == userProfile)
232 return Util.CreateUnknownUserErrorResponse();
233
234 string authed;
235
236 if (null == password)
237 {
238 authed = "FALSE";
239 }
240 else
241 {
242 if (m_userDataBaseService.AuthenticateUserByPassword(userUuid, password))
243 authed = "TRUE";
244 else
245 authed = "FALSE";
246 }
247
248// m_log.DebugFormat(
249// "[USER MANAGER]: Authentication by password result from {0} for {1} is {2}",
250// remoteClient, userUuid, authed);
251
252 XmlRpcResponse response = new XmlRpcResponse();
253 Hashtable responseData = new Hashtable();
254 responseData["auth_user"] = authed;
255 response.Value = responseData;
256
257 return response;
258 }
259
206 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient) 260 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient)
207 { 261 {
208 // XmlRpcResponse response = new XmlRpcResponse(); 262 // XmlRpcResponse response = new XmlRpcResponse();
@@ -246,10 +300,10 @@ namespace OpenSim.Grid.UserServer.Modules
246 m_userDataBaseService.CommitAgent(ref userProfile); 300 m_userDataBaseService.CommitAgent(ref userProfile);
247 //setUserProfile(userProfile); 301 //setUserProfile(userProfile);
248 302
249
250 returnstring = "TRUE"; 303 returnstring = "TRUE";
251 } 304 }
252 } 305 }
306
253 responseData.Add("returnString", returnstring); 307 responseData.Add("returnString", returnstring);
254 response.Value = responseData; 308 response.Value = responseData;
255 return response; 309 return response;
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index baf0fd3..286076d7 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -187,13 +187,13 @@ namespace OpenSim.Grid.UserServer
187 /// <param name="inventoryService"></param> 187 /// <param name="inventoryService"></param>
188 protected virtual void StartupUserServerModules() 188 protected virtual void StartupUserServerModules()
189 { 189 {
190 m_log.Info("[STARTUP]: Establishing data connection"); 190 m_log.Info("[STARTUP]: Establishing data connection");
191 191
192 //we only need core components so we can request them from here 192 //we only need core components so we can request them from here
193 IInterServiceInventoryServices inventoryService; 193 IInterServiceInventoryServices inventoryService;
194 TryGet<IInterServiceInventoryServices>(out inventoryService); 194 TryGet<IInterServiceInventoryServices>(out inventoryService);
195 195
196 CommunicationsManager commsManager = new UserServerCommsManager(inventoryService); 196 CommunicationsManager commsManager = new UserServerCommsManager(inventoryService);
197 197
198 //setup database access service, for now this has to be created before the other modules. 198 //setup database access service, for now this has to be created before the other modules.
199 m_userDataBaseService = new UserDataBaseService(commsManager); 199 m_userDataBaseService = new UserDataBaseService(commsManager);
@@ -260,8 +260,6 @@ namespace OpenSim.Grid.UserServer
260 m_userManager.PostInitialise(); 260 m_userManager.PostInitialise();
261 m_avatarAppearanceModule.PostInitialise(); 261 m_avatarAppearanceModule.PostInitialise();
262 m_friendsModule.PostInitialise(); 262 m_friendsModule.PostInitialise();
263
264 m_avatarAppearanceModule.PostInitialise();
265 } 263 }
266 264
267 protected virtual void RegisterHttpHandlers() 265 protected virtual void RegisterHttpHandlers()
@@ -276,8 +274,6 @@ namespace OpenSim.Grid.UserServer
276 m_avatarAppearanceModule.RegisterHandlers(m_httpServer); 274 m_avatarAppearanceModule.RegisterHandlers(m_httpServer);
277 m_messagesService.RegisterHandlers(m_httpServer); 275 m_messagesService.RegisterHandlers(m_httpServer);
278 m_gridInfoService.RegisterHandlers(m_httpServer); 276 m_gridInfoService.RegisterHandlers(m_httpServer);
279
280 m_avatarAppearanceModule.RegisterHandlers(m_httpServer);
281 } 277 }
282 278
283 public override void ShutdownSpecific() 279 public override void ShutdownSpecific()
diff --git a/OpenSim/Grid/UserServer/UserServerCommsManager.cs b/OpenSim/Grid/UserServer/UserServerCommsManager.cs
index 7200836..8ef693b 100644
--- a/OpenSim/Grid/UserServer/UserServerCommsManager.cs
+++ b/OpenSim/Grid/UserServer/UserServerCommsManager.cs
@@ -28,9 +28,9 @@
28using OpenSim.Framework.Communications; 28using OpenSim.Framework.Communications;
29 29
30namespace OpenSim.Grid.UserServer 30namespace OpenSim.Grid.UserServer
31{ 31{
32 public class UserServerCommsManager : CommunicationsManager 32 public class UserServerCommsManager : CommunicationsManager
33 { 33 {
34 public UserServerCommsManager(IInterServiceInventoryServices interServiceInventoryService) 34 public UserServerCommsManager(IInterServiceInventoryServices interServiceInventoryService)
35 : base(null, null) 35 : base(null, null)
36 { 36 {