From 7870152d23db4cb6f5834d4921fac17feb717220 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 14:54:12 +0100 Subject: Allow load/save iar password checks to be done in grid mode This should allow load/save iar to work for grid mode as long as the grid user service is later than this revision Grid services of earlier revisions will always erroneously report incorrect password. This will be addressed shortly. --- OpenSim/Grid/UserServer.Modules/UserManager.cs | 56 +++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer.Modules') diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index 002f232..bc19ac8 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs @@ -108,6 +108,9 @@ namespace OpenSim.Grid.UserServer.Modules m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); + // Used by IAR module to do password checks + //m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword); + m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); @@ -203,6 +206,57 @@ namespace OpenSim.Grid.UserServer.Modules #region XMLRPC User Methods + /// + /// Authenticate a user using their password + /// + /// Must contain values for "user_uuid" and "password" keys + /// + /// + public XmlRpcResponse XmlRPCAuthenticateUserMethodPassword(XmlRpcRequest request, IPEndPoint remoteClient) + { +// m_log.DebugFormat("[USER MANAGER]: Received authenticated user by password request from {0}", remoteClient); + + Hashtable requestData = (Hashtable)request.Params[0]; + string userUuidRaw = (string)requestData["user_uuid"]; + string password = (string)requestData["password"]; + + if (null == userUuidRaw) + return Util.CreateUnknownUserErrorResponse(); + + UUID userUuid; + if (!UUID.TryParse(userUuidRaw, out userUuid)) + return Util.CreateUnknownUserErrorResponse(); + + UserProfileData userProfile = m_userDataBaseService.GetUserProfile(userUuid); + if (null == userProfile) + return Util.CreateUnknownUserErrorResponse(); + + string authed; + + if (null == password) + { + authed = "FALSE"; + } + else + { + if (m_userDataBaseService.AuthenticateUserByPassword(userUuid, password)) + authed = "TRUE"; + else + authed = "FALSE"; + } + +// m_log.DebugFormat( +// "[USER MANAGER]: Authentication by password result from {0} for {1} is {2}", +// remoteClient, userUuid, authed); + + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable responseData = new Hashtable(); + responseData["auth_user"] = authed; + response.Value = responseData; + + return response; + } + public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient) { // XmlRpcResponse response = new XmlRpcResponse(); @@ -246,10 +300,10 @@ namespace OpenSim.Grid.UserServer.Modules m_userDataBaseService.CommitAgent(ref userProfile); //setUserProfile(userProfile); - returnstring = "TRUE"; } } + responseData.Add("returnString", returnstring); response.Value = responseData; return response; -- cgit v1.1 From e1abc3d4c49ae4068faf7b8d1dcb220829429757 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 15:22:47 +0100 Subject: re-enable registration of user service authentication method I accidentally disabled a few commits ago load/save iar on a grid should now work, provided that the user service is this revision or newer --- OpenSim/Grid/UserServer.Modules/UserManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer.Modules') diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index bc19ac8..efbf45e 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs @@ -109,7 +109,7 @@ namespace OpenSim.Grid.UserServer.Modules m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); // Used by IAR module to do password checks - //m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword); + m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword); m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); -- cgit v1.1 From 0766b6dc34b972026846360767a20e2f11325c70 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Sep 2009 20:44:43 -0700 Subject: Fixed the connection from User server to GridServer. --- .../Grid/UserServer.Modules/UserLoginService.cs | 62 +++++++++++----------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'OpenSim/Grid/UserServer.Modules') diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 01d5537..2ca5ada 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -34,6 +34,7 @@ using System.Text.RegularExpressions; using log4net; using Nwc.XmlRpc; using OpenMetaverse; +using Nini.Config; using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Grid.UserServer.Modules { @@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules public UserConfig m_config; private readonly IRegionProfileRouter m_regionProfileService; + private IGridService m_GridService; + protected BaseHttpServer m_httpServer; public UserLoginService( @@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules m_defaultHomeY = m_config.DefaultY; m_interInventoryService = inventoryService; m_regionProfileService = regionProfileService; + + m_GridService = new GridServicesConnector(config.GridServerURL.ToString()); } public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) @@ -203,47 +211,37 @@ namespace OpenSim.Grid.UserServer.Modules protected override RegionInfo RequestClosestRegion(string region) { - RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, - m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); - - if (profileData != null) - { - return profileData.ToRegionInfo(); - } - else - { - return null; - } + return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region)); } protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) { - RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, - m_config.GridServerURL, m_config.GridSendKey, - m_config.GridRecvKey); - if (profileData != null) - { - return profileData.ToRegionInfo(); - } - else - { - return null; - } + uint x = 0, y = 0; + Utils.LongToUInts(homeRegionHandle, out x, out y); + return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y)); } protected override RegionInfo GetRegionInfo(UUID homeRegionId) { - RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, - m_config.GridServerURL, m_config.GridSendKey, - m_config.GridRecvKey); - if (profileData != null) - { - return profileData.ToRegionInfo(); - } - else - { + return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId)); + } + + private RegionInfo GridRegionToRegionInfo(GridRegion gregion) + { + if (gregion == null) return null; - } + + RegionInfo rinfo = new RegionInfo(); + rinfo.ExternalHostName = gregion.ExternalHostName; + rinfo.HttpPort = gregion.HttpPort; + rinfo.InternalEndPoint = gregion.InternalEndPoint; + rinfo.RegionID = gregion.RegionID; + rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize); + rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); + rinfo.RegionName = gregion.RegionName; + rinfo.ScopeID = gregion.ScopeID; + + return rinfo; } protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) -- cgit v1.1 From 73a61a8a32f18f4a003cbf0f4d6e876badea69ce Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Sep 2009 21:14:31 -0700 Subject: Fixed small bug in having to deal with RegionInfo's ServerURI, which wasn't being set. --- OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Grid/UserServer.Modules') diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 2ca5ada..66fc24e 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -240,6 +240,7 @@ namespace OpenSim.Grid.UserServer.Modules rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); rinfo.RegionName = gregion.RegionName; rinfo.ScopeID = gregion.ScopeID; + rinfo.ServerURI = "http://" + gregion.ExternalHostName + ":" + gregion.HttpPort.ToString(); return rinfo; } -- cgit v1.1 From 3091e5db9d6d46191d52a21ef5c25feb76ed703a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 07:53:52 -0700 Subject: Fixed bug in user server related to region's serverURI. --- OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer.Modules') diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 66fc24e..47bbeca 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -240,7 +240,7 @@ namespace OpenSim.Grid.UserServer.Modules rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); rinfo.RegionName = gregion.RegionName; rinfo.ScopeID = gregion.ScopeID; - rinfo.ServerURI = "http://" + gregion.ExternalHostName + ":" + gregion.HttpPort.ToString(); + rinfo.ServerURI = gregion.ServerURI; return rinfo; } -- cgit v1.1 From 6653a30487d76760451467a22849aba725f1e7cf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 20:58:21 -0700 Subject: Fixed bug in HG that was causing secondlife:// refs to bomb the client. Also fiddled a bit more with the initial CAP in the user server. --- OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Grid/UserServer.Modules') diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 47bbeca..c95e054 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -279,9 +279,8 @@ namespace OpenSim.Grid.UserServer.Modules //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); // Take off trailing / so that the caps path isn't //CAPS/someUUID - if (regionInfo.httpServerURI.EndsWith("/")) - regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); - response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); + string uri = regionInfo.httpServerURI.Trim(new char[] { '/' }); + response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath); // Notify the target of an incoming user -- cgit v1.1 From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 01:00:09 +0900 Subject: Formatting cleanup. --- OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs | 2 +- OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 2 +- OpenSim/Grid/UserServer.Modules/UserManager.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Grid/UserServer.Modules') 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 /// /// Hypergrid login service used in grid mode. - /// + /// public class UserLoginAuthService : HGLoginAuthService { 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 c95e054..7d0e0de 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -55,7 +55,7 @@ namespace OpenSim.Grid.UserServer.Modules /// /// Login service used in grid mode. - /// + /// public class UserLoginService : LoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index efbf45e..36c6297 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs @@ -229,7 +229,7 @@ namespace OpenSim.Grid.UserServer.Modules UserProfileData userProfile = m_userDataBaseService.GetUserProfile(userUuid); if (null == userProfile) - return Util.CreateUnknownUserErrorResponse(); + return Util.CreateUnknownUserErrorResponse(); string authed; @@ -249,12 +249,12 @@ namespace OpenSim.Grid.UserServer.Modules // "[USER MANAGER]: Authentication by password result from {0} for {1} is {2}", // remoteClient, userUuid, authed); - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable responseData = new Hashtable(); responseData["auth_user"] = authed; response.Value = responseData; - return response; + return response; } public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient) -- cgit v1.1