aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Client/Linden/LLStandaloneLoginService.cs1
-rw-r--r--OpenSim/Framework/Communications/Clients/RegionClient.cs2
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserLoginService.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs12
-rw-r--r--OpenSim/Services/Interfaces/ILoginService.cs49
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs740
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs74
-rw-r--r--bin/config-include/StandaloneHypergrid.ini8
-rw-r--r--prebuild.xml31
9 files changed, 911 insertions, 7 deletions
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
index 122110d..a975fa2 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
@@ -37,6 +37,7 @@ using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Services; 39using OpenSim.Framework.Communications.Services;
40using LoginResponse = OpenSim.Framework.Communications.Services.LoginResponse;
40using OpenSim.Framework.Communications.Cache; 41using OpenSim.Framework.Communications.Cache;
41using OpenSim.Framework.Capabilities; 42using OpenSim.Framework.Capabilities;
42using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs
index 5ceaf39..ee7dec8 100644
--- a/OpenSim/Framework/Communications/Clients/RegionClient.cs
+++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Communications.Clients
83 } 83 }
84 // Add the regionhandle of the destination region 84 // Add the regionhandle of the destination region
85 ulong regionHandle = GetRegionHandle(region.RegionHandle); 85 ulong regionHandle = GetRegionHandle(region.RegionHandle);
86 args["destination_handle"] = OSD.FromString(regionHandle.ToString()); 86 args["destination_handle"] = OSD.FromString(regionHandle.ToString());
87 args["teleport_flags"] = OSD.FromString(teleportFlags.ToString()); 87 args["teleport_flags"] = OSD.FromString(teleportFlags.ToString());
88 88
89 string strBuffer = ""; 89 string strBuffer = "";
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
index d46ff9b..fb808ca 100644
--- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
@@ -39,6 +39,7 @@ using OpenSim.Data;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications; 40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Services; 41using OpenSim.Framework.Communications.Services;
42using LoginResponse = OpenSim.Framework.Communications.Services.LoginResponse;
42using OpenSim.Framework.Communications.Cache; 43using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Capabilities; 44using OpenSim.Framework.Capabilities;
44using OpenSim.Framework.Servers; 45using OpenSim.Framework.Servers;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 44458d1..fa3681a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -436,12 +436,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
436 } 436 }
437 437
438 OSDMap resp = new OSDMap(2); 438 OSDMap resp = new OSDMap(2);
439 string reason = String.Empty; 439 string reason = String.Empty;
440 uint teleportFlags = 0; 440 uint teleportFlags = 0;
441 if (args.ContainsKey("teleport_flags")) 441 if (args.ContainsKey("teleport_flags"))
442 { 442 {
443 teleportFlags = args["teleport_flags"].AsUInteger(); 443 teleportFlags = args["teleport_flags"].AsUInteger();
444 } 444 }
445 445
446 // This is the meaning of POST agent 446 // This is the meaning of POST agent
447 m_regionClient.AdjustUserInformation(aCircuit); 447 m_regionClient.AdjustUserInformation(aCircuit);
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs
new file mode 100644
index 0000000..5397b10
--- /dev/null
+++ b/OpenSim/Services/Interfaces/ILoginService.cs
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 System;
29using System.Collections;
30using System.Collections.Generic;
31
32namespace OpenSim.Services.Interfaces
33{
34 public abstract class LoginResponse
35 {
36 public abstract Hashtable ToHashtable();
37 }
38
39 public abstract class FailedLoginResponse : LoginResponse
40 {
41 }
42
43 public interface ILoginService
44 {
45 LoginResponse Login(string firstName, string lastName, string passwd, string startLocation);
46 }
47
48
49}
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
new file mode 100644
index 0000000..e3935a8
--- /dev/null
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -0,0 +1,740 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using OpenSim.Framework;
33using log4net;
34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
36
37namespace OpenSim.Services.LLLoginService
38{
39 public class LLFailedLoginResponse : OpenSim.Services.Interfaces.FailedLoginResponse
40 {
41 string m_key;
42 string m_value;
43 string m_login;
44
45 public static LLFailedLoginResponse UserProblem;
46 public static LLFailedLoginResponse GridProblem;
47 public static LLFailedLoginResponse InventoryProblem;
48 public static LLFailedLoginResponse DeadRegionProblem;
49 public static LLFailedLoginResponse LoginBlockedProblem;
50 public static LLFailedLoginResponse AlreadyLoggedInProblem;
51 public static LLFailedLoginResponse InternalError;
52
53 static LLFailedLoginResponse()
54 {
55 UserProblem = new LLFailedLoginResponse("key",
56 "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
57 "false");
58 GridProblem = new LLFailedLoginResponse("key",
59 "Error connecting to grid. Could not percieve credentials from login XML.",
60 "false");
61 InventoryProblem = new LLFailedLoginResponse("key",
62 "The inventory service is not responding. Please notify your login region operator.",
63 "false");
64 DeadRegionProblem = new LLFailedLoginResponse("key",
65 "The region you are attempting to log into is not responding. Please select another region and try again.",
66 "false");
67 LoginBlockedProblem = new LLFailedLoginResponse("presence",
68 "Logins are currently restricted. Please try again later.",
69 "false");
70 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence",
71 "You appear to be already logged in. " +
72 "If this is not the case please wait for your session to timeout. " +
73 "If this takes longer than a few minutes please contact the grid owner. " +
74 "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.",
75 "false");
76 InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false");
77 }
78
79 public LLFailedLoginResponse(string key, string value, string login)
80 {
81 m_key = key;
82 m_value = value;
83 m_login = login;
84 }
85
86 public override Hashtable ToHashtable()
87 {
88 Hashtable loginError = new Hashtable();
89 loginError["reason"] = m_key;
90 loginError["message"] = m_value;
91 loginError["login"] = m_login;
92 return loginError;
93 }
94
95 public OSD ToOSDMap()
96 {
97 OSDMap map = new OSDMap();
98
99 map["reason"] = OSD.FromString(m_key);
100 map["message"] = OSD.FromString(m_value);
101 map["login"] = OSD.FromString(m_login);
102
103 return map;
104 }
105 }
106
107 /// <summary>
108 /// A class to handle LL login response.
109 /// </summary>
110 public class LLLoginResponse : OpenSim.Services.Interfaces.LoginResponse
111 {
112 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
113 private static Hashtable globalTexturesHash;
114 // Global Textures
115 private static string sunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
116 private static string cloudTexture = "dc4b9f0b-d008-45c6-96a4-01dd947ac621";
117 private static string moonTexture = "ec4b9f0b-d008-45c6-96a4-01dd947ac621";
118
119 private Hashtable loginFlagsHash;
120 private Hashtable uiConfigHash;
121
122 private ArrayList loginFlags;
123 private ArrayList globalTextures;
124 private ArrayList eventCategories;
125 private ArrayList uiConfig;
126 private ArrayList classifiedCategories;
127 private ArrayList inventoryRoot;
128 private ArrayList initialOutfit;
129 private ArrayList agentInventory;
130 private ArrayList inventoryLibraryOwner;
131 private ArrayList inventoryLibRoot;
132 private ArrayList inventoryLibrary;
133 private ArrayList activeGestures;
134
135 private UserInfo userProfile;
136
137 private UUID agentID;
138 private UUID sessionID;
139 private UUID secureSessionID;
140
141 // Login Flags
142 private string dst;
143 private string stipendSinceLogin;
144 private string gendered;
145 private string everLoggedIn;
146 private string login;
147 private uint simPort;
148 private uint simHttpPort;
149 private string simAddress;
150 private string agentAccess;
151 private string agentAccessMax;
152 private Int32 circuitCode;
153 private uint regionX;
154 private uint regionY;
155
156 // Login
157 private string firstname;
158 private string lastname;
159
160 // Error Flags
161 private string errorReason;
162 private string errorMessage;
163
164 private string welcomeMessage;
165 private string startLocation;
166 private string allowFirstLife;
167 private string home;
168 private string seedCapability;
169 private string lookAt;
170
171 private BuddyList m_buddyList = null;
172
173 static LLLoginResponse()
174 {
175 // This is being set, but it's not used
176 // not sure why.
177 globalTexturesHash = new Hashtable();
178 globalTexturesHash["sun_texture_id"] = sunTexture;
179 globalTexturesHash["cloud_texture_id"] = cloudTexture;
180 globalTexturesHash["moon_texture_id"] = moonTexture;
181 }
182
183 public LLLoginResponse()
184 {
185 loginFlags = new ArrayList();
186 globalTextures = new ArrayList();
187 eventCategories = new ArrayList();
188 uiConfig = new ArrayList();
189 classifiedCategories = new ArrayList();
190
191 uiConfigHash = new Hashtable();
192
193 // defaultXmlRpcResponse = new XmlRpcResponse();
194 userProfile = new UserInfo();
195 inventoryRoot = new ArrayList();
196 initialOutfit = new ArrayList();
197 agentInventory = new ArrayList();
198 inventoryLibrary = new ArrayList();
199 inventoryLibraryOwner = new ArrayList();
200 activeGestures = new ArrayList();
201
202 SetDefaultValues();
203 }
204
205 private void SetDefaultValues()
206 {
207 DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
208 StipendSinceLogin = "N";
209 Gendered = "Y";
210 EverLoggedIn = "Y";
211 login = "false";
212 firstname = "Test";
213 lastname = "User";
214 agentAccess = "M";
215 agentAccessMax = "A";
216 startLocation = "last";
217 allowFirstLife = "Y";
218
219 ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
220 ErrorReason = "key";
221 welcomeMessage = "Welcome to OpenSim!";
222 seedCapability = String.Empty;
223 home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" +
224 userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
225 userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
226 userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
227 lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
228 RegionX = (uint) 255232;
229 RegionY = (uint) 254976;
230
231 // Classifieds;
232 AddClassifiedCategory((Int32) 1, "Shopping");
233 AddClassifiedCategory((Int32) 2, "Land Rental");
234 AddClassifiedCategory((Int32) 3, "Property Rental");
235 AddClassifiedCategory((Int32) 4, "Special Attraction");
236 AddClassifiedCategory((Int32) 5, "New Products");
237 AddClassifiedCategory((Int32) 6, "Employment");
238 AddClassifiedCategory((Int32) 7, "Wanted");
239 AddClassifiedCategory((Int32) 8, "Service");
240 AddClassifiedCategory((Int32) 9, "Personal");
241
242 SessionID = UUID.Random();
243 SecureSessionID = UUID.Random();
244 AgentID = UUID.Random();
245
246 Hashtable InitialOutfitHash = new Hashtable();
247 InitialOutfitHash["folder_name"] = "Nightclub Female";
248 InitialOutfitHash["gender"] = "female";
249 initialOutfit.Add(InitialOutfitHash);
250 }
251
252
253 public override Hashtable ToHashtable()
254 {
255 try
256 {
257 Hashtable responseData = new Hashtable();
258
259 loginFlagsHash = new Hashtable();
260 loginFlagsHash["daylight_savings"] = DST;
261 loginFlagsHash["stipend_since_login"] = StipendSinceLogin;
262 loginFlagsHash["gendered"] = Gendered;
263 loginFlagsHash["ever_logged_in"] = EverLoggedIn;
264 loginFlags.Add(loginFlagsHash);
265
266 responseData["first_name"] = Firstname;
267 responseData["last_name"] = Lastname;
268 responseData["agent_access"] = agentAccess;
269 responseData["agent_access_max"] = agentAccessMax;
270
271 globalTextures.Add(globalTexturesHash);
272 // this.eventCategories.Add(this.eventCategoriesHash);
273
274 AddToUIConfig("allow_first_life", allowFirstLife);
275 uiConfig.Add(uiConfigHash);
276
277 responseData["sim_port"] = (Int32) SimPort;
278 responseData["sim_ip"] = SimAddress;
279 responseData["http_port"] = (Int32)SimHttpPort;
280
281 responseData["agent_id"] = AgentID.ToString();
282 responseData["session_id"] = SessionID.ToString();
283 responseData["secure_session_id"] = SecureSessionID.ToString();
284 responseData["circuit_code"] = CircuitCode;
285 responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
286 responseData["login-flags"] = loginFlags;
287 responseData["global-textures"] = globalTextures;
288 responseData["seed_capability"] = seedCapability;
289
290 responseData["event_categories"] = eventCategories;
291 responseData["event_notifications"] = new ArrayList(); // todo
292 responseData["classified_categories"] = classifiedCategories;
293 responseData["ui-config"] = uiConfig;
294
295 if (agentInventory != null)
296 {
297 responseData["inventory-skeleton"] = agentInventory;
298 responseData["inventory-root"] = inventoryRoot;
299 }
300 responseData["inventory-skel-lib"] = inventoryLibrary;
301 responseData["inventory-lib-root"] = inventoryLibRoot;
302 responseData["gestures"] = activeGestures;
303 responseData["inventory-lib-owner"] = inventoryLibraryOwner;
304 responseData["initial-outfit"] = initialOutfit;
305 responseData["start_location"] = startLocation;
306 responseData["seed_capability"] = seedCapability;
307 responseData["home"] = home;
308 responseData["look_at"] = lookAt;
309 responseData["message"] = welcomeMessage;
310 responseData["region_x"] = (Int32)(RegionX * Constants.RegionSize);
311 responseData["region_y"] = (Int32)(RegionY * Constants.RegionSize);
312
313 if (m_buddyList != null)
314 {
315 responseData["buddy-list"] = m_buddyList.ToArray();
316 }
317
318 responseData["login"] = "true";
319
320 return responseData;
321 }
322 catch (Exception e)
323 {
324 m_log.Warn("[CLIENT]: LoginResponse: Error creating Hashtable Response: " + e.Message);
325
326 return LLFailedLoginResponse.InternalError.ToHashtable();
327 }
328 }
329
330 public OSD ToLLSDResponse()
331 {
332 try
333 {
334 OSDMap map = new OSDMap();
335
336 map["first_name"] = OSD.FromString(Firstname);
337 map["last_name"] = OSD.FromString(Lastname);
338 map["agent_access"] = OSD.FromString(agentAccess);
339 map["agent_access_max"] = OSD.FromString(agentAccessMax);
340
341 map["sim_port"] = OSD.FromInteger(SimPort);
342 map["sim_ip"] = OSD.FromString(SimAddress);
343
344 map["agent_id"] = OSD.FromUUID(AgentID);
345 map["session_id"] = OSD.FromUUID(SessionID);
346 map["secure_session_id"] = OSD.FromUUID(SecureSessionID);
347 map["circuit_code"] = OSD.FromInteger(CircuitCode);
348 map["seconds_since_epoch"] = OSD.FromInteger((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);
349
350 #region Login Flags
351
352 OSDMap loginFlagsLLSD = new OSDMap();
353 loginFlagsLLSD["daylight_savings"] = OSD.FromString(DST);
354 loginFlagsLLSD["stipend_since_login"] = OSD.FromString(StipendSinceLogin);
355 loginFlagsLLSD["gendered"] = OSD.FromString(Gendered);
356 loginFlagsLLSD["ever_logged_in"] = OSD.FromString(EverLoggedIn);
357 map["login-flags"] = WrapOSDMap(loginFlagsLLSD);
358
359 #endregion Login Flags
360
361 #region Global Textures
362
363 OSDMap globalTexturesLLSD = new OSDMap();
364 globalTexturesLLSD["sun_texture_id"] = OSD.FromString(SunTexture);
365 globalTexturesLLSD["cloud_texture_id"] = OSD.FromString(CloudTexture);
366 globalTexturesLLSD["moon_texture_id"] = OSD.FromString(MoonTexture);
367
368 map["global-textures"] = WrapOSDMap(globalTexturesLLSD);
369
370 #endregion Global Textures
371
372 map["seed_capability"] = OSD.FromString(seedCapability);
373
374 map["event_categories"] = ArrayListToOSDArray(eventCategories);
375 //map["event_notifications"] = new OSDArray(); // todo
376 map["classified_categories"] = ArrayListToOSDArray(classifiedCategories);
377
378 #region UI Config
379
380 OSDMap uiConfigLLSD = new OSDMap();
381 uiConfigLLSD["allow_first_life"] = OSD.FromString(allowFirstLife);
382 map["ui-config"] = WrapOSDMap(uiConfigLLSD);
383
384 #endregion UI Config
385
386 #region Inventory
387
388 map["inventory-skeleton"] = ArrayListToOSDArray(agentInventory);
389
390 map["inventory-skel-lib"] = ArrayListToOSDArray(inventoryLibrary);
391 map["inventory-root"] = ArrayListToOSDArray(inventoryRoot); ;
392 map["inventory-lib-root"] = ArrayListToOSDArray(inventoryLibRoot);
393 map["inventory-lib-owner"] = ArrayListToOSDArray(inventoryLibraryOwner);
394
395 #endregion Inventory
396
397 map["gestures"] = ArrayListToOSDArray(activeGestures);
398
399 map["initial-outfit"] = ArrayListToOSDArray(initialOutfit);
400 map["start_location"] = OSD.FromString(startLocation);
401
402 map["seed_capability"] = OSD.FromString(seedCapability);
403 map["home"] = OSD.FromString(home);
404 map["look_at"] = OSD.FromString(lookAt);
405 map["message"] = OSD.FromString(welcomeMessage);
406 map["region_x"] = OSD.FromInteger(RegionX * Constants.RegionSize);
407 map["region_y"] = OSD.FromInteger(RegionY * Constants.RegionSize);
408
409 if (m_buddyList != null)
410 {
411 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray());
412 }
413
414 map["login"] = OSD.FromString("true");
415
416 return map;
417 }
418 catch (Exception e)
419 {
420 m_log.Warn("[CLIENT]: LoginResponse: Error creating LLSD Response: " + e.Message);
421
422 return LLFailedLoginResponse.InternalError.ToOSDMap();
423 }
424 }
425
426 public OSDArray ArrayListToOSDArray(ArrayList arrlst)
427 {
428 OSDArray llsdBack = new OSDArray();
429 foreach (Hashtable ht in arrlst)
430 {
431 OSDMap mp = new OSDMap();
432 foreach (DictionaryEntry deHt in ht)
433 {
434 mp.Add((string)deHt.Key, OSDString.FromObject(deHt.Value));
435 }
436 llsdBack.Add(mp);
437 }
438 return llsdBack;
439 }
440
441 private static OSDArray WrapOSDMap(OSDMap wrapMe)
442 {
443 OSDArray array = new OSDArray();
444 array.Add(wrapMe);
445 return array;
446 }
447
448 public void SetEventCategories(string category, string value)
449 {
450 // this.eventCategoriesHash[category] = value;
451 //TODO
452 }
453
454 public void AddToUIConfig(string itemName, string item)
455 {
456 uiConfigHash[itemName] = item;
457 }
458
459 public void AddClassifiedCategory(Int32 ID, string categoryName)
460 {
461 Hashtable hash = new Hashtable();
462 hash["category_name"] = categoryName;
463 hash["category_id"] = ID;
464 classifiedCategories.Add(hash);
465 // this.classifiedCategoriesHash.Clear();
466 }
467
468 #region Properties
469
470 public string Login
471 {
472 get { return login; }
473 set { login = value; }
474 }
475
476 public string DST
477 {
478 get { return dst; }
479 set { dst = value; }
480 }
481
482 public string StipendSinceLogin
483 {
484 get { return stipendSinceLogin; }
485 set { stipendSinceLogin = value; }
486 }
487
488 public string Gendered
489 {
490 get { return gendered; }
491 set { gendered = value; }
492 }
493
494 public string EverLoggedIn
495 {
496 get { return everLoggedIn; }
497 set { everLoggedIn = value; }
498 }
499
500 public uint SimPort
501 {
502 get { return simPort; }
503 set { simPort = value; }
504 }
505
506 public uint SimHttpPort
507 {
508 get { return simHttpPort; }
509 set { simHttpPort = value; }
510 }
511
512 public string SimAddress
513 {
514 get { return simAddress; }
515 set { simAddress = value; }
516 }
517
518 public UUID AgentID
519 {
520 get { return agentID; }
521 set { agentID = value; }
522 }
523
524 public UUID SessionID
525 {
526 get { return sessionID; }
527 set { sessionID = value; }
528 }
529
530 public UUID SecureSessionID
531 {
532 get { return secureSessionID; }
533 set { secureSessionID = value; }
534 }
535
536 public Int32 CircuitCode
537 {
538 get { return circuitCode; }
539 set { circuitCode = value; }
540 }
541
542 public uint RegionX
543 {
544 get { return regionX; }
545 set { regionX = value; }
546 }
547
548 public uint RegionY
549 {
550 get { return regionY; }
551 set { regionY = value; }
552 }
553
554 public string SunTexture
555 {
556 get { return sunTexture; }
557 set { sunTexture = value; }
558 }
559
560 public string CloudTexture
561 {
562 get { return cloudTexture; }
563 set { cloudTexture = value; }
564 }
565
566 public string MoonTexture
567 {
568 get { return moonTexture; }
569 set { moonTexture = value; }
570 }
571
572 public string Firstname
573 {
574 get { return firstname; }
575 set { firstname = value; }
576 }
577
578 public string Lastname
579 {
580 get { return lastname; }
581 set { lastname = value; }
582 }
583
584 public string AgentAccess
585 {
586 get { return agentAccess; }
587 set { agentAccess = value; }
588 }
589
590 public string AgentAccessMax
591 {
592 get { return agentAccessMax; }
593 set { agentAccessMax = value; }
594 }
595
596 public string StartLocation
597 {
598 get { return startLocation; }
599 set { startLocation = value; }
600 }
601
602 public string LookAt
603 {
604 get { return lookAt; }
605 set { lookAt = value; }
606 }
607
608 public string SeedCapability
609 {
610 get { return seedCapability; }
611 set { seedCapability = value; }
612 }
613
614 public string ErrorReason
615 {
616 get { return errorReason; }
617 set { errorReason = value; }
618 }
619
620 public string ErrorMessage
621 {
622 get { return errorMessage; }
623 set { errorMessage = value; }
624 }
625
626 public ArrayList InventoryRoot
627 {
628 get { return inventoryRoot; }
629 set { inventoryRoot = value; }
630 }
631
632 public ArrayList InventorySkeleton
633 {
634 get { return agentInventory; }
635 set { agentInventory = value; }
636 }
637
638 public ArrayList InventoryLibrary
639 {
640 get { return inventoryLibrary; }
641 set { inventoryLibrary = value; }
642 }
643
644 public ArrayList InventoryLibraryOwner
645 {
646 get { return inventoryLibraryOwner; }
647 set { inventoryLibraryOwner = value; }
648 }
649
650 public ArrayList InventoryLibRoot
651 {
652 get { return inventoryLibRoot; }
653 set { inventoryLibRoot = value; }
654 }
655
656 public ArrayList ActiveGestures
657 {
658 get { return activeGestures; }
659 set { activeGestures = value; }
660 }
661
662 public string Home
663 {
664 get { return home; }
665 set { home = value; }
666 }
667
668 public string Message
669 {
670 get { return welcomeMessage; }
671 set { welcomeMessage = value; }
672 }
673
674 public BuddyList BuddList
675 {
676 get { return m_buddyList; }
677 set { m_buddyList = value; }
678 }
679
680 #endregion
681
682 public class UserInfo
683 {
684 public string firstname;
685 public string lastname;
686 public ulong homeregionhandle;
687 public Vector3 homepos;
688 public Vector3 homelookat;
689 }
690
691 public class BuddyList
692 {
693 public List<BuddyInfo> Buddies = new List<BuddyInfo>();
694
695 public void AddNewBuddy(BuddyInfo buddy)
696 {
697 if (!Buddies.Contains(buddy))
698 {
699 Buddies.Add(buddy);
700 }
701 }
702
703 public ArrayList ToArray()
704 {
705 ArrayList buddyArray = new ArrayList();
706 foreach (BuddyInfo buddy in Buddies)
707 {
708 buddyArray.Add(buddy.ToHashTable());
709 }
710 return buddyArray;
711 }
712
713 public class BuddyInfo
714 {
715 public int BuddyRightsHave = 1;
716 public int BuddyRightsGiven = 1;
717 public UUID BuddyID;
718
719 public BuddyInfo(string buddyID)
720 {
721 BuddyID = new UUID(buddyID);
722 }
723
724 public BuddyInfo(UUID buddyID)
725 {
726 BuddyID = buddyID;
727 }
728
729 public Hashtable ToHashTable()
730 {
731 Hashtable hTable = new Hashtable();
732 hTable["buddy_rights_has"] = BuddyRightsHave;
733 hTable["buddy_rights_given"] = BuddyRightsGiven;
734 hTable["buddy_id"] = BuddyID.ToString();
735 return hTable;
736 }
737 }
738 }
739 }
740}
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
new file mode 100644
index 0000000..2c31ed5
--- /dev/null
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -0,0 +1,74 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4
5using log4net;
6using Nini.Config;
7using OpenMetaverse;
8
9using OpenSim.Framework;
10using OpenSim.Server.Base;
11using OpenSim.Services.Interfaces;
12
13namespace OpenSim.Services.LLLoginService
14{
15 public class LLLoginService : ILoginService
16 {
17 private IUserAccountService m_UserAccountService;
18 private IAuthenticationService m_AuthenticationService;
19 private IInventoryService m_InventoryService;
20 private IGridService m_GridService;
21 private IPresenceService m_PresenceService;
22
23 public LLLoginService(IConfigSource config)
24 {
25 IConfig serverConfig = config.Configs["LoginService"];
26 if (serverConfig == null)
27 throw new Exception(String.Format("No section LoginService in config file"));
28
29 string accountService = serverConfig.GetString("UserAccountService", String.Empty);
30 string authService = serverConfig.GetString("AuthenticationService", String.Empty);
31 string invService = serverConfig.GetString("InventoryService", String.Empty);
32 string gridService = serverConfig.GetString("GridService", String.Empty);
33 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
34
35 // These 3 are required; the other 2 aren't
36 if (accountService == string.Empty || authService == string.Empty ||
37 invService == string.Empty)
38 throw new Exception("LoginService is missing service specifications");
39
40 Object[] args = new Object[] { config };
41 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
42 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
43 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
44 if (gridService != string.Empty)
45 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
46 if (presenceService != string.Empty)
47 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
48
49 }
50
51 public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation)
52 {
53 // Get the account and check that it exists
54 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
55 if (account == null)
56 return LLFailedLoginResponse.UserProblem;
57
58 // Authenticate this user
59 string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30);
60 UUID session = UUID.Zero;
61 if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out session)))
62 return LLFailedLoginResponse.UserProblem;
63
64 // Get the user's inventory
65 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
66 if ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))
67 return LLFailedLoginResponse.InventoryProblem;
68
69 // lots of things missing... need to do the simulation service
70
71 return null;
72 }
73 }
74}
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini
index c3ed754..7b1d43d 100644
--- a/bin/config-include/StandaloneHypergrid.ini
+++ b/bin/config-include/StandaloneHypergrid.ini
@@ -60,3 +60,11 @@
60 60
61[UserAccountService] 61[UserAccountService]
62 LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" 62 LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
63
64[LoginService]
65 LocalServiceModule = "OpenSim.Services.LLoginService.dll:LLLoginService"
66 UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
67 AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
68 InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService"
69 PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
70
diff --git a/prebuild.xml b/prebuild.xml
index 19cd6af..c211686 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1477,6 +1477,37 @@
1477 </Files> 1477 </Files>
1478 </Project> 1478 </Project>
1479 1479
1480 <Project frameworkVersion="v3_5" name="OpenSim.Services.LLLoginService" path="OpenSim/Services/LLLoginService" type="Library">
1481 <Configuration name="Debug">
1482 <Options>
1483 <OutputPath>../../../bin/</OutputPath>
1484 </Options>
1485 </Configuration>
1486 <Configuration name="Release">
1487 <Options>
1488 <OutputPath>../../../bin/</OutputPath>
1489 </Options>
1490 </Configuration>
1491
1492 <ReferencePath>../../../bin/</ReferencePath>
1493 <Reference name="System"/>
1494 <Reference name="OpenSim.Framework"/>
1495 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
1496 <Reference name="OpenSim.Services.Interfaces"/>
1497 <Reference name="OpenSim.Services.Base"/>
1498 <Reference name="OpenSim.Server.Base"/>
1499 <Reference name="OpenMetaverseTypes.dll"/>
1500 <Reference name="OpenMetaverse.dll"/>
1501 <Reference name="OpenMetaverse.StructuredData.dll"/>
1502 <Reference name="Nini.dll" />
1503 <Reference name="log4net.dll"/>
1504
1505 <Files>
1506 <Match pattern="*.cs" recurse="true"/>
1507 </Files>
1508 </Project>
1509
1510
1480 1511
1481 <Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library"> 1512 <Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library">
1482 <Configuration name="Debug"> 1513 <Configuration name="Debug">