From dc7e3ddc3e5a622ae86670830530aa4a2206e762 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Thu, 23 Oct 2008 11:14:25 +0000 Subject: [PATCH] fix: recent patch to XmlRpcCreateRegionMethod introduced master avatar UUID parameter without checking for it at the method entry. this patch adds logic to obtain the master UUID via the user profile service, and, if the master avatar does not exist, will create the user. in any case the UUID is then the one supplied by the user profile service. --- .../RemoteController/RemoteAdminPlugin.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index d7ca67991e..f29a62f29e 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -441,12 +441,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); - region.ExternalHostName = (string) requestData["external_address"]; + region.ExternalHostName = (string)requestData["external_address"]; - region.MasterAvatarFirstName = (string) requestData["region_master_first"]; - region.MasterAvatarLastName = (string) requestData["region_master_last"]; - region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"]; - region.MasterAvatarAssignedUUID = new UUID(requestData["region_master_uuid"].ToString()); + string masterFirst = (string)requestData["region_master_first"]; + string masterLast = (string)requestData["region_master_last"]; + string masterPassword = (string)requestData["region_master_password"]; + + UUID userID = UUID.Zero; + UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(masterFirst, masterLast); + if (null == userProfile) + { + m_log.InfoFormat("master avatar does not exist, creating it"); + userID = m_app.CreateUser(masterFirst, masterLast, masterPassword, region.RegionLocX, region.RegionLocY); + if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", + masterFirst, masterLast)); + } + else + { + userID = userProfile.ID; + } + + region.MasterAvatarFirstName = masterFirst; + region.MasterAvatarLastName = masterLast; + region.MasterAvatarSandboxPassword = masterPassword; + region.MasterAvatarAssignedUUID = userID; bool persist = Convert.ToBoolean((string)requestData["persist"]); if (persist)