enabled a config option to inventory server to be able to stop it doing the SessionId lookup to the user server. As this ties a inventory server to one userserver/grid.

doing the look up is still enabled by default.
0.6.0-stable
MW 2008-07-25 17:59:34 +00:00
parent d954f46a0a
commit a7db55717b
3 changed files with 57 additions and 27 deletions

View File

@ -44,6 +44,7 @@ namespace OpenSim.Framework
public string UserRecvKey = String.Empty; public string UserRecvKey = String.Empty;
public string UserSendKey = String.Empty; public string UserSendKey = String.Empty;
public string UserServerURL = String.Empty; public string UserServerURL = String.Empty;
public bool SessionLookUp = true;
public InventoryConfig(string description, string filename) public InventoryConfig(string description, string filename)
{ {
@ -71,6 +72,8 @@ namespace OpenSim.Framework
"Database Connect String", "", false); "Database Connect String", "", false);
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Http Listener port", DefaultHttpPort.ToString(), false); "Http Listener port", DefaultHttpPort.ToString(), false);
configMember.addConfigurationOption("session_lookup", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Enable Session lookup security", "True", false);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -98,6 +101,9 @@ namespace OpenSim.Framework
case "http_port": case "http_port":
HttpPort = (uint) configuration_result; HttpPort = (uint) configuration_result;
break; break;
case "session_lookup":
SessionLookUp = (bool)configuration_result;
break;
} }
return true; return true;

View File

@ -47,6 +47,13 @@ namespace OpenSim.Grid.InventoryServer
/// </summary> /// </summary>
public class GridInventoryService : InventoryServiceBase public class GridInventoryService : InventoryServiceBase
{ {
private bool m_doLookup = false;
public bool DoLookup
{
get { return m_doLookup; }
set { m_doLookup = value; }
}
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
@ -60,19 +67,30 @@ namespace OpenSim.Grid.InventoryServer
} }
public bool CheckTrustSource(IPEndPoint peer) public bool CheckTrustSource(IPEndPoint peer)
{
if (m_doLookup)
{ {
m_log.InfoFormat("[GRID AGENT INVENTORY]: checking trusted source {0}", peer.ToString()); m_log.InfoFormat("[GRID AGENT INVENTORY]: checking trusted source {0}", peer.ToString());
UriBuilder ub = new UriBuilder(m_userserver_url); UriBuilder ub = new UriBuilder(m_userserver_url);
IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host);
foreach (IPAddress uaddr in uaddrs) { foreach (IPAddress uaddr in uaddrs)
if (uaddr.Equals(peer.Address)) { {
if (uaddr.Equals(peer.Address))
{
return true; return true;
} }
} }
return false; return false;
} }
else
{
return true;
}
}
public bool CheckAuthSession(string session_id, string avatar_id) public bool CheckAuthSession(string session_id, string avatar_id)
{
if (m_doLookup)
{ {
m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id); m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id);
if (m_session_cache.getCachedSession(session_id, avatar_id) == null) if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
@ -104,6 +122,11 @@ namespace OpenSim.Grid.InventoryServer
m_log.Info("[GRID AGENT INVENTORY]: unknown session_id, request rejected"); m_log.Info("[GRID AGENT INVENTORY]: unknown session_id, request rejected");
return false; return false;
} }
else
{
return true;
}
}
public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
{ {

View File

@ -72,6 +72,7 @@ namespace OpenSim.Grid.InventoryServer
//m_inventoryService = new GridInventoryService(); //m_inventoryService = new GridInventoryService();
m_inventoryService = new GridInventoryService(m_config.UserServerURL); m_inventoryService = new GridInventoryService(m_config.UserServerURL);
m_inventoryService.DoLookup = m_config.SessionLookUp;
m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect); m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
m_log.Info("[" + LogName + "]: Starting HTTP server ..."); m_log.Info("[" + LogName + "]: Starting HTTP server ...");