aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
diff options
context:
space:
mode:
authorDiva Canto2011-05-26 10:04:48 -0700
committerDiva Canto2011-05-26 10:04:48 -0700
commit0c58a9e68074f3593920dc9f2356bbed96416497 (patch)
tree6bccb313c233ab6486195e8a3663cfa1d30c41b9 /OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
parentHG: Renamed, shuffled some interfaces around. Move them all to IHypergridServ... (diff)
downloadopensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.zip
opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.gz
opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.bz2
opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.xz
HG IM in grid mode working fairly well. Unknown target user references looked back in source user's User Agent service.
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs57
1 files changed, 50 insertions, 7 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 942d960..eb184a5 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -54,6 +54,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
54 private IUserAgentService m_HomeUsersService; 54 private IUserAgentService m_HomeUsersService;
55 private string[] m_AuthorizedCallers; 55 private string[] m_AuthorizedCallers;
56 56
57 private bool m_VerifyCallers = false;
58
57 public UserAgentServerConnector(IConfigSource config, IHttpServer server) : 59 public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
58 this(config, server, null) 60 this(config, server, null)
59 { 61 {
@@ -76,6 +78,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
76 string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); 78 string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
77 bool proxy = gridConfig.GetBoolean("HasProxy", false); 79 bool proxy = gridConfig.GetBoolean("HasProxy", false);
78 80
81 m_VerifyCallers = gridConfig.GetBoolean("VerifyCallers", false);
79 string csv = gridConfig.GetString("AuthorizedCallers", "127.0.0.1"); 82 string csv = gridConfig.GetString("AuthorizedCallers", "127.0.0.1");
80 csv = csv.Replace(" ", ""); 83 csv = csv.Replace(" ", "");
81 m_AuthorizedCallers = csv.Split(','); 84 m_AuthorizedCallers = csv.Split(',');
@@ -91,6 +94,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
91 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); 94 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
92 95
93 server.AddXmlRPCHandler("locate_user", LocateUser, false); 96 server.AddXmlRPCHandler("locate_user", LocateUser, false);
97 server.AddXmlRPCHandler("get_uui", GetUUI, false);
94 98
95 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); 99 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
96 } 100 }
@@ -324,13 +328,17 @@ namespace OpenSim.Server.Handlers.Hypergrid
324 { 328 {
325 Hashtable hash = new Hashtable(); 329 Hashtable hash = new Hashtable();
326 330
327 bool authorized = false; 331 bool authorized = true;
328 foreach (string s in m_AuthorizedCallers) 332 if (m_VerifyCallers)
329 if (s == remoteClient.Address.ToString()) 333 {
330 { 334 authorized = false;
331 authorized = true; 335 foreach (string s in m_AuthorizedCallers)
332 break; 336 if (s == remoteClient.Address.ToString())
333 } 337 {
338 authorized = true;
339 break;
340 }
341 }
334 342
335 if (authorized) 343 if (authorized)
336 { 344 {
@@ -354,5 +362,40 @@ namespace OpenSim.Server.Handlers.Hypergrid
354 return response; 362 return response;
355 363
356 } 364 }
365
366 /// <summary>
367 /// Locates the user.
368 /// This is a sensitive operation, only authorized IP addresses can perform it.
369 /// </summary>
370 /// <param name="request"></param>
371 /// <param name="remoteClient"></param>
372 /// <returns></returns>
373 public XmlRpcResponse GetUUI(XmlRpcRequest request, IPEndPoint remoteClient)
374 {
375 Hashtable hash = new Hashtable();
376
377 Hashtable requestData = (Hashtable)request.Params[0];
378 //string host = (string)requestData["host"];
379 //string portstr = (string)requestData["port"];
380 if (requestData.ContainsKey("userID") && requestData.ContainsKey("targetUserID"))
381 {
382 string userID_str = (string)requestData["userID"];
383 UUID userID = UUID.Zero;
384 UUID.TryParse(userID_str, out userID);
385
386 string tuserID_str = (string)requestData["targetUserID"];
387 UUID targetUserID = UUID.Zero;
388 UUID.TryParse(tuserID_str, out targetUserID);
389 string uui = m_HomeUsersService.GetUUI(userID, targetUserID);
390 if (uui != string.Empty)
391 hash["UUI"] = uui;
392 }
393
394 XmlRpcResponse response = new XmlRpcResponse();
395 response.Value = hash;
396 return response;
397
398 }
399
357 } 400 }
358} 401}