From 8457044b2f46e477442e3dec520c9a47ca20dd6b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 12 May 2014 22:23:24 +0100 Subject: Eliminate subsequently unused scene finding in UndeliveredMessage() method of xmlrpc and core offline IM modules --- OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs index 5ef068a..950e1fd 100644 --- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs +++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs @@ -226,10 +226,6 @@ namespace OpenSim.OfflineIM return; } - Scene scene = FindScene(new UUID(im.fromAgentID)); - if (scene == null) - scene = m_SceneList[0]; - string reason = string.Empty; bool success = m_OfflineIMService.StoreMessage(im, out reason); -- cgit v1.1 From d2c738fc09e4b4c9668cf5fb0114f909b6d6b808 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 May 2014 22:48:05 +0100 Subject: Don't warn on not seeing [Groups] Robust section for core groups as this does not contain any mandatory parameters and won't be present on older installations. --- OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 828965f..33dc301 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs @@ -64,8 +64,8 @@ namespace OpenSim.Groups key = groupsConfig.GetString("SecretKey", string.Empty); m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key); } - else - m_log.WarnFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName); +// else +// m_log.DebugFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName); m_GroupsService = new GroupsService(config); -- cgit v1.1 From b46be88db62bcfa7dcf70c3677a1a1270d177a22 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 May 2014 22:45:17 +0100 Subject: Split verbose groups messaging logging into its own setting separate from that of the groups module. This is to allow us to get useful information on messaging without being overwhelmed by the rest of groups debug. Enabled with [Groups] DebugMessagingEnabled = true in config (default false) Or "debug groups messaging verbose true|false on the console" (similar to existing groups setting). Done for both xmlrpc and V2 groups. --- OpenSim/Addons/Groups/GroupsMessagingModule.cs | 34 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs index bbb5e05..bd8db32 100644 --- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs +++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs @@ -56,8 +56,8 @@ namespace OpenSim.Groups private IGroupsServicesConnector m_groupData = null; // Config Options - private bool m_groupMessagingEnabled = false; - private bool m_debugEnabled = true; + private bool m_groupMessagingEnabled; + private bool m_debugEnabled; /// /// If enabled, module only tries to send group IMs to online users by querying cached presence information. @@ -120,7 +120,7 @@ namespace OpenSim.Groups return; } - m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); + m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled); m_log.InfoFormat( "[Groups.Messaging]: GroupsMessagingModule enabled with MessageOnlineOnly = {0}, DebugEnabled = {1}", @@ -140,6 +140,14 @@ namespace OpenSim.Groups scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnClientLogin += OnClientLogin; + + scene.AddCommand( + "Debug", + this, + "debug groups messaging verbose", + "debug groups messaging verbose ", + "This setting turns on very verbose groups messaging debugging", + HandleDebugGroupsMessagingVerbose); } public void RegionLoaded(Scene scene) @@ -227,6 +235,26 @@ namespace OpenSim.Groups #endregion + private void HandleDebugGroupsMessagingVerbose(object modules, string[] args) + { + if (args.Length < 5) + { + MainConsole.Instance.Output("Usage: debug groups messaging verbose "); + return; + } + + bool verbose = false; + if (!bool.TryParse(args[4], out verbose)) + { + MainConsole.Instance.Output("Usage: debug groups messaging verbose "); + return; + } + + m_debugEnabled = verbose; + + MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled); + } + /// /// Not really needed, but does confirm that the group exists. /// -- cgit v1.1 From 5ec3429843ecb8058698f663556ae1d4cae53434 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 May 2014 23:01:48 +0100 Subject: On verbose groups messaging logging, count all operations in reported time when sending group messages, not just those after get group members and get presence status, as applicable --- OpenSim/Addons/Groups/GroupsMessagingModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs index bd8db32..e6a4765 100644 --- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs +++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs @@ -283,6 +283,8 @@ namespace OpenSim.Groups public void SendMessageToGroup( GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func sendCondition) { + int requestStartTick = Environment.TickCount; + UUID fromAgentID = new UUID(im.fromAgentID); // Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent @@ -315,8 +317,6 @@ namespace OpenSim.Groups // "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", // groupID, groupMembersCount, groupMembers.Count()); - int requestStartTick = Environment.TickCount; - im.imSessionID = groupID.Guid; im.fromGroup = true; IClientAPI thisClient = GetActiveClient(fromAgentID); -- cgit v1.1 From 04aa13a086239b8d628821809bef9c9585c35f8f Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Thu, 22 May 2014 00:51:33 +0100 Subject: Fix mantis 6973. Prevent BOM being prefixed to message XML which was causing an exception when the service tried to read the data later on. Signed-off-by: Oren Hurvitz --- OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs index 690c955..02084ff 100644 --- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs +++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs @@ -104,7 +104,7 @@ namespace OpenSim.OfflineIM using (MemoryStream mstream = new MemoryStream()) { XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; + settings.Encoding = Util.UTF8NoBomEncoding; using (XmlWriter writer = XmlWriter.Create(mstream, settings)) { @@ -112,7 +112,7 @@ namespace OpenSim.OfflineIM writer.Flush(); } - imXml = Util.UTF8.GetString(mstream.ToArray()); + imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray()); } OfflineIMData data = new OfflineIMData(); -- cgit v1.1 From ff9da2446583ffd95b42e7ced2a86c2166c993c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 23 May 2014 17:31:39 -0700 Subject: Added HTTP Authentication also to Groups and offline IM. --- .../Groups/Remote/GroupsServiceRemoteConnector.cs | 33 ++++++++++++++++------ .../Remote/GroupsServiceRemoteConnectorModule.cs | 8 +----- .../Groups/Remote/GroupsServiceRobustConnector.cs | 25 ++++------------ OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs | 2 +- .../Remote/OfflineIMServiceRemoteConnector.cs | 17 ++++++++++- .../Remote/OfflineIMServiceRobustConnector.cs | 9 ++++-- 6 files changed, 55 insertions(+), 39 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs index 1425a23..7450c14 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs @@ -32,29 +32,47 @@ using System.Reflection; using System.Text; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenMetaverse; using log4net; +using Nini.Config; namespace OpenSim.Groups { - public class GroupsServiceRemoteConnector + public class GroupsServiceRemoteConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_ServerURI; - private string m_SecretKey; + private IServiceAuth m_Auth; private object m_Lock = new object(); - public GroupsServiceRemoteConnector(string url, string secret) + public GroupsServiceRemoteConnector(IConfigSource config) { + IConfig groupsConfig = config.Configs["Groups"]; + string url = groupsConfig.GetString("GroupsServerURI", string.Empty); + if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) + throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url)); + m_ServerURI = url; if (!m_ServerURI.EndsWith("/")) m_ServerURI += "/"; - m_SecretKey = secret; - m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, secret key {1}", m_ServerURI, m_SecretKey); + /// This is from BaseServiceConnector + string authType = Util.GetConfigVarFromSections(config, "AuthType", new string[] { "Network", "Groups" }, "None"); + + switch (authType) + { + case "BasicHttpAuthentication": + m_Auth = new BasicHttpAuthentication(config, "Groups"); + break; + } + /// + + m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}", + m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); } public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, @@ -656,14 +674,13 @@ namespace OpenSim.Groups private Dictionary MakeRequest(string method, Dictionary sendData) { sendData["METHOD"] = method; - if (m_SecretKey != string.Empty) - sendData["KEY"] = m_SecretKey; string reply = string.Empty; lock (m_Lock) reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "groups", - ServerUtils.BuildQueryString(sendData)); + ServerUtils.BuildQueryString(sendData), + m_Auth); if (reply == string.Empty) return null; diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs index 5fb3c19..fddda22 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs @@ -72,13 +72,7 @@ namespace OpenSim.Groups private void Init(IConfigSource config) { - IConfig groupsConfig = config.Configs["Groups"]; - string url = groupsConfig.GetString("GroupsServerURI", string.Empty); - if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) - throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url)); - - string secret = groupsConfig.GetString("SecretKey", string.Empty); - m_GroupsService = new GroupsServiceRemoteConnector(url, secret); + m_GroupsService = new GroupsServiceRemoteConnector(config); m_Scenes = new List(); } diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 33dc301..55ae6db 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs @@ -36,6 +36,7 @@ using OpenSim.Framework; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Handlers.Base; using log4net; using OpenMetaverse; @@ -69,7 +70,9 @@ namespace OpenSim.Groups m_GroupsService = new GroupsService(config); - server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, auth)); } } @@ -78,13 +81,11 @@ namespace OpenSim.Groups private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private GroupsService m_GroupsService; - private string m_SecretKey = String.Empty; - public GroupsServicePostHandler(GroupsService service, string key) : - base("POST", "/groups") + public GroupsServicePostHandler(GroupsService service, IServiceAuth auth) : + base("POST", "/groups", auth) { m_GroupsService = service; - m_SecretKey = key; } protected override byte[] ProcessRequest(string path, Stream requestData, @@ -108,20 +109,6 @@ namespace OpenSim.Groups string method = request["METHOD"].ToString(); request.Remove("METHOD"); - if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required - { - // Sender didn't send key - if (!request.ContainsKey("KEY") || (request["KEY"] == null)) - return FailureResult("This service requires a secret key"); - - // Sender sent wrong key - if (!m_SecretKey.Equals(request["KEY"])) - return FailureResult("Provided key does not match existing one"); - - // OK, key matches. Remove it. - request.Remove("KEY"); - } - m_log.DebugFormat("[Groups.Handler]: {0}", method); switch (method) { diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs index 950e1fd..5340bcd 100644 --- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs +++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs @@ -66,7 +66,7 @@ namespace OpenSim.OfflineIM if (serviceLocation == string.Empty) m_OfflineIMService = new OfflineIMService(config); else - m_OfflineIMService = new OfflineIMServiceRemoteConnector(serviceLocation); + m_OfflineIMService = new OfflineIMServiceRemoteConnector(config); m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name); diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs index eb287a4..047b8be 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs @@ -32,6 +32,7 @@ using System.Reflection; using System.Text; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; @@ -46,6 +47,7 @@ namespace OpenSim.OfflineIM private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_ServerURI = string.Empty; + private IServiceAuth m_Auth; private object m_Lock = new object(); public OfflineIMServiceRemoteConnector(string url) @@ -65,6 +67,18 @@ namespace OpenSim.OfflineIM m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty); + /// This is from BaseServiceConnector + string authType = Util.GetConfigVarFromSections(config, "AuthType", new string[] { "Network", "Messaging" }, "None"); + + switch (authType) + { + case "BasicHttpAuthentication": + m_Auth = new BasicHttpAuthentication(config, "Messaging"); + break; + } + /// + m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}", + m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); } #region IOfflineIMService @@ -143,7 +157,8 @@ namespace OpenSim.OfflineIM lock (m_Lock) reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/offlineim", - ServerUtils.BuildQueryString(sendData)); + ServerUtils.BuildQueryString(sendData), + m_Auth); Dictionary replyData = ServerUtils.ParseXmlResponse( reply); diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs index ed5c742..c44b6cc 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs @@ -36,6 +36,7 @@ using OpenSim.Framework; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Handlers.Base; using log4net; using OpenMetaverse; @@ -59,7 +60,9 @@ namespace OpenSim.OfflineIM m_OfflineIMService = new OfflineIMService(config); - server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService, auth)); } } @@ -69,8 +72,8 @@ namespace OpenSim.OfflineIM private IOfflineIMService m_OfflineIMService; - public OfflineIMServicePostHandler(IOfflineIMService service) : - base("POST", "/offlineim") + public OfflineIMServicePostHandler(IOfflineIMService service, IServiceAuth auth) : + base("POST", "/offlineim", auth) { m_OfflineIMService = service; } -- cgit v1.1