aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/InstantMessage
diff options
context:
space:
mode:
authorMelanie2010-12-30 20:57:56 +0100
committerMelanie2010-12-30 20:57:56 +0100
commit24a997eb7ccb59f2c7bbc52cd1ddb9a7801e6aac (patch)
tree842067bdcfa4c1aecf438c0a3ace6002acd738c6 /OpenSim/Region/CoreModules/Avatar/InstantMessage
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-24a997eb7ccb59f2c7bbc52cd1ddb9a7801e6aac.zip
opensim-SC_OLD-24a997eb7ccb59f2c7bbc52cd1ddb9a7801e6aac.tar.gz
opensim-SC_OLD-24a997eb7ccb59f2c7bbc52cd1ddb9a7801e6aac.tar.bz2
opensim-SC_OLD-24a997eb7ccb59f2c7bbc52cd1ddb9a7801e6aac.tar.xz
Add MessageKey to section Messaging, a key that prevents injection of
IM from external sources
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs31
1 files changed, 25 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 2f8bcd7..0d5401b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private bool m_Enabled = false; 49 private bool m_Enabled = false;
50 protected string m_MessageKey = String.Empty;
50 protected List<Scene> m_Scenes = new List<Scene>(); 51 protected List<Scene> m_Scenes = new List<Scene>();
51 protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); 52 protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
52 53
@@ -66,14 +67,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
66 public virtual void Initialise(IConfigSource config) 67 public virtual void Initialise(IConfigSource config)
67 { 68 {
68 IConfig cnf = config.Configs["Messaging"]; 69 IConfig cnf = config.Configs["Messaging"];
69 if (cnf != null && cnf.GetString( 70 if (cnf != null)
70 "MessageTransferModule", "MessageTransferModule") !=
71 "MessageTransferModule")
72 { 71 {
73 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); 72 if (cnf.GetString("MessageTransferModule",
74 return; 73 "MessageTransferModule") != "MessageTransferModule")
75 } 74 {
75 return;
76 }
76 77
78 m_MessageKey = cnf.GetString("MessageKey", String.Empty);
79 }
80 m_log.Debug("[MESSAGE TRANSFER]: Module enabled");
77 m_Enabled = true; 81 m_Enabled = true;
78 } 82 }
79 83
@@ -250,6 +254,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
250 && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") 254 && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id")
251 && requestData.ContainsKey("binary_bucket")) 255 && requestData.ContainsKey("binary_bucket"))
252 { 256 {
257 if (m_MessageKey != String.Empty)
258 {
259 XmlRpcResponse error_resp = new XmlRpcResponse();
260 Hashtable error_respdata = new Hashtable();
261 error_respdata["success"] = "FALSE";
262 error_resp.Value = error_respdata;
263
264 if (!requestData.Contains("message_key"))
265 return error_resp;
266 if (m_MessageKey != (string)requestData["message_key"])
267 return error_resp;
268 }
269
253 // Do the easy way of validating the UUIDs 270 // Do the easy way of validating the UUIDs
254 UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); 271 UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID);
255 UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); 272 UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
@@ -681,6 +698,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
681 gim["position_z"] = msg.Position.Z.ToString(); 698 gim["position_z"] = msg.Position.Z.ToString();
682 gim["region_id"] = msg.RegionID.ToString(); 699 gim["region_id"] = msg.RegionID.ToString();
683 gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); 700 gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None);
701 if (m_MessageKey != String.Empty)
702 gim["message_key"] = m_MessageKey;
684 return gim; 703 return gim;
685 } 704 }
686 705