aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-03-16 20:40:39 +0000
committerlbsa712007-03-16 20:40:39 +0000
commit3147def23fba6bd535591cdb4a77206debc20adb (patch)
tree2ed80932570a71184b5898022c76d4fb4d2d3e3f
parent* renamed Framework Project to OpenSim.Framework (diff)
downloadopensim-SC_OLD-3147def23fba6bd535591cdb4a77206debc20adb.zip
opensim-SC_OLD-3147def23fba6bd535591cdb4a77206debc20adb.tar.gz
opensim-SC_OLD-3147def23fba6bd535591cdb4a77206debc20adb.tar.bz2
opensim-SC_OLD-3147def23fba6bd535591cdb4a77206debc20adb.tar.xz
* Corrected login fail code (adapted from Gareths php)
-rw-r--r--src/GridServers/LoginServer.cs124
1 files changed, 63 insertions, 61 deletions
diff --git a/src/GridServers/LoginServer.cs b/src/GridServers/LoginServer.cs
index 9d33523..86dd629 100644
--- a/src/GridServers/LoginServer.cs
+++ b/src/GridServers/LoginServer.cs
@@ -202,80 +202,82 @@ namespace OpenSim.GridServers
202 { 202 {
203 passwd = "notfound"; 203 passwd = "notfound";
204 } 204 }
205 205
206 XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
207 Hashtable responseData = (Hashtable)response.Value;
208
206 if( !Authenticate(first, last, passwd)) 209 if( !Authenticate(first, last, passwd))
207 { 210 {
208 // Fail miserably 211 responseData["reason"] = "key";
209 writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); 212 responseData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
210 writer.WriteLine(); 213 responseData["login"] = "false";
211 return;
212 } 214 }
213 NumClients++; 215 else
214 216 {
215 //create a agent and session LLUUID 217 NumClients++;
216 Agent = GetAgentId( first, last );
217 int SessionRand = this.RandomClass.Next(1,999);
218 Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
219 218
220 //create some login info 219 //create a agent and session LLUUID
221 Hashtable LoginFlagsHash = new Hashtable(); 220 Agent = GetAgentId( first, last );
222 LoginFlagsHash["daylight_savings"]="N"; 221 int SessionRand = this.RandomClass.Next(1,999);
223 LoginFlagsHash["stipend_since_login"]="N"; 222 Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
224 LoginFlagsHash["gendered"]="Y";
225 LoginFlagsHash["ever_logged_in"]="Y";
226 ArrayList LoginFlags=new ArrayList();
227 LoginFlags.Add(LoginFlagsHash);
228 223
229 Hashtable GlobalT = new Hashtable(); 224 //create some login info
230 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; 225 Hashtable LoginFlagsHash = new Hashtable();
231 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 226 LoginFlagsHash["daylight_savings"]="N";
232 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 227 LoginFlagsHash["stipend_since_login"]="N";
233 ArrayList GlobalTextures = new ArrayList(); 228 LoginFlagsHash["gendered"]="Y";
234 GlobalTextures.Add(GlobalT); 229 LoginFlagsHash["ever_logged_in"]="Y";
230 ArrayList LoginFlags=new ArrayList();
231 LoginFlags.Add(LoginFlagsHash);
235 232
236 XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); 233 Hashtable GlobalT = new Hashtable();
237 Hashtable responseData = (Hashtable)response.Value; 234 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
235 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
236 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
237 ArrayList GlobalTextures = new ArrayList();
238 GlobalTextures.Add(GlobalT);
238 239
239 responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; 240 responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort;
240 responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; 241 responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
241 responseData["agent_id"] = Agent.ToStringHyphenated(); 242 responseData["agent_id"] = Agent.ToStringHyphenated();
242 responseData["session_id"] = Session.ToStringHyphenated(); 243 responseData["session_id"] = Session.ToStringHyphenated();
243 responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds; 244 responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds;
244 responseData["login-flags"]=LoginFlags; 245 responseData["login-flags"]=LoginFlags;
245 responseData["global-textures"]=GlobalTextures; 246 responseData["global-textures"]=GlobalTextures;
246 247
247 //inventory 248 //inventory
248 ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; 249 ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
249 Hashtable Inventory1 = (Hashtable)InventoryList[0]; 250 Hashtable Inventory1 = (Hashtable)InventoryList[0];
250 Hashtable Inventory2 = (Hashtable)InventoryList[1]; 251 Hashtable Inventory2 = (Hashtable)InventoryList[1];
251 LLUUID BaseFolderID = LLUUID.Random(); 252 LLUUID BaseFolderID = LLUUID.Random();
252 LLUUID InventoryFolderID = LLUUID.Random(); 253 LLUUID InventoryFolderID = LLUUID.Random();
253 Inventory2["name"] = "Base"; 254 Inventory2["name"] = "Base";
254 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); 255 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
255 Inventory2["type_default"] =6; 256 Inventory2["type_default"] =6;
256 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); 257 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
257 258
258 ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; 259 ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"];
259 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; 260 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
260 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); 261 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
261 262
262 CustomiseLoginResponse( responseData, first, last ); 263 CustomiseLoginResponse( responseData, first, last );
263 264
264 this._login = new Login(); 265 this._login = new Login();
265 //copy data to login object 266 //copy data to login object
266 _login.First = first; 267 _login.First = first;
267 _login.Last = last; 268 _login.Last = last;
268 _login.Agent = Agent; 269 _login.Agent = Agent;
269 _login.Session = Session; 270 _login.Session = Session;
270 _login.BaseFolder = BaseFolderID; 271 _login.BaseFolder = BaseFolderID;
271 _login.InventoryFolder = InventoryFolderID; 272 _login.InventoryFolder = InventoryFolderID;
272 273
273 //working on local computer if so lets add to the gridserver's list of sessions? 274 //working on local computer if so lets add to the gridserver's list of sessions?
274 if(OpenSim_Main.gridServers.GridServer.GetName() == "Local") 275 if(OpenSim_Main.gridServers.GridServer.GetName() == "Local")
275 { 276 {
276 ((LocalGridBase)this._gridServer).AddNewSession(_login); 277 ((LocalGridBase)this._gridServer).AddNewSession(_login);
278 }
277 } 279 }
278 280
279 // forward the XML-RPC response to the client 281 // forward the XML-RPC response to the client
280 writer.WriteLine("HTTP/1.0 200 OK"); 282 writer.WriteLine("HTTP/1.0 200 OK");
281 writer.WriteLine("Content-type: text/xml"); 283 writer.WriteLine("Content-type: text/xml");