* In the interests of making life difficult for everyone, the Grid Server now actually checks your authentication keys rather than ignoring them.

ThreadPoolClientBranch
Adam Frisby 2008-01-12 19:23:56 +00:00
parent d3fa814458
commit 0b0df333dc
2 changed files with 142 additions and 128 deletions

View File

@ -243,20 +243,16 @@ namespace OpenSim.Grid.GridServer
// logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
} }
else if (requestData.ContainsKey("region_handle"))
{
// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
}
else else
{ {
responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; MainLog.Instance.Verbose("GRID", "Region connected without a UUID, ignoring.");
responseData["error"] = "No UUID passed to grid server - unable to connect you";
return response; return response;
} }
if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
{ {
Console.WriteLine("NEW SIM"); MainLog.Instance.Verbose("GRID", "New region connecting");
myword = "creation"; myword = "creation";
} }
else else
@ -286,6 +282,14 @@ namespace OpenSim.Grid.GridServer
TheSim.regionLocZ = 0; TheSim.regionLocZ = 0;
TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
try
{
TheSim.regionRecvKey = (string)requestData["recvkey"];
TheSim.regionSendKey = (string)requestData["authkey"];
}
catch (KeyNotFoundException) { }
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
@ -299,7 +303,10 @@ namespace OpenSim.Grid.GridServer
OldSim = getRegion(TheSim.regionHandle); OldSim = getRegion(TheSim.regionHandle);
if (OldSim == null || OldSim.UUID == TheSim.UUID) if (OldSim == null || OldSim.UUID == TheSim.UUID)
{ {
Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + if (OldSim == null || (OldSim.regionRecvKey == TheSim.regionRecvKey &&
OldSim.regionSendKey == TheSim.regionSendKey))
{
MainLog.Instance.Verbose("GRID", "Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
TheSim.serverURI); TheSim.serverURI);
foreach (KeyValuePair<string, IGridData> kvp in _plugins) foreach (KeyValuePair<string, IGridData> kvp in _plugins)
{ {
@ -434,7 +441,13 @@ namespace OpenSim.Grid.GridServer
responseData["messageserver_recvkey" + i] = _MessageServers[i].recvkey; responseData["messageserver_recvkey" + i] = _MessageServers[i].recvkey;
} }
return response; return response;
}
else
{
MainLog.Instance.Warn("grid", "Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName);
responseData["error"] = "The key required to connect to your region did not match. Please check your send and recieve keys.";
return response;
}
} }
else else
{ {

View File

@ -98,6 +98,7 @@ namespace OpenSim.Region.Communications.OGS1
// Login / Authentication // Login / Authentication
GridParams["authkey"] = serversInfo.GridSendKey; GridParams["authkey"] = serversInfo.GridSendKey;
GridParams["recvkey"] = serversInfo.GridRecvKey;
GridParams["UUID"] = regionInfo.RegionID.ToString(); GridParams["UUID"] = regionInfo.RegionID.ToString();
GridParams["sim_ip"] = regionInfo.ExternalHostName; GridParams["sim_ip"] = regionInfo.ExternalHostName;
GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString();