aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenSim.Servers
diff options
context:
space:
mode:
authorMW2007-06-28 11:26:22 +0000
committerMW2007-06-28 11:26:22 +0000
commit1aca39a7a6148e77bc75b912ec7da5d4ed6fe427 (patch)
tree2fc3441d0357d80b6827bec32e740c21c0ba6e6b /Common/OpenSim.Servers
parent* Run prebuild, and stuff. (Fixed bug) (diff)
downloadopensim-SC_OLD-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.zip
opensim-SC_OLD-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.tar.gz
opensim-SC_OLD-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.tar.bz2
opensim-SC_OLD-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.tar.xz
Deleted some files that are no longer in use. (I am sure I deleted these yesterday but they seem to have returned).
Diffstat (limited to '')
-rw-r--r--Common/OpenSim.Servers/LocalUserProfileManager.cs124
-rw-r--r--Common/OpenSim.Servers/LoginResponse.cs655
-rw-r--r--Common/OpenSim.Servers/LoginServer.cs258
-rw-r--r--Common/OpenSim.Servers/OpenSim.Servers.csproj46
4 files changed, 22 insertions, 1061 deletions
diff --git a/Common/OpenSim.Servers/LocalUserProfileManager.cs b/Common/OpenSim.Servers/LocalUserProfileManager.cs
deleted file mode 100644
index 773de5a..0000000
--- a/Common/OpenSim.Servers/LocalUserProfileManager.cs
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections.Generic;
31using System.Collections;
32using System.Text;
33using OpenSim.Framework.User;
34using OpenSim.Framework.Grid;
35using OpenSim.Framework.Inventory;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types;
38using libsecondlife;
39
40namespace OpenSim.UserServer
41{
42 public class LocalUserProfileManager : UserProfileManager
43 {
44 // private IGridServer m_gridServer;
45 private int m_port;
46 private string m_ipAddr;
47 private uint regionX;
48 private uint regionY;
49 private AddNewSessionHandler AddSession;
50
51 public LocalUserProfileManager( int simPort, string ipAddr , uint regX, uint regY)
52 {
53
54 m_port = simPort;
55 m_ipAddr = ipAddr;
56 regionX = regX;
57 regionY = regY;
58 }
59
60 public void SetSessionHandler(AddNewSessionHandler sessionHandler)
61 {
62 this.AddSession = sessionHandler;
63 }
64
65 public override void InitUserProfiles()
66 {
67 // TODO: need to load from database
68 }
69
70 public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
71 {
72 Int32 circode = (Int32)response["circuit_code"];
73 theUser.AddSimCircuit((uint)circode, LLUUID.Random());
74 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
75 response["sim_port"] = m_port;
76 response["sim_ip"] = m_ipAddr;
77 response["region_y"] = (Int32)regionY* 256;
78 response["region_x"] = (Int32)regionX* 256;
79
80 string first;
81 string last;
82 if (response.Contains("first_name"))
83 {
84 first = (string)response["first_name"];
85 }
86 else
87 {
88 first = "test";
89 }
90
91 if (response.Contains("last_name"))
92 {
93 last = (string)response["last_name"];
94 }
95 else
96 {
97 last = "User";
98 }
99
100 ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
101 Hashtable Inventory1 = (Hashtable)InventoryList[0];
102
103 Login _login = new Login();
104 //copy data to login object
105 _login.First = first;
106 _login.Last = last;
107 _login.Agent = new LLUUID((string)response["agent_id"]) ;
108 _login.Session = new LLUUID((string)response["session_id"]);
109 _login.SecureSession = new LLUUID((string)response["secure_session_id"]);
110 _login.CircuitCode =(uint) circode;
111 _login.BaseFolder = null;
112 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
113
114 //working on local computer if so lets add to the gridserver's list of sessions?
115 /*if (m_gridServer.GetName() == "Local")
116 {
117 Console.WriteLine("adding login data to gridserver");
118 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
119 }*/
120 ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256));
121 this.AddSession(reghand, _login);
122 }
123 }
124}
diff --git a/Common/OpenSim.Servers/LoginResponse.cs b/Common/OpenSim.Servers/LoginResponse.cs
deleted file mode 100644
index dc4732c..0000000
--- a/Common/OpenSim.Servers/LoginResponse.cs
+++ /dev/null
@@ -1,655 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using Nwc.XmlRpc;
30using System;
31using System.IO;
32using System.Net;
33using System.Net.Sockets;
34using System.Text;
35using System.Text.RegularExpressions;
36using System.Threading;
37using System.Collections;
38using System.Security.Cryptography;
39using System.Xml;
40using libsecondlife;
41using OpenSim;
42using OpenSim.Framework.User;
43using OpenSim.Framework.Inventory;
44using OpenSim.Framework.Utilities;
45using OpenSim.Framework.Interfaces;
46
47// ?
48using OpenSim.Framework.Grid;
49
50namespace OpenSim.UserServer
51{
52 /// <summary>
53 /// A temp class to handle login response.
54 /// Should make use of UserProfileManager where possible.
55 /// </summary>
56
57 public class LoginResponse
58 {
59 private Hashtable loginFlagsHash;
60 private Hashtable globalTexturesHash;
61 private Hashtable loginError;
62 private Hashtable eventCategoriesHash;
63 private Hashtable uiConfigHash;
64 private Hashtable classifiedCategoriesHash;
65
66 private ArrayList loginFlags;
67 private ArrayList globalTextures;
68 private ArrayList eventCategories;
69 private ArrayList uiConfig;
70 private ArrayList classifiedCategories;
71 private ArrayList inventoryRoot;
72 private ArrayList initialOutfit;
73 private ArrayList agentInventory;
74
75 private UserInfo userProfile;
76
77 private LLUUID agentID;
78 private LLUUID sessionID;
79 private LLUUID secureSessionID;
80 private LLUUID baseFolderID;
81 private LLUUID inventoryFolderID;
82
83 // Login Flags
84 private string dst;
85 private string stipendSinceLogin;
86 private string gendered;
87 private string everLoggedIn;
88 private string login;
89 private string simPort;
90 private string simAddress;
91 private string agentAccess;
92 private Int32 circuitCode;
93 private uint regionX;
94 private uint regionY;
95
96 // Login
97 private string firstname;
98 private string lastname;
99
100 // Global Textures
101 private string sunTexture;
102 private string cloudTexture;
103 private string moonTexture;
104
105 // Error Flags
106 private string errorReason;
107 private string errorMessage;
108
109 // Response
110 private XmlRpcResponse xmlRpcResponse;
111 private XmlRpcResponse defaultXmlRpcResponse;
112
113 private string welcomeMessage;
114 private string startLocation;
115 private string allowFirstLife;
116 private string home;
117 private string seedCapability;
118 private string lookAt;
119
120 public LoginResponse()
121 {
122 this.loginFlags = new ArrayList();
123 this.globalTextures = new ArrayList();
124 this.eventCategories = new ArrayList();
125 this.uiConfig = new ArrayList();
126 this.classifiedCategories = new ArrayList();
127
128 this.loginError = new Hashtable();
129 this.eventCategoriesHash = new Hashtable();
130 this.classifiedCategoriesHash = new Hashtable();
131 this.uiConfigHash = new Hashtable();
132
133 this.defaultXmlRpcResponse = new XmlRpcResponse();
134 this.userProfile = new UserInfo();
135 this.inventoryRoot = new ArrayList();
136 this.initialOutfit = new ArrayList();
137 this.agentInventory = new ArrayList();
138
139 this.xmlRpcResponse = new XmlRpcResponse();
140 this.defaultXmlRpcResponse = new XmlRpcResponse();
141
142 this.SetDefaultValues();
143 } // LoginServer
144
145 public void SetDefaultValues()
146 {
147 try
148 {
149 this.DST = "N";
150 this.StipendSinceLogin = "N";
151 this.Gendered = "Y";
152 this.EverLoggedIn = "Y";
153 this.login = "false";
154 this.firstname = "Test";
155 this.lastname = "User";
156 this.agentAccess = "M";
157 this.startLocation = "last";
158 this.allowFirstLife = "Y";
159
160 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
161 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
162 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
163
164 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
165 this.ErrorReason = "key";
166 this.welcomeMessage = "Welcome to OpenSim!";
167 this.seedCapability = "";
168 this.home = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}";
169 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
170 this.RegionX = (uint)255232;
171 this.RegionY = (uint)254976;
172
173 // Classifieds;
174 this.AddClassifiedCategory((Int32)1, "Shopping");
175 this.AddClassifiedCategory((Int32)2, "Land Rental");
176 this.AddClassifiedCategory((Int32)3, "Property Rental");
177 this.AddClassifiedCategory((Int32)4, "Special Attraction");
178 this.AddClassifiedCategory((Int32)5, "New Products");
179 this.AddClassifiedCategory((Int32)6, "Employment");
180 this.AddClassifiedCategory((Int32)7, "Wanted");
181 this.AddClassifiedCategory((Int32)8, "Service");
182 this.AddClassifiedCategory((Int32)9, "Personal");
183
184 this.SessionID = LLUUID.Random();
185 this.SecureSessionID = LLUUID.Random();
186 this.AgentID = LLUUID.Random();
187
188 Hashtable InitialOutfitHash = new Hashtable();
189 InitialOutfitHash["folder_name"] = "Nightclub Female";
190 InitialOutfitHash["gender"] = "female";
191 this.initialOutfit.Add(InitialOutfitHash);
192 }
193 catch (Exception e)
194 {
195 OpenSim.Framework.Console.MainLog.Instance.WriteLine(
196 OpenSim.Framework.Console.LogPriority.LOW,
197 "LoginResponse: Unable to set default values: " + e.Message
198 );
199 }
200
201 } // SetDefaultValues
202
203 private XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
204 {
205 // Overwrite any default values;
206 this.xmlRpcResponse = new XmlRpcResponse();
207
208 // Ensure Login Failed message/reason;
209 this.ErrorMessage = message;
210 this.ErrorReason = reason;
211
212 this.loginError["reason"] = this.ErrorReason;
213 this.loginError["message"] = this.ErrorMessage;
214 this.loginError["login"] = login;
215 this.xmlRpcResponse.Value = this.loginError;
216 return (this.xmlRpcResponse);
217 } // GenerateResponse
218
219 public XmlRpcResponse LoginFailedResponse()
220 {
221 return (this.GenerateFailureResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false"));
222 } // LoginFailedResponse
223
224 public XmlRpcResponse ConnectionFailedResponse()
225 {
226 return (this.LoginFailedResponse());
227 } // CreateErrorConnectingToGridResponse()
228
229 public XmlRpcResponse CreateAlreadyLoggedInResponse()
230 {
231 return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false"));
232 } // CreateAlreadyLoggedInResponse()
233
234 public XmlRpcResponse ToXmlRpcResponse()
235 {
236 try
237 {
238
239 Hashtable responseData = new Hashtable();
240
241 this.loginFlagsHash = new Hashtable();
242 this.loginFlagsHash["daylight_savings"] = this.DST;
243 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
244 this.loginFlagsHash["gendered"] = this.Gendered;
245 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
246 this.loginFlags.Add(this.loginFlagsHash);
247
248 responseData["first_name"] = this.Firstname;
249 responseData["last_name"] = this.Lastname;
250 responseData["agent_access"] = this.agentAccess;
251
252 this.globalTexturesHash = new Hashtable();
253 this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
254 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
255 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
256 this.globalTextures.Add(this.globalTexturesHash);
257 this.eventCategories.Add(this.eventCategoriesHash);
258
259 this.AddToUIConfig("allow_first_life", this.allowFirstLife);
260 this.uiConfig.Add(this.uiConfigHash);
261
262 responseData["sim_port"] = this.SimPort;
263 responseData["sim_ip"] = this.SimAddress;
264 responseData["agent_id"] = this.AgentID.ToStringHyphenated();
265 responseData["session_id"] = this.SessionID.ToStringHyphenated();
266 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
267 responseData["circuit_code"] = this.CircuitCode;
268 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
269 responseData["login-flags"] = this.loginFlags;
270 responseData["global-textures"] = this.globalTextures;
271 responseData["seed_capability"] = this.seedCapability;
272
273 responseData["event_categories"] = this.eventCategories;
274 responseData["event_notifications"] = new ArrayList(); // todo
275 responseData["classified_categories"] = this.classifiedCategories;
276 responseData["ui-config"] = this.uiConfig;
277
278 responseData["inventory-skeleton"] = this.agentInventory;
279 responseData["inventory-skel-lib"] = new ArrayList(); // todo
280 responseData["inventory-root"] = this.inventoryRoot;
281 responseData["gestures"] = new ArrayList(); // todo
282 responseData["inventory-lib-owner"] = new ArrayList(); // todo
283 responseData["initial-outfit"] = this.initialOutfit;
284 responseData["start_location"] = this.startLocation;
285 responseData["seed_capability"] = this.seedCapability;
286 responseData["home"] = this.home;
287 responseData["look_at"] = this.lookAt;
288 responseData["message"] = this.welcomeMessage;
289 responseData["region_x"] = (Int32)this.RegionX * 256;
290 responseData["region_y"] = (Int32)this.RegionY * 256;
291
292 //responseData["inventory-lib-root"] = new ArrayList(); // todo
293 //responseData["buddy-list"] = new ArrayList(); // todo
294
295 responseData["login"] = "true";
296 this.xmlRpcResponse.Value = responseData;
297
298 return (this.xmlRpcResponse);
299 }
300 catch (Exception e)
301 {
302 OpenSim.Framework.Console.MainLog.Instance.WriteLine(
303 OpenSim.Framework.Console.LogPriority.LOW,
304 "LoginResponse: Error creating XML-RPC Response: " + e.Message
305 );
306 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
307
308 }
309
310 } // ToXmlRpcResponse
311
312 public void SetEventCategories(string category, string value)
313 {
314 this.eventCategoriesHash[category] = value;
315 } // SetEventCategories
316
317 public void AddToUIConfig(string itemName, string item)
318 {
319 this.uiConfigHash[itemName] = item;
320 } // SetUIConfig
321
322 public void AddClassifiedCategory(Int32 ID, string categoryName)
323 {
324 this.classifiedCategoriesHash["category_name"] = categoryName;
325 this.classifiedCategoriesHash["category_id"] = ID;
326 this.classifiedCategories.Add(this.classifiedCategoriesHash);
327 // this.classifiedCategoriesHash.Clear();
328 } // SetClassifiedCategory
329
330 #region Properties
331 public string Login
332 {
333 get
334 {
335 return this.login;
336 }
337 set
338 {
339 this.login = value;
340 }
341 } // Login
342
343 public string DST
344 {
345 get
346 {
347 return this.dst;
348 }
349 set
350 {
351 this.dst = value;
352 }
353 } // DST
354
355 public string StipendSinceLogin
356 {
357 get
358 {
359 return this.stipendSinceLogin;
360 }
361 set
362 {
363 this.stipendSinceLogin = value;
364 }
365 } // StipendSinceLogin
366
367 public string Gendered
368 {
369 get
370 {
371 return this.gendered;
372 }
373 set
374 {
375 this.gendered = value;
376 }
377 } // Gendered
378
379 public string EverLoggedIn
380 {
381 get
382 {
383 return this.everLoggedIn;
384 }
385 set
386 {
387 this.everLoggedIn = value;
388 }
389 } // EverLoggedIn
390
391 public string SimPort
392 {
393 get
394 {
395 return this.simPort;
396 }
397 set
398 {
399 this.simPort = value;
400 }
401 } // SimPort
402
403 public string SimAddress
404 {
405 get
406 {
407 return this.simAddress;
408 }
409 set
410 {
411 this.simAddress = value;
412 }
413 } // SimAddress
414
415 public LLUUID AgentID
416 {
417 get
418 {
419 return this.agentID;
420 }
421 set
422 {
423 this.agentID = value;
424 }
425 } // AgentID
426
427 public LLUUID SessionID
428 {
429 get
430 {
431 return this.sessionID;
432 }
433 set
434 {
435 this.sessionID = value;
436 }
437 } // SessionID
438
439 public LLUUID SecureSessionID
440 {
441 get
442 {
443 return this.secureSessionID;
444 }
445 set
446 {
447 this.secureSessionID = value;
448 }
449 } // SecureSessionID
450
451 public LLUUID BaseFolderID
452 {
453 get
454 {
455 return this.baseFolderID;
456 }
457 set
458 {
459 this.baseFolderID = value;
460 }
461 } // BaseFolderID
462
463 public LLUUID InventoryFolderID
464 {
465 get
466 {
467 return this.inventoryFolderID;
468 }
469 set
470 {
471 this.inventoryFolderID = value;
472 }
473 } // InventoryFolderID
474
475 public Int32 CircuitCode
476 {
477 get
478 {
479 return this.circuitCode;
480 }
481 set
482 {
483 this.circuitCode = value;
484 }
485 } // CircuitCode
486
487 public uint RegionX
488 {
489 get
490 {
491 return this.regionX;
492 }
493 set
494 {
495 this.regionX = value;
496 }
497 } // RegionX
498
499 public uint RegionY
500 {
501 get
502 {
503 return this.regionY;
504 }
505 set
506 {
507 this.regionY = value;
508 }
509 } // RegionY
510
511 public string SunTexture
512 {
513 get
514 {
515 return this.sunTexture;
516 }
517 set
518 {
519 this.sunTexture = value;
520 }
521 } // SunTexture
522
523 public string CloudTexture
524 {
525 get
526 {
527 return this.cloudTexture;
528 }
529 set
530 {
531 this.cloudTexture = value;
532 }
533 } // CloudTexture
534
535 public string MoonTexture
536 {
537 get
538 {
539 return this.moonTexture;
540 }
541 set
542 {
543 this.moonTexture = value;
544 }
545 } // MoonTexture
546
547 public string Firstname
548 {
549 get
550 {
551 return this.firstname;
552 }
553 set
554 {
555 this.firstname = value;
556 }
557 } // Firstname
558
559 public string Lastname
560 {
561 get
562 {
563 return this.lastname;
564 }
565 set
566 {
567 this.lastname = value;
568 }
569 } // Lastname
570
571 public string AgentAccess
572 {
573 get
574 {
575 return this.agentAccess;
576 }
577 set
578 {
579 this.agentAccess = value;
580 }
581 }
582
583 public string StartLocation
584 {
585 get
586 {
587 return this.startLocation;
588 }
589 set
590 {
591 this.startLocation = value;
592 }
593 } // StartLocation
594
595 public string LookAt
596 {
597 get
598 {
599 return this.lookAt;
600 }
601 set
602 {
603 this.lookAt = value;
604 }
605 }
606
607 public string SeedCapability
608 {
609 get
610 {
611 return this.seedCapability;
612 }
613 set
614 {
615 this.seedCapability = value;
616 }
617 } // SeedCapability
618
619 public string ErrorReason
620 {
621 get
622 {
623 return this.errorReason;
624 }
625 set
626 {
627 this.errorReason = value;
628 }
629 } // ErrorReason
630
631 public string ErrorMessage
632 {
633 get
634 {
635 return this.errorMessage;
636 }
637 set
638 {
639 this.errorMessage = value;
640 }
641 } // ErrorMessage
642
643 #endregion
644
645
646 public class UserInfo
647 {
648 public string firstname;
649 public string lastname;
650 public ulong homeregionhandle;
651 public LLVector3 homepos;
652 public LLVector3 homelookat;
653 }
654 }
655} \ No newline at end of file
diff --git a/Common/OpenSim.Servers/LoginServer.cs b/Common/OpenSim.Servers/LoginServer.cs
deleted file mode 100644
index e5373dd..0000000
--- a/Common/OpenSim.Servers/LoginServer.cs
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using Nwc.XmlRpc;
29using System;
30using System.IO;
31using System.Net;
32using System.Net.Sockets;
33using System.Text;
34using System.Text.RegularExpressions;
35using System.Threading;
36using System.Collections;
37using System.Security.Cryptography;
38using System.Xml;
39using libsecondlife;
40using OpenSim;
41using OpenSim.Framework.Interfaces;
42using OpenSim.Framework.Grid;
43using OpenSim.Framework.Inventory;
44using OpenSim.Framework.User;
45using OpenSim.Framework.Utilities;
46using OpenSim.Framework.Types;
47
48namespace OpenSim.UserServer
49{
50 public delegate bool AddNewSessionHandler(ulong regionHandle, Login loginData);
51 /// <summary>
52 /// When running in local (default) mode , handles client logins.
53 /// </summary>
54 public class LoginServer : LoginService, IUserServer
55 {
56 //private IGridServer m_gridServer;
57 public IPAddress clientAddress = IPAddress.Loopback;
58 public IPAddress remoteAddress = IPAddress.Any;
59 private int NumClients;
60 private bool userAccounts = false;
61 private string _mpasswd;
62 private bool _needPasswd = false;
63 private LocalUserProfileManager userManager;
64 private int m_simPort;
65 private string m_simAddr;
66 private uint regionX;
67 private uint regionY;
68 private AddNewSessionHandler AddSession;
69
70 public LocalUserProfileManager LocalUserManager
71 {
72 get
73 {
74 return userManager;
75 }
76 }
77
78 public LoginServer( string simAddr, int simPort, uint regX, uint regY, bool useAccounts)
79 {
80 m_simPort = simPort;
81 m_simAddr = simAddr;
82 regionX = regX;
83 regionY = regY;
84 this.userAccounts = useAccounts;
85 }
86
87 public void SetSessionHandler(AddNewSessionHandler sessionHandler)
88 {
89 this.AddSession = sessionHandler;
90 this.userManager.SetSessionHandler(sessionHandler);
91 }
92
93 public void Startup()
94 {
95 this._needPasswd = false;
96
97 this._mpasswd = EncodePassword("testpass");
98
99 userManager = new LocalUserProfileManager( m_simPort, m_simAddr, regionX, regionY);
100 //userManager.InitUserProfiles();
101 userManager.SetKeys("", "", "", "Welcome to OpenSim");
102 }
103
104 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
105 {
106 Console.WriteLine("login attempt");
107 Hashtable requestData = (Hashtable)request.Params[0];
108 string first;
109 string last;
110 string passwd;
111
112 LoginResponse loginResponse = new LoginResponse();
113 loginResponse.RegionX = regionX;
114 loginResponse.RegionY = regionY;
115
116 //get login name
117 if (requestData.Contains("first"))
118 {
119 first = (string)requestData["first"];
120 }
121 else
122 {
123 first = "test";
124 }
125
126 if (requestData.Contains("last"))
127 {
128 last = (string)requestData["last"];
129 }
130 else
131 {
132 last = "User" + NumClients.ToString();
133 }
134
135 if (requestData.Contains("passwd"))
136 {
137 passwd = (string)requestData["passwd"];
138 }
139 else
140 {
141 passwd = "notfound";
142 }
143
144 if (!Authenticate(first, last, passwd))
145 {
146 return loginResponse.LoginFailedResponse();
147 }
148
149 NumClients++;
150
151 loginResponse.SimPort = m_simPort.ToString();
152 loginResponse.SimAddress = m_simAddr.ToString();
153
154 loginResponse.CircuitCode = (Int32)(Util.RandomClass.Next());
155 XmlRpcResponse response = loginResponse.ToXmlRpcResponse();
156 Hashtable responseData = (Hashtable)response.Value;
157
158
159 CustomiseLoginResponse(responseData, first, last);
160
161 Login _login = new Login();
162 //copy data to login object
163 _login.First = first;
164 _login.Last = last;
165 _login.Agent = loginResponse.AgentID;
166 _login.Session = loginResponse.SessionID;
167 _login.SecureSession = loginResponse.SecureSessionID;
168 _login.CircuitCode = (uint) loginResponse.CircuitCode;
169 _login.BaseFolder = loginResponse.BaseFolderID;
170 _login.InventoryFolder = loginResponse.InventoryFolderID;
171
172 ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256));
173 AddSession(reghand,_login);
174
175 return response;
176 }
177
178 protected virtual void CustomiseLoginResponse(Hashtable responseData, string first, string last)
179 {
180 }
181
182 protected virtual LLUUID GetAgentId(string firstName, string lastName)
183 {
184 LLUUID Agent;
185 int AgentRand = Util.RandomClass.Next(1, 9999);
186 Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
187 return Agent;
188 }
189
190 protected virtual bool Authenticate(string first, string last, string passwd)
191 {
192 if (this._needPasswd)
193 {
194 //every user needs the password to login
195 string encodedPass = passwd.Remove(0, 3); //remove $1$
196 if (encodedPass == this._mpasswd)
197 {
198 return true;
199 }
200 else
201 {
202 return false;
203 }
204 }
205 else
206 {
207 //do not need password to login
208 return true;
209 }
210 }
211
212 private static string EncodePassword(string passwd)
213 {
214 Byte[] originalBytes;
215 Byte[] encodedBytes;
216 MD5 md5;
217
218 md5 = new MD5CryptoServiceProvider();
219 originalBytes = ASCIIEncoding.Default.GetBytes(passwd);
220 encodedBytes = md5.ComputeHash(originalBytes);
221
222 return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
223 }
224
225 public bool CreateUserAccount(string firstName, string lastName, string password)
226 {
227 Console.WriteLine("creating new user account");
228 string mdPassword = EncodePassword(password);
229 Console.WriteLine("with password: " + mdPassword);
230 this.userManager.CreateNewProfile(firstName, lastName, mdPassword);
231 return true;
232 }
233
234 //IUserServer implementation
235 public AgentInventory RequestAgentsInventory(LLUUID agentID)
236 {
237 AgentInventory aInventory = null;
238 if (this.userAccounts)
239 {
240 aInventory = this.userManager.GetUsersInventory(agentID);
241 }
242
243 return aInventory;
244 }
245
246 public bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory)
247 {
248 return true;
249 }
250
251 public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
252 {
253
254 }
255 }
256
257
258}
diff --git a/Common/OpenSim.Servers/OpenSim.Servers.csproj b/Common/OpenSim.Servers/OpenSim.Servers.csproj
index e9be796..6e8eba7 100644
--- a/Common/OpenSim.Servers/OpenSim.Servers.csproj
+++ b/Common/OpenSim.Servers/OpenSim.Servers.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Servers</AssemblyName> 13 <AssemblyName>OpenSim.Servers</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.Servers</RootNamespace> 21 <RootNamespace>OpenSim.Servers</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,18 +61,19 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="libsecondlife.dll" > 68 <Reference Include="libsecondlife.dll">
62 <HintPath>..\..\bin\libsecondlife.dll</HintPath> 69 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System" > 72 <Reference Include="System">
66 <HintPath>System.dll</HintPath> 73 <HintPath>System.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="System.Xml" > 76 <Reference Include="System.Xml">
70 <HintPath>System.Xml.dll</HintPath> 77 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
@@ -76,19 +83,19 @@
76 <Name>OpenSim.Framework</Name> 83 <Name>OpenSim.Framework</Name>
77 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 84 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 85 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 <Private>False</Private> 86 <Private>False</Private>
80 </ProjectReference> 87 </ProjectReference>
81 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 88 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
82 <Name>OpenSim.Framework.Console</Name> 89 <Name>OpenSim.Framework.Console</Name>
83 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 90 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
84 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 91 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
85 <Private>False</Private> 92 <Private>False</Private>
86 </ProjectReference> 93 </ProjectReference>
87 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> 94 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
88 <Name>XMLRPC</Name> 95 <Name>XMLRPC</Name>
89 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> 96 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
90 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 97 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
91 <Private>False</Private> 98 <Private>False</Private>
92 </ProjectReference> 99 </ProjectReference>
93 </ItemGroup> 100 </ItemGroup>
94 <ItemGroup> 101 <ItemGroup>
@@ -101,15 +108,6 @@
101 <Compile Include="IRestHandler.cs"> 108 <Compile Include="IRestHandler.cs">
102 <SubType>Code</SubType> 109 <SubType>Code</SubType>
103 </Compile> 110 </Compile>
104 <Compile Include="LocalUserProfileManager.cs">
105 <SubType>Code</SubType>
106 </Compile>
107 <Compile Include="LoginResponse.cs">
108 <SubType>Code</SubType>
109 </Compile>
110 <Compile Include="LoginServer.cs">
111 <SubType>Code</SubType>
112 </Compile>
113 <Compile Include="UDPServerBase.cs"> 111 <Compile Include="UDPServerBase.cs">
114 <SubType>Code</SubType> 112 <SubType>Code</SubType>
115 </Compile> 113 </Compile>
@@ -124,4 +122,4 @@
124 <PostBuildEvent> 122 <PostBuildEvent>
125 </PostBuildEvent> 123 </PostBuildEvent>
126 </PropertyGroup> 124 </PropertyGroup>
127</Project> 125</Project> \ No newline at end of file