From 3147def23fba6bd535591cdb4a77206debc20adb Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 16 Mar 2007 20:40:39 +0000 Subject: [PATCH] * Corrected login fail code (adapted from Gareths php) --- src/GridServers/LoginServer.cs | 140 +++++++++++++++++---------------- 1 file changed, 71 insertions(+), 69 deletions(-) diff --git a/src/GridServers/LoginServer.cs b/src/GridServers/LoginServer.cs index 9d335238f3..86dd6290e2 100644 --- a/src/GridServers/LoginServer.cs +++ b/src/GridServers/LoginServer.cs @@ -202,80 +202,82 @@ namespace OpenSim.GridServers { passwd = "notfound"; } - + + XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); + Hashtable responseData = (Hashtable)response.Value; + if( !Authenticate(first, last, passwd)) { - // Fail miserably - writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); - writer.WriteLine(); - return; + responseData["reason"] = "key"; + responseData["message"] = "You have entered an invalid name/password combination. Check Caps/lock."; + responseData["login"] = "false"; } - NumClients++; - - //create a agent and session LLUUID - Agent = GetAgentId( first, last ); - int SessionRand = this.RandomClass.Next(1,999); - Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); - - //create some login info - Hashtable LoginFlagsHash = new Hashtable(); - LoginFlagsHash["daylight_savings"]="N"; - LoginFlagsHash["stipend_since_login"]="N"; - LoginFlagsHash["gendered"]="Y"; - LoginFlagsHash["ever_logged_in"]="Y"; - ArrayList LoginFlags=new ArrayList(); - LoginFlags.Add(LoginFlagsHash); - - Hashtable GlobalT = new Hashtable(); - GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; - GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; - GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; - ArrayList GlobalTextures = new ArrayList(); - GlobalTextures.Add(GlobalT); - - XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); - Hashtable responseData = (Hashtable)response.Value; - - responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; - responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; - responseData["agent_id"] = Agent.ToStringHyphenated(); - responseData["session_id"] = Session.ToStringHyphenated(); - responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds; - responseData["login-flags"]=LoginFlags; - responseData["global-textures"]=GlobalTextures; - - //inventory - ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; - Hashtable Inventory1 = (Hashtable)InventoryList[0]; - Hashtable Inventory2 = (Hashtable)InventoryList[1]; - LLUUID BaseFolderID = LLUUID.Random(); - LLUUID InventoryFolderID = LLUUID.Random(); - Inventory2["name"] = "Base"; - Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); - Inventory2["type_default"] =6; - Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); - - ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; - Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; - Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); - - CustomiseLoginResponse( responseData, first, last ); - - this._login = new Login(); - //copy data to login object - _login.First = first; - _login.Last = last; - _login.Agent = Agent; - _login.Session = Session; - _login.BaseFolder = BaseFolderID; - _login.InventoryFolder = InventoryFolderID; - - //working on local computer if so lets add to the gridserver's list of sessions? - if(OpenSim_Main.gridServers.GridServer.GetName() == "Local") + else { - ((LocalGridBase)this._gridServer).AddNewSession(_login); - } + NumClients++; + //create a agent and session LLUUID + Agent = GetAgentId( first, last ); + int SessionRand = this.RandomClass.Next(1,999); + Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); + + //create some login info + Hashtable LoginFlagsHash = new Hashtable(); + LoginFlagsHash["daylight_savings"]="N"; + LoginFlagsHash["stipend_since_login"]="N"; + LoginFlagsHash["gendered"]="Y"; + LoginFlagsHash["ever_logged_in"]="Y"; + ArrayList LoginFlags=new ArrayList(); + LoginFlags.Add(LoginFlagsHash); + + Hashtable GlobalT = new Hashtable(); + GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; + GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; + GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; + ArrayList GlobalTextures = new ArrayList(); + GlobalTextures.Add(GlobalT); + + responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; + responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; + responseData["agent_id"] = Agent.ToStringHyphenated(); + responseData["session_id"] = Session.ToStringHyphenated(); + responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds; + responseData["login-flags"]=LoginFlags; + responseData["global-textures"]=GlobalTextures; + + //inventory + ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; + Hashtable Inventory1 = (Hashtable)InventoryList[0]; + Hashtable Inventory2 = (Hashtable)InventoryList[1]; + LLUUID BaseFolderID = LLUUID.Random(); + LLUUID InventoryFolderID = LLUUID.Random(); + Inventory2["name"] = "Base"; + Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); + Inventory2["type_default"] =6; + Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); + + ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; + Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; + Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); + + CustomiseLoginResponse( responseData, first, last ); + + this._login = new Login(); + //copy data to login object + _login.First = first; + _login.Last = last; + _login.Agent = Agent; + _login.Session = Session; + _login.BaseFolder = BaseFolderID; + _login.InventoryFolder = InventoryFolderID; + + //working on local computer if so lets add to the gridserver's list of sessions? + if(OpenSim_Main.gridServers.GridServer.GetName() == "Local") + { + ((LocalGridBase)this._gridServer).AddNewSession(_login); + } + } + // forward the XML-RPC response to the client writer.WriteLine("HTTP/1.0 200 OK"); writer.WriteLine("Content-type: text/xml");