* Add line to log notifying of inventory -> user grid server trust failure
* add code comments0.6.0-stable
parent
6849f45660
commit
adfccd0ee0
|
@ -150,7 +150,9 @@ namespace OpenSim.Framework.Servers
|
||||||
private RestDeserialiseMethod<TRequest, TResponse> m_method;
|
private RestDeserialiseMethod<TRequest, TResponse> m_method;
|
||||||
private CheckIdentityMethod m_smethod;
|
private CheckIdentityMethod m_smethod;
|
||||||
|
|
||||||
public RestDeserialiseSecureHandler(string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method, CheckIdentityMethod smethod)
|
public RestDeserialiseSecureHandler(
|
||||||
|
string httpMethod, string path,
|
||||||
|
RestDeserialiseMethod<TRequest, TResponse> method, CheckIdentityMethod smethod)
|
||||||
: base(httpMethod, path)
|
: base(httpMethod, path)
|
||||||
{
|
{
|
||||||
m_smethod = smethod;
|
m_smethod = smethod;
|
||||||
|
@ -186,7 +188,18 @@ namespace OpenSim.Framework.Servers
|
||||||
public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
|
public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
|
||||||
where TRequest : new()
|
where TRequest : new()
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The operation to perform once trust has been established.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpMethod"></param>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <param name="method"></param>
|
||||||
|
/// <param name="tmethod"></param>
|
||||||
private RestDeserialiseMethod<TRequest, TResponse> m_method;
|
private RestDeserialiseMethod<TRequest, TResponse> m_method;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The method used to check whether a request is trusted.
|
||||||
|
/// </summary>
|
||||||
private CheckTrustedSourceMethod m_tmethod;
|
private CheckTrustedSourceMethod m_tmethod;
|
||||||
|
|
||||||
public RestDeserialiseTrustedHandler(string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method, CheckTrustedSourceMethod tmethod)
|
public RestDeserialiseTrustedHandler(string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method, CheckTrustedSourceMethod tmethod)
|
||||||
|
|
|
@ -66,11 +66,16 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_userserver_url = userserver_url;
|
m_userserver_url = userserver_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check that the source of an inventory request is one that we trust.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="peer"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool CheckTrustSource(IPEndPoint peer)
|
public bool CheckTrustSource(IPEndPoint peer)
|
||||||
{
|
{
|
||||||
if (m_doLookup)
|
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);
|
||||||
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)
|
||||||
|
@ -79,7 +84,12 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources",
|
||||||
|
peer);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -88,11 +98,19 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check that the source of an inventory request for a particular agent is a current session belonging to
|
||||||
|
/// that agent.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="session_id"></param>
|
||||||
|
/// <param name="avatar_id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool CheckAuthSession(string session_id, string avatar_id)
|
public bool CheckAuthSession(string session_id, string avatar_id)
|
||||||
{
|
{
|
||||||
if (m_doLookup)
|
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)
|
||||||
{
|
{
|
||||||
// cache miss, ask userserver
|
// cache miss, ask userserver
|
||||||
|
@ -119,7 +137,8 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache");
|
m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
m_log.Info("[GRID AGENT INVENTORY]: unknown session_id, request rejected");
|
|
||||||
|
m_log.Warn("[GRID AGENT INVENTORY]: unknown session_id, request rejected");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue