aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-04 01:38:11 +0100
committerJustin Clark-Casey (justincc)2010-09-04 01:38:11 +0100
commitc0b16f09bfc4f0c2aeabb7c6315f1124f8b08974 (patch)
tree9e0db9a67ff4b8c9a8c1d938f6407bcee0f7cb42
parentMove code that allows llGiveInvetory() to move item into appropriate system f... (diff)
parentAdded XFF header processing. Untested, for lack of proxy. (diff)
downloadopensim-SC-c0b16f09bfc4f0c2aeabb7c6315f1124f8b08974.zip
opensim-SC-c0b16f09bfc4f0c2aeabb7c6315f1124f8b08974.tar.gz
opensim-SC-c0b16f09bfc4f0c2aeabb7c6315f1124f8b08974.tar.bz2
opensim-SC-c0b16f09bfc4f0c2aeabb7c6315f1124f8b08974.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Framework/Util.cs28
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs12
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs5
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--bin/Robust.HG.ini.example3
6 files changed, 49 insertions, 3 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 95c3e6c..d20f8c9 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Specialized;
31using System.IO; 32using System.IO;
32using System.Net; 33using System.Net;
33using System.Net.Sockets; 34using System.Net.Sockets;
@@ -737,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer
737 if (methodWasFound) 738 if (methodWasFound)
738 { 739 {
739 xmlRprcRequest.Params.Add(request.Url); // Param[2] 740 xmlRprcRequest.Params.Add(request.Url); // Param[2]
741 xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3]
740 742
741 try 743 try
742 { 744 {
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index b5d025f..2ac4eb1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1495,5 +1495,33 @@ namespace OpenSim.Framework
1495 } 1495 }
1496 } 1496 }
1497 1497
1498 /// <summary>
1499 /// Gets the client IP address
1500 /// </summary>
1501 /// <param name="xff"></param>
1502 /// <returns></returns>
1503 public static IPEndPoint GetClientIPFromXFF(string xff)
1504 {
1505 if (xff == string.Empty)
1506 return null;
1507
1508 string[] parts = xff.Split(new char[] { ',' });
1509 if (parts.Length > 0)
1510 {
1511 try
1512 {
1513 return new IPEndPoint(IPAddress.Parse(parts[0]), 0);
1514 }
1515 catch (Exception e)
1516 {
1517 m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message);
1518 }
1519 }
1520
1521 return null;
1522 }
1523
1524
1525
1498 } 1526 }
1499} 1527}
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index 5bb529c..30dc65e 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private ILoginService m_LocalService; 54 private ILoginService m_LocalService;
55 private bool m_Proxy;
55 56
56 public LLLoginHandlers(ILoginService service) 57 public LLLoginHandlers(ILoginService service, bool hasProxy)
57 { 58 {
58 m_LocalService = service; 59 m_LocalService = service;
60 m_Proxy = hasProxy;
59 } 61 }
60 62
61 public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) 63 public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
62 { 64 {
63 Hashtable requestData = (Hashtable)request.Params[0]; 65 Hashtable requestData = (Hashtable)request.Params[0];
66 if (m_Proxy && request.Params[3] != null)
67 {
68 IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
69 if (ep != null)
70 // Bang!
71 remoteClient = ep;
72 }
64 73
65 if (requestData != null) 74 if (requestData != null)
66 { 75 {
@@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login
189 198
190 return map; 199 return map;
191 } 200 }
201
192 } 202 }
193 203
194} 204}
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
index 67e8392..16c93c8 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private ILoginService m_LoginService; 45 private ILoginService m_LoginService;
46 private bool m_Proxy;
46 47
47 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : 48 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
48 base(config, server, String.Empty) 49 base(config, server, String.Empty)
@@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login
81 if (loginService == string.Empty) 82 if (loginService == string.Empty)
82 throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); 83 throw new Exception(String.Format("No LocalServiceModule for LoginService in config file"));
83 84
85 m_Proxy = serverConfig.GetBoolean("HasProxy", false);
86
84 return loginService; 87 return loginService;
85 } 88 }
86 89
87 private void InitializeHandlers(IHttpServer server) 90 private void InitializeHandlers(IHttpServer server)
88 { 91 {
89 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); 92 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy);
90 server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); 93 server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
91 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); 94 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
92 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); 95 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index b740297..3f9bc19 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Services.LLLoginService
104 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 104 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
105 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); 105 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
106 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 106 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
107 107
108 // These are required; the others aren't 108 // These are required; the others aren't
109 if (accountService == string.Empty || authService == string.Empty) 109 if (accountService == string.Empty || authService == string.Empty)
110 throw new Exception("LoginService is missing service specifications"); 110 throw new Exception("LoginService is missing service specifications");
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index 554d00f..9aaa46b 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -147,6 +147,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
147 WelcomeMessage = "Welcome, Avatar!" 147 WelcomeMessage = "Welcome, Avatar!"
148 AllowRemoteSetLoginLevel = "false" 148 AllowRemoteSetLoginLevel = "false"
149 149
150 ; If you run this login server behind a proxy, set this to true
151 ; HasProxy = true
152
150 ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) 153 ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs)
151 ; CHANGE THIS 154 ; CHANGE THIS
152 HomeURI = "http://127.0.0.1:8002" 155 HomeURI = "http://127.0.0.1:8002"