mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
* Pipes requestors IP address through all XmlRpcRequest delegates. This is needed to be able to 'NAT-wrap' the login sequence.
* If you have something using XmlRpc that isn't in core, change your method signature from: (XmlRpcRequest request) to: (XmlRpcRequest request, IPEndPoint remoteClient)
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
@@ -138,7 +139,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
}
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request)
|
||||
public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
@@ -86,10 +86,10 @@ namespace OpenSim.Framework.Communications.Services
|
||||
m_serversInfo = sinfo;
|
||||
}
|
||||
|
||||
public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
||||
public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Info("[HGLOGIN]: HGLogin called " + request.MethodName);
|
||||
XmlRpcResponse response = base.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = base.XmlRpcLoginMethod(request, remoteClient);
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
responseData["grid_service"] = m_serversInfo.GridURL;
|
||||
@@ -132,7 +132,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request)
|
||||
public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
// Verify the key of who's calling
|
||||
UUID userID = UUID.Zero;
|
||||
@@ -157,7 +157,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcVerifyKeyMethod(XmlRpcRequest request)
|
||||
public XmlRpcResponse XmlRpcVerifyKeyMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
@@ -97,7 +98,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
/// </summary>
|
||||
/// <param name="request">The XMLRPC request</param>
|
||||
/// <returns>The response to send</returns>
|
||||
public virtual XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
||||
public virtual XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
// Temporary fix
|
||||
m_loginMutex.WaitOne();
|
||||
@@ -1125,7 +1126,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
return false;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request)
|
||||
public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
XmlRpcResponse response = loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
|
||||
@@ -140,7 +140,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
UserAgentData uagent = m_userProfileData.CurrentAgent;
|
||||
@@ -194,7 +194,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
ArrayList friendslist = (ArrayList) responseData["buddy-list"];
|
||||
@@ -231,7 +231,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
|
||||
|
||||
@@ -281,7 +281,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo(error_xml_message));
|
||||
|
||||
@@ -312,20 +312,20 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
|
||||
// First we log in.
|
||||
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
|
||||
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
|
||||
|
||||
// Then we try again, this time expecting failure.
|
||||
request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
response = m_loginService.XmlRpcLoginMethod(request);
|
||||
response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo(error_already_logged));
|
||||
|
||||
// Finally the third time we should be able to get right back in.
|
||||
request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
response = m_loginService.XmlRpcLoginMethod(request);
|
||||
response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
|
||||
responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
|
||||
|
||||
|
||||
@@ -612,7 +612,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
try
|
||||
{
|
||||
xmlRpcResponse = method(xmlRprcRequest);
|
||||
xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Net;
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request);
|
||||
public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request, IPEndPoint client);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user