diff options
Diffstat (limited to '')
12 files changed, 148 insertions, 26 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 783a833..4f89d78 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -108,11 +108,31 @@ namespace OpenSim.Framework | |||
108 | public string ServiceSessionID = string.Empty; | 108 | public string ServiceSessionID = string.Empty; |
109 | 109 | ||
110 | /// <summary> | 110 | /// <summary> |
111 | /// Viewer's version string | 111 | /// The client's IP address, as captured by the login service |
112 | /// </summary> | ||
113 | public string IPAddress; | ||
114 | |||
115 | /// <summary> | ||
116 | /// Viewer's version string as reported by the viewer at login | ||
112 | /// </summary> | 117 | /// </summary> |
113 | public string Viewer; | 118 | public string Viewer; |
114 | 119 | ||
115 | /// <summary> | 120 | /// <summary> |
121 | /// The channel strinf sent by the viewer at login | ||
122 | /// </summary> | ||
123 | public string Channel; | ||
124 | |||
125 | /// <summary> | ||
126 | /// The Mac address as reported by the viewer at login | ||
127 | /// </summary> | ||
128 | public string Mac; | ||
129 | |||
130 | /// <summary> | ||
131 | /// The id0 as reported by the viewer at login | ||
132 | /// </summary> | ||
133 | public string Id0; | ||
134 | |||
135 | /// <summary> | ||
116 | /// Position the Agent's Avatar starts in the region | 136 | /// Position the Agent's Avatar starts in the region |
117 | /// </summary> | 137 | /// </summary> |
118 | public Vector3 startpos; | 138 | public Vector3 startpos; |
@@ -179,7 +199,11 @@ namespace OpenSim.Framework | |||
179 | args["service_session_id"] = OSD.FromString(ServiceSessionID); | 199 | args["service_session_id"] = OSD.FromString(ServiceSessionID); |
180 | args["start_pos"] = OSD.FromString(startpos.ToString()); | 200 | args["start_pos"] = OSD.FromString(startpos.ToString()); |
181 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | 201 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); |
202 | args["client_ip"] = OSD.FromString(IPAddress); | ||
182 | args["viewer"] = OSD.FromString(Viewer); | 203 | args["viewer"] = OSD.FromString(Viewer); |
204 | args["channel"] = OSD.FromString(Channel); | ||
205 | args["mac"] = OSD.FromString(Mac); | ||
206 | args["id0"] = OSD.FromString(Id0); | ||
183 | 207 | ||
184 | if (Appearance != null) | 208 | if (Appearance != null) |
185 | { | 209 | { |
@@ -279,8 +303,16 @@ namespace OpenSim.Framework | |||
279 | SessionID = args["session_id"].AsUUID(); | 303 | SessionID = args["session_id"].AsUUID(); |
280 | if (args["service_session_id"] != null) | 304 | if (args["service_session_id"] != null) |
281 | ServiceSessionID = args["service_session_id"].AsString(); | 305 | ServiceSessionID = args["service_session_id"].AsString(); |
306 | if (args["client_ip"] != null) | ||
307 | IPAddress = args["client_ip"].AsString(); | ||
282 | if (args["viewer"] != null) | 308 | if (args["viewer"] != null) |
283 | Viewer = args["viewer"].AsString(); | 309 | Viewer = args["viewer"].AsString(); |
310 | if (args["channel"] != null) | ||
311 | Channel = args["channel"].AsString(); | ||
312 | if (args["mac"] != null) | ||
313 | Mac = args["mac"].AsString(); | ||
314 | if (args["id0"] != null) | ||
315 | Id0 = args["id0"].AsString(); | ||
284 | 316 | ||
285 | if (args["start_pos"] != null) | 317 | if (args["start_pos"] != null) |
286 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | 318 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); |
@@ -349,6 +381,9 @@ namespace OpenSim.Framework | |||
349 | public float startposy; | 381 | public float startposy; |
350 | public float startposz; | 382 | public float startposz; |
351 | public string Viewer; | 383 | public string Viewer; |
384 | public string Channel; | ||
385 | public string Mac; | ||
386 | public string Id0; | ||
352 | 387 | ||
353 | public sAgentCircuitData() | 388 | public sAgentCircuitData() |
354 | { | 389 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1cd2ff4..d506208 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -301,7 +301,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
301 | if (currentAgentCircuit != null) | 301 | if (currentAgentCircuit != null) |
302 | { | 302 | { |
303 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | 303 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; |
304 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
304 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | 305 | agentCircuit.Viewer = currentAgentCircuit.Viewer; |
306 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
307 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
308 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
305 | } | 309 | } |
306 | 310 | ||
307 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 311 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
@@ -979,16 +983,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
979 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 983 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
980 | 984 | ||
981 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); | 985 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); |
982 | m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); | 986 | //m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); |
983 | 987 | ||
984 | if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) | 988 | if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) |
985 | agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); | 989 | agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); |
986 | m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count); | 990 | //m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count); |
987 | 991 | ||
988 | sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); | 992 | sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); |
989 | foreach (ulong h in agent.ChildrenCapSeeds.Keys) | 993 | //foreach (ulong h in agent.ChildrenCapSeeds.Keys) |
990 | m_log.DebugFormat("[XXX] --> {0}", h); | 994 | // m_log.DebugFormat("[XXX] --> {0}", h); |
991 | m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); | 995 | //m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); |
992 | agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath); | 996 | agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath); |
993 | 997 | ||
994 | if (sp.Scene.CapsModule != null) | 998 | if (sp.Scene.CapsModule != null) |
@@ -999,7 +1003,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
999 | if (currentAgentCircuit != null) | 1003 | if (currentAgentCircuit != null) |
1000 | { | 1004 | { |
1001 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | 1005 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; |
1006 | agent.IPAddress = currentAgentCircuit.IPAddress; | ||
1002 | agent.Viewer = currentAgentCircuit.Viewer; | 1007 | agent.Viewer = currentAgentCircuit.Viewer; |
1008 | agent.Channel = currentAgentCircuit.Channel; | ||
1009 | agent.Mac = currentAgentCircuit.Mac; | ||
1010 | agent.Id0 = currentAgentCircuit.Id0; | ||
1003 | } | 1011 | } |
1004 | 1012 | ||
1005 | IPEndPoint external = region.ExternalEndPoint; | 1013 | IPEndPoint external = region.ExternalEndPoint; |
@@ -1092,7 +1100,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1092 | if (currentAgentCircuit != null) | 1100 | if (currentAgentCircuit != null) |
1093 | { | 1101 | { |
1094 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | 1102 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; |
1103 | agent.IPAddress = currentAgentCircuit.IPAddress; | ||
1095 | agent.Viewer = currentAgentCircuit.Viewer; | 1104 | agent.Viewer = currentAgentCircuit.Viewer; |
1105 | agent.Channel = currentAgentCircuit.Channel; | ||
1106 | agent.Mac = currentAgentCircuit.Mac; | ||
1107 | agent.Id0 = currentAgentCircuit.Id0; | ||
1096 | } | 1108 | } |
1097 | 1109 | ||
1098 | if (newRegions.Contains(neighbour.RegionHandle)) | 1110 | if (newRegions.Contains(neighbour.RegionHandle)) |
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index c951653..31eefb1 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | |||
@@ -54,9 +54,10 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | private IGatekeeperService m_GatekeeperService; | 55 | private IGatekeeperService m_GatekeeperService; |
56 | 56 | ||
57 | public GatekeeperAgentHandler(IGatekeeperService gatekeeper) | 57 | public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) |
58 | { | 58 | { |
59 | m_GatekeeperService = gatekeeper; | 59 | m_GatekeeperService = gatekeeper; |
60 | m_Proxy = proxy; | ||
60 | } | 61 | } |
61 | 62 | ||
62 | protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 63 | protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) |
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index dcb2725..49de8b1 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -51,6 +51,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
51 | get { return m_GatekeeperService; } | 51 | get { return m_GatekeeperService; } |
52 | } | 52 | } |
53 | 53 | ||
54 | bool m_Proxy = false; | ||
55 | |||
54 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : | 56 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : |
55 | base(config, server, String.Empty) | 57 | base(config, server, String.Empty) |
56 | { | 58 | { |
@@ -65,11 +67,13 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
65 | if (m_GatekeeperService == null) | 67 | if (m_GatekeeperService == null) |
66 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); | 68 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); |
67 | 69 | ||
70 | m_Proxy = gridConfig.GetBoolean("HasProxy", false); | ||
71 | |||
68 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); | 72 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); |
69 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); | 73 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); |
70 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | 74 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); |
71 | 75 | ||
72 | server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler); | 76 | server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler); |
73 | } | 77 | } |
74 | 78 | ||
75 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) | 79 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index d10d6fc..f64a079 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | |||
@@ -55,11 +55,13 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
55 | private IUserAgentService m_UserAgentService; | 55 | private IUserAgentService m_UserAgentService; |
56 | 56 | ||
57 | private string m_LoginServerIP; | 57 | private string m_LoginServerIP; |
58 | private bool m_Proxy = false; | ||
58 | 59 | ||
59 | public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP) | 60 | public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP, bool proxy) |
60 | { | 61 | { |
61 | m_UserAgentService = userAgentService; | 62 | m_UserAgentService = userAgentService; |
62 | m_LoginServerIP = loginServerIP; | 63 | m_LoginServerIP = loginServerIP; |
64 | m_Proxy = proxy; | ||
63 | } | 65 | } |
64 | 66 | ||
65 | public Hashtable Handler(Hashtable request) | 67 | public Hashtable Handler(Hashtable request) |
@@ -153,11 +155,11 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
153 | string ip_str = args["client_ip"].ToString(); | 155 | string ip_str = args["client_ip"].ToString(); |
154 | try | 156 | try |
155 | { | 157 | { |
156 | string callerIP = Util.GetCallerIP(request); | 158 | string callerIP = GetCallerIP(request); |
157 | // Verify if this caller has authority to send the client IP | 159 | // Verify if this caller has authority to send the client IP |
158 | if (callerIP == m_LoginServerIP) | 160 | if (callerIP == m_LoginServerIP) |
159 | client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0); | 161 | client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0); |
160 | else | 162 | else // leaving this for now, but this warning should be removed |
161 | m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str); | 163 | m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str); |
162 | } | 164 | } |
163 | catch | 165 | catch |
@@ -198,6 +200,23 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
198 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 200 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
199 | } | 201 | } |
200 | 202 | ||
203 | private string GetCallerIP(Hashtable request) | ||
204 | { | ||
205 | if (!m_Proxy) | ||
206 | return Util.GetCallerIP(request); | ||
207 | |||
208 | // We're behind a proxy | ||
209 | Hashtable headers = (Hashtable)request["headers"]; | ||
210 | if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) | ||
211 | { | ||
212 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); | ||
213 | if (ep != null) | ||
214 | return ep.Address.ToString(); | ||
215 | } | ||
216 | |||
217 | // Oops | ||
218 | return Util.GetCallerIP(request); | ||
219 | } | ||
201 | } | 220 | } |
202 | 221 | ||
203 | } | 222 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 70157d5..e5f6a5d 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
67 | throw new Exception("UserAgent server connector cannot proceed because of missing service"); | 67 | throw new Exception("UserAgent server connector cannot proceed because of missing service"); |
68 | 68 | ||
69 | string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); | 69 | string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); |
70 | bool proxy = gridConfig.GetBoolean("HasProxy", false); | ||
70 | 71 | ||
71 | server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); | 72 | server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); |
72 | server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); | 73 | server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); |
@@ -74,7 +75,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
74 | server.AddXmlRPCHandler("verify_client", VerifyClient, false); | 75 | server.AddXmlRPCHandler("verify_client", VerifyClient, false); |
75 | server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); | 76 | server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); |
76 | 77 | ||
77 | server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler); | 78 | server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); |
78 | } | 79 | } |
79 | 80 | ||
80 | public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) | 81 | public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) |
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 30dc65e..48f5f99 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -88,14 +88,26 @@ namespace OpenSim.Server.Handlers.Login | |||
88 | startLocation = requestData["start"].ToString(); | 88 | startLocation = requestData["start"].ToString(); |
89 | 89 | ||
90 | string clientVersion = "Unknown"; | 90 | string clientVersion = "Unknown"; |
91 | if (requestData.Contains("version")) | 91 | if (requestData.Contains("version") && requestData["version"] != null) |
92 | clientVersion = requestData["version"].ToString(); | 92 | clientVersion = requestData["version"].ToString(); |
93 | // We should do something interesting with the client version... | 93 | // We should do something interesting with the client version... |
94 | 94 | ||
95 | string channel = "Unknown"; | ||
96 | if (requestData.Contains("channel") && requestData["channel"] != null) | ||
97 | channel = requestData["channel"].ToString(); | ||
98 | |||
99 | string mac = "Unknown"; | ||
100 | if (requestData.Contains("mac") && requestData["mac"] != null) | ||
101 | mac = requestData["mac"].ToString(); | ||
102 | |||
103 | string id0 = "Unknown"; | ||
104 | if (requestData.Contains("id0") && requestData["id0"] != null) | ||
105 | id0 = requestData["id0"].ToString(); | ||
106 | |||
95 | //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); | 107 | //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); |
96 | 108 | ||
97 | LoginResponse reply = null; | 109 | LoginResponse reply = null; |
98 | reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); | 110 | reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); |
99 | 111 | ||
100 | XmlRpcResponse response = new XmlRpcResponse(); | 112 | XmlRpcResponse response = new XmlRpcResponse(); |
101 | response.Value = reply.ToHashtable(); | 113 | response.Value = reply.ToHashtable(); |
@@ -166,7 +178,8 @@ namespace OpenSim.Server.Handlers.Login | |||
166 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); | 178 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); |
167 | 179 | ||
168 | LoginResponse reply = null; | 180 | LoginResponse reply = null; |
169 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, String.Empty, remoteClient); | 181 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, |
182 | map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); | ||
170 | return reply.ToOSDMap(); | 183 | return reply.ToOSDMap(); |
171 | 184 | ||
172 | } | 185 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 42ea296..26516ab 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
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 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | protected bool m_Proxy = false; | ||
56 | |||
55 | public AgentHandler() { } | 57 | public AgentHandler() { } |
56 | 58 | ||
57 | public AgentHandler(ISimulationService sim) | 59 | public AgentHandler(ISimulationService sim) |
@@ -184,13 +186,31 @@ namespace OpenSim.Server.Handlers.Simulation | |||
184 | resp["reason"] = OSD.FromString(reason); | 186 | resp["reason"] = OSD.FromString(reason); |
185 | resp["success"] = OSD.FromBoolean(result); | 187 | resp["success"] = OSD.FromBoolean(result); |
186 | // Let's also send out the IP address of the caller back to the caller (HG 1.5) | 188 | // Let's also send out the IP address of the caller back to the caller (HG 1.5) |
187 | resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request)); | 189 | resp["your_ip"] = OSD.FromString(GetCallerIP(request)); |
188 | 190 | ||
189 | // TODO: add reason if not String.Empty? | 191 | // TODO: add reason if not String.Empty? |
190 | responsedata["int_response_code"] = HttpStatusCode.OK; | 192 | responsedata["int_response_code"] = HttpStatusCode.OK; |
191 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 193 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
192 | } | 194 | } |
193 | 195 | ||
196 | private string GetCallerIP(Hashtable request) | ||
197 | { | ||
198 | if (!m_Proxy) | ||
199 | return Util.GetCallerIP(request); | ||
200 | |||
201 | // We're behind a proxy | ||
202 | Hashtable headers = (Hashtable)request["headers"]; | ||
203 | if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) | ||
204 | { | ||
205 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); | ||
206 | if (ep != null) | ||
207 | return ep.Address.ToString(); | ||
208 | } | ||
209 | |||
210 | // Oops | ||
211 | return Util.GetCallerIP(request); | ||
212 | } | ||
213 | |||
194 | // subclasses can override this | 214 | // subclasses can override this |
195 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 215 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) |
196 | { | 216 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 6d3c64a..247dd7e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -238,8 +238,12 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
238 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | 238 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); |
239 | args["destination_name"] = OSD.FromString(destination.RegionName); | 239 | args["destination_name"] = OSD.FromString(destination.RegionName); |
240 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 240 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
241 | if (ipaddress != null) | 241 | |
242 | args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); | 242 | // 10/3/2010 |
243 | // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. | ||
244 | // This need cleaning elsewhere... | ||
245 | //if (ipaddress != null) | ||
246 | // args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); | ||
243 | 247 | ||
244 | return args; | 248 | return args; |
245 | } | 249 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 8acd618..eb6433c 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -148,7 +148,6 @@ namespace OpenSim.Services.HypergridService | |||
148 | agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); | 148 | agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); |
149 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); | 149 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); |
150 | 150 | ||
151 | //bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); | ||
152 | bool success = false; | 151 | bool success = false; |
153 | string myExternalIP = string.Empty; | 152 | string myExternalIP = string.Empty; |
154 | string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; | 153 | string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; |
@@ -200,6 +199,11 @@ namespace OpenSim.Services.HypergridService | |||
200 | { | 199 | { |
201 | if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID)) | 200 | if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID)) |
202 | { | 201 | { |
202 | // Very important! Override whatever this agent comes with. | ||
203 | // UserAgentService always sets the IP for every new agent | ||
204 | // with the original IP address. | ||
205 | agentCircuit.IPAddress = m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress; | ||
206 | |||
203 | old = m_TravelingAgents[agentCircuit.SessionID]; | 207 | old = m_TravelingAgents[agentCircuit.SessionID]; |
204 | } | 208 | } |
205 | 209 | ||
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs index 9e57339..ee9b0b1 100644 --- a/OpenSim/Services/Interfaces/ILoginService.cs +++ b/OpenSim/Services/Interfaces/ILoginService.cs | |||
@@ -47,7 +47,8 @@ namespace OpenSim.Services.Interfaces | |||
47 | 47 | ||
48 | public interface ILoginService | 48 | public interface ILoginService |
49 | { | 49 | { |
50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, string clientVersion, IPEndPoint clientIP); | 50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, |
51 | string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP); | ||
51 | Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP); | 52 | Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP); |
52 | } | 53 | } |
53 | 54 | ||
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 1e4b6c2..6c66414 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -208,7 +208,8 @@ namespace OpenSim.Services.LLLoginService | |||
208 | return response; | 208 | return response; |
209 | } | 209 | } |
210 | 210 | ||
211 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, string clientVersion, IPEndPoint clientIP) | 211 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, |
212 | string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP) | ||
212 | { | 213 | { |
213 | bool success = false; | 214 | bool success = false; |
214 | UUID session = UUID.Random(); | 215 | UUID session = UUID.Random(); |
@@ -346,7 +347,8 @@ namespace OpenSim.Services.LLLoginService | |||
346 | // | 347 | // |
347 | string reason = string.Empty; | 348 | string reason = string.Empty; |
348 | GridRegion dest; | 349 | GridRegion dest; |
349 | AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where, clientVersion, clientIP, out where, out reason, out dest); | 350 | AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where, |
351 | clientVersion, channel, mac, id0, clientIP, out where, out reason, out dest); | ||
350 | destination = dest; | 352 | destination = dest; |
351 | if (aCircuit == null) | 353 | if (aCircuit == null) |
352 | { | 354 | { |
@@ -606,7 +608,8 @@ namespace OpenSim.Services.LLLoginService | |||
606 | } | 608 | } |
607 | 609 | ||
608 | protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarData avatar, | 610 | protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarData avatar, |
609 | UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, IPEndPoint clientIP, out string where, out string reason, out GridRegion dest) | 611 | UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0, |
612 | IPEndPoint clientIP, out string where, out string reason, out GridRegion dest) | ||
610 | { | 613 | { |
611 | where = currentWhere; | 614 | where = currentWhere; |
612 | ISimulationService simConnector = null; | 615 | ISimulationService simConnector = null; |
@@ -646,7 +649,7 @@ namespace OpenSim.Services.LLLoginService | |||
646 | if (m_UserAgentService == null && simConnector != null) | 649 | if (m_UserAgentService == null && simConnector != null) |
647 | { | 650 | { |
648 | circuitCode = (uint)Util.RandomClass.Next(); ; | 651 | circuitCode = (uint)Util.RandomClass.Next(); ; |
649 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, viewer); | 652 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); |
650 | success = LaunchAgentDirectly(simConnector, destination, aCircuit, out reason); | 653 | success = LaunchAgentDirectly(simConnector, destination, aCircuit, out reason); |
651 | if (!success && m_GridService != null) | 654 | if (!success && m_GridService != null) |
652 | { | 655 | { |
@@ -671,7 +674,7 @@ namespace OpenSim.Services.LLLoginService | |||
671 | if (m_UserAgentService != null) | 674 | if (m_UserAgentService != null) |
672 | { | 675 | { |
673 | circuitCode = (uint)Util.RandomClass.Next(); ; | 676 | circuitCode = (uint)Util.RandomClass.Next(); ; |
674 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, viewer); | 677 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); |
675 | success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); | 678 | success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); |
676 | if (!success && m_GridService != null) | 679 | if (!success && m_GridService != null) |
677 | { | 680 | { |
@@ -700,7 +703,8 @@ namespace OpenSim.Services.LLLoginService | |||
700 | } | 703 | } |
701 | 704 | ||
702 | private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, | 705 | private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, |
703 | AvatarData avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, string viewer) | 706 | AvatarData avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, |
707 | string ipaddress, string viewer, string channel, string mac, string id0) | ||
704 | { | 708 | { |
705 | AgentCircuitData aCircuit = new AgentCircuitData(); | 709 | AgentCircuitData aCircuit = new AgentCircuitData(); |
706 | 710 | ||
@@ -721,7 +725,11 @@ namespace OpenSim.Services.LLLoginService | |||
721 | aCircuit.SecureSessionID = secureSession; | 725 | aCircuit.SecureSessionID = secureSession; |
722 | aCircuit.SessionID = session; | 726 | aCircuit.SessionID = session; |
723 | aCircuit.startpos = position; | 727 | aCircuit.startpos = position; |
728 | aCircuit.IPAddress = ipaddress; | ||
724 | aCircuit.Viewer = viewer; | 729 | aCircuit.Viewer = viewer; |
730 | aCircuit.Channel = channel; | ||
731 | aCircuit.Mac = mac; | ||
732 | aCircuit.Id0 = id0; | ||
725 | SetServiceURLs(aCircuit, account); | 733 | SetServiceURLs(aCircuit, account); |
726 | 734 | ||
727 | return aCircuit; | 735 | return aCircuit; |