aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorAdam Frisby2009-05-23 06:05:20 +0000
committerAdam Frisby2009-05-23 06:05:20 +0000
commit31baeef469d72a9dc13cf4f56392b9f740f71cba (patch)
treeac50806ced72c5b296645bf061a3d9176a41075c /OpenSim/Framework
parent* Breaks OpenSim.. err I mean.. adds NAT translation support to EnableSimulat... (diff)
downloadopensim-SC_OLD-31baeef469d72a9dc13cf4f56392b9f740f71cba.zip
opensim-SC_OLD-31baeef469d72a9dc13cf4f56392b9f740f71cba.tar.gz
opensim-SC_OLD-31baeef469d72a9dc13cf4f56392b9f740f71cba.tar.bz2
opensim-SC_OLD-31baeef469d72a9dc13cf4f56392b9f740f71cba.tar.xz
* 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)
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Services/GridInfoService.cs3
-rw-r--r--OpenSim/Framework/Communications/Services/HGLoginAuthService.cs8
-rw-r--r--OpenSim/Framework/Communications/Services/LoginService.cs5
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs18
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/XmlRpcMethod.cs3
6 files changed, 21 insertions, 18 deletions
diff --git a/OpenSim/Framework/Communications/Services/GridInfoService.cs b/OpenSim/Framework/Communications/Services/GridInfoService.cs
index f17bb9f..317dba2 100644
--- a/OpenSim/Framework/Communications/Services/GridInfoService.cs
+++ b/OpenSim/Framework/Communications/Services/GridInfoService.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.IO; 30using System.IO;
31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using log4net; 34using log4net;
@@ -138,7 +139,7 @@ namespace OpenSim.Framework.Communications.Services
138 } 139 }
139 } 140 }
140 141
141 public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request) 142 public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request, IPEndPoint remoteClient)
142 { 143 {
143 XmlRpcResponse response = new XmlRpcResponse(); 144 XmlRpcResponse response = new XmlRpcResponse();
144 Hashtable responseData = new Hashtable(); 145 Hashtable responseData = new Hashtable();
diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
index b62e4a2..3756cf5 100644
--- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
+++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
@@ -86,10 +86,10 @@ namespace OpenSim.Framework.Communications.Services
86 m_serversInfo = sinfo; 86 m_serversInfo = sinfo;
87 } 87 }
88 88
89 public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 89 public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request, IPEndPoint remoteClient)
90 { 90 {
91 m_log.Info("[HGLOGIN]: HGLogin called " + request.MethodName); 91 m_log.Info("[HGLOGIN]: HGLogin called " + request.MethodName);
92 XmlRpcResponse response = base.XmlRpcLoginMethod(request); 92 XmlRpcResponse response = base.XmlRpcLoginMethod(request, remoteClient);
93 Hashtable responseData = (Hashtable)response.Value; 93 Hashtable responseData = (Hashtable)response.Value;
94 94
95 responseData["grid_service"] = m_serversInfo.GridURL; 95 responseData["grid_service"] = m_serversInfo.GridURL;
@@ -132,7 +132,7 @@ namespace OpenSim.Framework.Communications.Services
132 return response; 132 return response;
133 } 133 }
134 134
135 public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request) 135 public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request, IPEndPoint remoteClient)
136 { 136 {
137 // Verify the key of who's calling 137 // Verify the key of who's calling
138 UUID userID = UUID.Zero; 138 UUID userID = UUID.Zero;
@@ -157,7 +157,7 @@ namespace OpenSim.Framework.Communications.Services
157 return response; 157 return response;
158 } 158 }
159 159
160 public XmlRpcResponse XmlRpcVerifyKeyMethod(XmlRpcRequest request) 160 public XmlRpcResponse XmlRpcVerifyKeyMethod(XmlRpcRequest request, IPEndPoint remoteClient)
161 { 161 {
162 bool success = false; 162 bool success = false;
163 163
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs
index f55c030..6859827 100644
--- a/OpenSim/Framework/Communications/Services/LoginService.cs
+++ b/OpenSim/Framework/Communications/Services/LoginService.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Net;
32using System.Reflection; 33using System.Reflection;
33using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
34using System.Threading; 35using System.Threading;
@@ -97,7 +98,7 @@ namespace OpenSim.Framework.Communications.Services
97 /// </summary> 98 /// </summary>
98 /// <param name="request">The XMLRPC request</param> 99 /// <param name="request">The XMLRPC request</param>
99 /// <returns>The response to send</returns> 100 /// <returns>The response to send</returns>
100 public virtual XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 101 public virtual XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request, IPEndPoint remoteClient)
101 { 102 {
102 // Temporary fix 103 // Temporary fix
103 m_loginMutex.WaitOne(); 104 m_loginMutex.WaitOne();
@@ -1125,7 +1126,7 @@ namespace OpenSim.Framework.Communications.Services
1125 return false; 1126 return false;
1126 } 1127 }
1127 1128
1128 public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) 1129 public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request, IPEndPoint remoteClient)
1129 { 1130 {
1130 XmlRpcResponse response = new XmlRpcResponse(); 1131 XmlRpcResponse response = new XmlRpcResponse();
1131 Hashtable requestData = (Hashtable)request.Params[0]; 1132 Hashtable requestData = (Hashtable)request.Params[0];
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 7d75faa..a2a388e 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Framework.Communications.Tests
103 103
104 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 104 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
105 105
106 XmlRpcResponse response = loginService.XmlRpcLoginMethod(request); 106 XmlRpcResponse response = loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
107 Hashtable responseData = (Hashtable)response.Value; 107 Hashtable responseData = (Hashtable)response.Value;
108 108
109 Assert.That(responseData["first_name"], Is.EqualTo(m_firstName)); 109 Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
@@ -140,7 +140,7 @@ namespace OpenSim.Framework.Communications.Tests
140 140
141 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 141 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
142 142
143 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request); 143 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
144 Hashtable responseData = (Hashtable)response.Value; 144 Hashtable responseData = (Hashtable)response.Value;
145 145
146 UserAgentData uagent = m_userProfileData.CurrentAgent; 146 UserAgentData uagent = m_userProfileData.CurrentAgent;
@@ -194,7 +194,7 @@ namespace OpenSim.Framework.Communications.Tests
194 194
195 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 195 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
196 196
197 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request); 197 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
198 Hashtable responseData = (Hashtable)response.Value; 198 Hashtable responseData = (Hashtable)response.Value;
199 199
200 ArrayList friendslist = (ArrayList) responseData["buddy-list"]; 200 ArrayList friendslist = (ArrayList) responseData["buddy-list"];
@@ -231,7 +231,7 @@ namespace OpenSim.Framework.Communications.Tests
231 231
232 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 232 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
233 233
234 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request); 234 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
235 Hashtable responseData = (Hashtable)response.Value; 235 Hashtable responseData = (Hashtable)response.Value;
236 Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); 236 Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
237 237
@@ -256,7 +256,7 @@ namespace OpenSim.Framework.Communications.Tests
256 256
257 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 257 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
258 258
259 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request); 259 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
260 Hashtable responseData = (Hashtable)response.Value; 260 Hashtable responseData = (Hashtable)response.Value;
261 Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); 261 Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
262 262
@@ -281,7 +281,7 @@ namespace OpenSim.Framework.Communications.Tests
281 281
282 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 282 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
283 283
284 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request); 284 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
285 Hashtable responseData = (Hashtable)response.Value; 285 Hashtable responseData = (Hashtable)response.Value;
286 Assert.That(responseData["message"], Is.EqualTo(error_xml_message)); 286 Assert.That(responseData["message"], Is.EqualTo(error_xml_message));
287 287
@@ -312,20 +312,20 @@ namespace OpenSim.Framework.Communications.Tests
312 312
313 // First we log in. 313 // First we log in.
314 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 314 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
315 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request); 315 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
316 Hashtable responseData = (Hashtable)response.Value; 316 Hashtable responseData = (Hashtable)response.Value;
317 Assert.That(responseData["message"], Is.EqualTo("Hello folks")); 317 Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
318 318
319 // Then we try again, this time expecting failure. 319 // Then we try again, this time expecting failure.
320 request = new XmlRpcRequest("login_to_simulator", sendParams); 320 request = new XmlRpcRequest("login_to_simulator", sendParams);
321 response = m_loginService.XmlRpcLoginMethod(request); 321 response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
322 responseData = (Hashtable)response.Value; 322 responseData = (Hashtable)response.Value;
323 Assert.That(responseData["message"], Is.EqualTo(error_already_logged)); 323 Assert.That(responseData["message"], Is.EqualTo(error_already_logged));
324 324
325 // Finally the third time we should be able to get right back in. 325 // Finally the third time we should be able to get right back in.
326 request = new XmlRpcRequest("login_to_simulator", sendParams); 326 request = new XmlRpcRequest("login_to_simulator", sendParams);
327 327
328 response = m_loginService.XmlRpcLoginMethod(request); 328 response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80));
329 responseData = (Hashtable)response.Value; 329 responseData = (Hashtable)response.Value;
330 Assert.That(responseData["message"], Is.EqualTo("Hello folks")); 330 Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
331 331
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 5778214..8fb2082 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -612,7 +612,7 @@ namespace OpenSim.Framework.Servers.HttpServer
612 612
613 try 613 try
614 { 614 {
615 xmlRpcResponse = method(xmlRprcRequest); 615 xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint);
616 } 616 }
617 catch(Exception e) 617 catch(Exception e)
618 { 618 {
diff --git a/OpenSim/Framework/Servers/HttpServer/XmlRpcMethod.cs b/OpenSim/Framework/Servers/HttpServer/XmlRpcMethod.cs
index 843b3f7..62ebe62 100644
--- a/OpenSim/Framework/Servers/HttpServer/XmlRpcMethod.cs
+++ b/OpenSim/Framework/Servers/HttpServer/XmlRpcMethod.cs
@@ -25,9 +25,10 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Net;
28using Nwc.XmlRpc; 29using Nwc.XmlRpc;
29 30
30namespace OpenSim.Framework.Servers.HttpServer 31namespace OpenSim.Framework.Servers.HttpServer
31{ 32{
32 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request); 33 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request, IPEndPoint client);
33} 34}