aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/GridServers/LoginServer.cs231
1 files changed, 119 insertions, 112 deletions
diff --git a/src/GridServers/LoginServer.cs b/src/GridServers/LoginServer.cs
index 86dd629..4efcd51 100644
--- a/src/GridServers/LoginServer.cs
+++ b/src/GridServers/LoginServer.cs
@@ -168,117 +168,9 @@ namespace OpenSim.GridServers
168 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); 168 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
169 if(request.MethodName == "login_to_simulator") 169 if(request.MethodName == "login_to_simulator")
170 { 170 {
171 Hashtable requestData = (Hashtable)request.Params[0]; 171 XmlRpcResponse response = ProcessRequest(request);
172 string first;
173 string last;
174 string passwd;
175 LLUUID Agent;
176 LLUUID Session;
177
178 //get login name
179 if(requestData.Contains("first"))
180 {
181 first = (string)requestData["first"];
182 }
183 else
184 {
185 first = "test";
186 }
187
188 if(requestData.Contains("last"))
189 {
190 last = (string)requestData["last"];
191 }
192 else
193 {
194 last = "User"+NumClients.ToString();
195 }
196
197 if(requestData.Contains("passwd"))
198 {
199 passwd = (string)requestData["passwd"];
200 }
201 else
202 {
203 passwd = "notfound";
204 }
205 172
206 XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); 173 // forward the XML-RPC response to the client
207 Hashtable responseData = (Hashtable)response.Value;
208
209 if( !Authenticate(first, last, passwd))
210 {
211 responseData["reason"] = "key";
212 responseData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
213 responseData["login"] = "false";
214 }
215 else
216 {
217 NumClients++;
218
219 //create a agent and session LLUUID
220 Agent = GetAgentId( first, last );
221 int SessionRand = this.RandomClass.Next(1,999);
222 Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
223
224 //create some login info
225 Hashtable LoginFlagsHash = new Hashtable();
226 LoginFlagsHash["daylight_savings"]="N";
227 LoginFlagsHash["stipend_since_login"]="N";
228 LoginFlagsHash["gendered"]="Y";
229 LoginFlagsHash["ever_logged_in"]="Y";
230 ArrayList LoginFlags=new ArrayList();
231 LoginFlags.Add(LoginFlagsHash);
232
233 Hashtable GlobalT = new Hashtable();
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);
239
240 responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort;
241 responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
242 responseData["agent_id"] = Agent.ToStringHyphenated();
243 responseData["session_id"] = Session.ToStringHyphenated();
244 responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds;
245 responseData["login-flags"]=LoginFlags;
246 responseData["global-textures"]=GlobalTextures;
247
248 //inventory
249 ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
250 Hashtable Inventory1 = (Hashtable)InventoryList[0];
251 Hashtable Inventory2 = (Hashtable)InventoryList[1];
252 LLUUID BaseFolderID = LLUUID.Random();
253 LLUUID InventoryFolderID = LLUUID.Random();
254 Inventory2["name"] = "Base";
255 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
256 Inventory2["type_default"] =6;
257 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
258
259 ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"];
260 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
261 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
262
263 CustomiseLoginResponse( responseData, first, last );
264
265 this._login = new Login();
266 //copy data to login object
267 _login.First = first;
268 _login.Last = last;
269 _login.Agent = Agent;
270 _login.Session = Session;
271 _login.BaseFolder = BaseFolderID;
272 _login.InventoryFolder = InventoryFolderID;
273
274 //working on local computer if so lets add to the gridserver's list of sessions?
275 if(OpenSim_Main.gridServers.GridServer.GetName() == "Local")
276 {
277 ((LocalGridBase)this._gridServer).AddNewSession(_login);
278 }
279 }
280
281 // forward the XML-RPC response to the client
282 writer.WriteLine("HTTP/1.0 200 OK"); 174 writer.WriteLine("HTTP/1.0 200 OK");
283 writer.WriteLine("Content-type: text/xml"); 175 writer.WriteLine("Content-type: text/xml");
284 writer.WriteLine(); 176 writer.WriteLine();
@@ -294,8 +186,123 @@ namespace OpenSim.GridServers
294 } 186 }
295 } 187 }
296 } 188 }
297 189
298 protected virtual void CustomiseLoginResponse( Hashtable responseData, string first, string last ) 190 private XmlRpcResponse ProcessRequest(XmlRpcRequest request)
191 {
192 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
193
194 Hashtable responseData = (Hashtable)response.Value;
195 Hashtable requestData = (Hashtable)request.Params[0];
196
197 string first;
198 string last;
199 string passwd;
200 LLUUID Agent;
201 LLUUID Session;
202
203 //get login name
204 if(requestData.Contains("first"))
205 {
206 first = (string)requestData["first"];
207 }
208 else
209 {
210 first = "test";
211 }
212
213 if(requestData.Contains("last"))
214 {
215 last = (string)requestData["last"];
216 }
217 else
218 {
219 last = "User"+NumClients.ToString();
220 }
221
222 if(requestData.Contains("passwd"))
223 {
224 passwd = (string)requestData["passwd"];
225 }
226 else
227 {
228 passwd = "notfound";
229 }
230
231 if( !Authenticate(first, last, passwd))
232 {
233 responseData["reason"] = "key";
234 responseData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
235 responseData["login"] = "false";
236 }
237 else
238 {
239 NumClients++;
240
241 //create a agent and session LLUUID
242 Agent = GetAgentId( first, last );
243 int SessionRand = this.RandomClass.Next(1,999);
244 Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
245
246 //create some login info
247 Hashtable LoginFlagsHash = new Hashtable();
248 LoginFlagsHash["daylight_savings"]="N";
249 LoginFlagsHash["stipend_since_login"]="N";
250 LoginFlagsHash["gendered"]="Y";
251 LoginFlagsHash["ever_logged_in"]="Y";
252 ArrayList LoginFlags=new ArrayList();
253 LoginFlags.Add(LoginFlagsHash);
254
255 Hashtable GlobalT = new Hashtable();
256 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
257 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
258 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
259 ArrayList GlobalTextures = new ArrayList();
260 GlobalTextures.Add(GlobalT);
261
262 responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort;
263 responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
264 responseData["agent_id"] = Agent.ToStringHyphenated();
265 responseData["session_id"] = Session.ToStringHyphenated();
266 responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds;
267 responseData["login-flags"]=LoginFlags;
268 responseData["global-textures"]=GlobalTextures;
269
270 //inventory
271 ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
272 Hashtable Inventory1 = (Hashtable)InventoryList[0];
273 Hashtable Inventory2 = (Hashtable)InventoryList[1];
274 LLUUID BaseFolderID = LLUUID.Random();
275 LLUUID InventoryFolderID = LLUUID.Random();
276 Inventory2["name"] = "Base";
277 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
278 Inventory2["type_default"] =6;
279 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
280
281 ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"];
282 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
283 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
284
285 CustomiseLoginResponse( responseData, first, last );
286
287 this._login = new Login();
288 //copy data to login object
289 _login.First = first;
290 _login.Last = last;
291 _login.Agent = Agent;
292 _login.Session = Session;
293 _login.BaseFolder = BaseFolderID;
294 _login.InventoryFolder = InventoryFolderID;
295
296 //working on local computer if so lets add to the gridserver's list of sessions?
297 if(OpenSim_Main.gridServers.GridServer.GetName() == "Local")
298 {
299 ((LocalGridBase)this._gridServer).AddNewSession(_login);
300 }
301 }
302 return response;
303 }
304
305 protected virtual void CustomiseLoginResponse( Hashtable responseData, string first, string last )
299 { 306 {
300 } 307 }
301 308