Commit Diva's new patch for the DataSnapshot. Comment the default

metaverseink search provider to prevent accidental data exposure.
0.6.0-stable
Melanie Thielker 2008-10-11 00:39:43 +00:00
parent 09c8713801
commit 2214b2f578
3 changed files with 161 additions and 141 deletions

View File

@ -55,6 +55,7 @@ namespace OpenSim.Region.DataSnapshot
private List<String> m_disabledModules = new List<String>(); private List<String> m_disabledModules = new List<String>();
private Dictionary<string, string> m_gridinfo = new Dictionary<string, string>(); private Dictionary<string, string> m_gridinfo = new Dictionary<string, string>();
private string m_snapsDir = "DataSnapshot"; private string m_snapsDir = "DataSnapshot";
private string m_exposure_level = "minimum";
//Lists of stuff we need //Lists of stuff we need
private List<Scene> m_scenes = new List<Scene>(); private List<Scene> m_scenes = new List<Scene>();
@ -82,6 +83,15 @@ namespace OpenSim.Region.DataSnapshot
#endregion #endregion
#region Properties
public string ExposureLevel
{
get { return m_exposure_level; }
}
#endregion
#region IRegionModule #region IRegionModule
public void Close() {} public void Close() {}
@ -109,6 +119,7 @@ namespace OpenSim.Region.DataSnapshot
} }
m_gridinfo.Add("Name", config.Configs["DataSnapshot"].GetString("gridname", "harbl")); m_gridinfo.Add("Name", config.Configs["DataSnapshot"].GetString("gridname", "harbl"));
m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir); m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir);
@ -116,10 +127,13 @@ namespace OpenSim.Region.DataSnapshot
m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port); m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port);
String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray()); String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray());
foreach (String bloody_wanker in annoying_string_array) { foreach (String bloody_wanker in annoying_string_array)
{
m_disabledModules.Add(bloody_wanker); m_disabledModules.Add(bloody_wanker);
} }
} catch (Exception) { }
catch (Exception)
{
m_log.Info("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled."); m_log.Info("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled.");
m_enabled = false; m_enabled = false;
return; return;
@ -147,7 +161,7 @@ namespace OpenSim.Region.DataSnapshot
MakeEverythingStale(); MakeEverythingStale();
if (m_dataServices != "noservices") if (m_dataServices != "" && m_dataServices != "noservices")
NotifyDataServices(m_dataServices); NotifyDataServices(m_dataServices);
} }
} }

View File

@ -44,7 +44,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
public class LandSnapshot : IDataSnapshotProvider public class LandSnapshot : IDataSnapshotProvider
{ {
private Scene m_scene = null; private Scene m_scene = null;
// private DataSnapshotManager m_parent = null; private DataSnapshotManager m_parent = null;
//private Dictionary<int, Land> m_landIndexed = new Dictionary<int, Land>(); //private Dictionary<int, Land> m_landIndexed = new Dictionary<int, Land>();
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_stale = true; private bool m_stale = true;
@ -107,7 +107,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
public void Initialize(Scene scene, DataSnapshotManager parent) public void Initialize(Scene scene, DataSnapshotManager parent)
{ {
m_scene = scene; m_scene = scene;
// m_parent = parent; m_parent = parent;
//Brought back from the dead for staleness checks. //Brought back from the dead for staleness checks.
m_scene.EventManager.OnNewClient += OnNewClient; m_scene.EventManager.OnNewClient += OnNewClient;
@ -137,8 +137,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
LandObject land = (LandObject)parcel_interface; LandObject land = (LandObject)parcel_interface;
LandData parcel = land.landData; LandData parcel = land.landData;
// if ((parcel.Flags & (uint)Parcel.ParcelFlags.ShowDirectory) == (uint)Parcel.ParcelFlags.ShowDirectory) if (m_parent.ExposureLevel.Equals("all") ||
// { (m_parent.ExposureLevel.Equals("minimum") &&
(parcel.Flags & (uint)Parcel.ParcelFlags.ShowDirectory) == (uint)Parcel.ParcelFlags.ShowDirectory))
{
//TODO: make better method of marshalling data from LandData to XmlNode //TODO: make better method of marshalling data from LandData to XmlNode
XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", ""); XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", "");
@ -159,7 +161,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice"); XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice");
sales_attr.Value = parcel.SalePrice.ToString(); sales_attr.Value = parcel.SalePrice.ToString();
XmlAttribute directory_attr = nodeFactory.CreateAttribute("show_directory"); XmlAttribute directory_attr = nodeFactory.CreateAttribute("showinsearch");
directory_attr.Value = GetShowInSearch(parcel); directory_attr.Value = GetShowInSearch(parcel);
//XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities"); //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities");
//entities_attr.Value = land.primsOverMe.Count.ToString(); //entities_attr.Value = land.primsOverMe.Count.ToString();
@ -265,7 +267,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
//} //}
parent.AppendChild(xmlparcel); parent.AppendChild(xmlparcel);
// } }
} }
//snap.AppendChild(parent); //snap.AppendChild(parent);
} }
@ -378,7 +380,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
// another, smaller rectangular parcel). Both will have the same initial coordinates. // another, smaller rectangular parcel). Both will have the same initial coordinates.
private void findPointInParcel(ILandObject land, ref uint refX, ref uint refY) private void findPointInParcel(ILandObject land, ref uint refX, ref uint refY)
{ {
m_log.DebugFormat("[LAND] trying {0}, {1}", refX, refY); m_log.DebugFormat("[DATASNAPSHOT] trying {0}, {1}", refX, refY);
// the point we started with already is in the parcel // the point we started with already is in the parcel
if (land.containsPoint((int)refX, (int)refY)) return; if (land.containsPoint((int)refX, (int)refY)) return;

View File

@ -569,6 +569,10 @@ max_listens_per_script = 64
; Set index_sims to true to enable search engines to index your searchable data ; Set index_sims to true to enable search engines to index your searchable data
; If false, no data will be exposed, DataSnapshot module will be off, and you can ignore the rest of these search-related configs ; If false, no data will be exposed, DataSnapshot module will be off, and you can ignore the rest of these search-related configs
index_sims = false index_sims = false
; The variable data_exposure controls what the regions expose:
; minimum: exposes only things explicitly marked for search
; all: exposes everything
data_exposure = minimum
; If search is on, change this to your grid name; will be ignored for standalones ; If search is on, change this to your grid name; will be ignored for standalones
gridname = "OSGrid" gridname = "OSGrid"
; Period between data snapshots, in seconds. 20 minutes, for starters, so that you see the initial changes fast. ; Period between data snapshots, in seconds. 20 minutes, for starters, so that you see the initial changes fast.
@ -576,9 +580,9 @@ gridname = "OSGrid"
default_snapshot_period = 1200 default_snapshot_period = 1200
; This will be created in bin, if it doesn't exist already. It will hold the data snapshots. ; This will be created in bin, if it doesn't exist already. It will hold the data snapshots.
snapshot_cache_directory = "DataSnapshot" snapshot_cache_directory = "DataSnapshot"
; This semicolon-separated string serves to notify specific data services ; This semicolon-separated string serves to notify specific data services about the existence
; about the existence of this sim. ; of this sim. Uncomment if you want to index your data with this and/or other search providers.
data_services="http://metaverseink.com/cgi-bin/register.py" ;data_services="http://metaverseink.com/cgi-bin/register.py"
[Economy] [Economy]