aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/LoginService.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-05 06:05:25 +0000
committerTeravus Ovares2008-01-05 06:05:25 +0000
commitdb3edff5d5f1c9a31f377db77d1ac4e1fa685623 (patch)
tree5b2066a5556b3eff8f0152bdb3ce109b428081fe /OpenSim/Framework/Communications/LoginService.cs
parent* Added shell Messaging Server. Don't run the MessagingServer yet or you mig... (diff)
downloadopensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.zip
opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.tar.gz
opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.tar.bz2
opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.tar.xz
* Applying jhurliman's LLSD login enablement patch.
* I'm keeping it deactivated until some issues are resolved. * I'm patching it in deactivated so the patch doesn't get outdated * I've deactivated it by commenting out the handler for the application/xml+llsd content type. * While I've tested this as much as possible on my setup and found the deactivated code doesn't cause any problems, consider this update experimental (event though it's deactivated)
Diffstat (limited to 'OpenSim/Framework/Communications/LoginService.cs')
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs132
1 files changed, 132 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 0531d6a..9cfac1c 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -31,6 +31,7 @@ using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Threading; 32using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.StructuredData;
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
35 36
36using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
@@ -198,6 +199,132 @@ namespace OpenSim.Framework.UserManagement
198 } 199 }
199 } 200 }
200 201
202 public LLSD LLSDLoginMethod(LLSD request)
203 {
204 // Temporary fix
205 m_loginMutex.WaitOne();
206
207 try
208 {
209 bool GoodLogin = false;
210
211 UserProfileData userProfile = null;
212 LoginResponse logResponse = new LoginResponse();
213
214 if (request.Type == LLSDType.Map)
215 {
216 LLSDMap map = (LLSDMap)request;
217
218 if (map.ContainsKey("first") && map.ContainsKey("last") && map.ContainsKey("passwd"))
219 {
220 string firstname = map["first"].AsString();
221 string lastname = map["last"].AsString();
222 string passwd = map["passwd"].AsString();
223
224 userProfile = GetTheUser(firstname, lastname);
225 if (userProfile == null)
226 {
227 MainLog.Instance.Verbose(
228 "LOGIN",
229 "Could not find a profile for " + firstname + " " + lastname);
230
231 return logResponse.CreateLoginFailedResponseLLSD();
232 }
233
234 GoodLogin = AuthenticateUser(userProfile, passwd);
235 }
236 }
237
238 if (!GoodLogin)
239 {
240 return logResponse.CreateLoginFailedResponseLLSD();
241 }
242 else
243 {
244 // If we already have a session...
245 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
246 {
247 userProfile.currentAgent = null;
248 m_userManager.CommitAgent(ref userProfile);
249
250 // Reject the login
251 return logResponse.CreateAlreadyLoggedInResponseLLSD();
252 }
253
254 // Otherwise...
255 // Create a new agent session
256 CreateAgent(userProfile, request);
257
258 try
259 {
260 LLUUID agentID = userProfile.UUID;
261
262 // Inventory Library Section
263 InventoryData inventData = CreateInventoryData(agentID);
264 ArrayList AgentInventoryArray = inventData.InventoryArray;
265
266 Hashtable InventoryRootHash = new Hashtable();
267 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToString();
268 ArrayList InventoryRoot = new ArrayList();
269 InventoryRoot.Add(InventoryRootHash);
270 userProfile.rootInventoryFolderID = inventData.RootFolderID;
271
272 // Circuit Code
273 uint circode = (uint)(Util.RandomClass.Next());
274
275 logResponse.Lastname = userProfile.surname;
276 logResponse.Firstname = userProfile.username;
277 logResponse.AgentID = agentID.ToString();
278 logResponse.SessionID = userProfile.currentAgent.sessionID.ToString();
279 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToString();
280 logResponse.InventoryRoot = InventoryRoot;
281 logResponse.InventorySkeleton = AgentInventoryArray;
282 logResponse.InventoryLibrary = GetInventoryLibrary();
283
284 Hashtable InventoryLibRootHash = new Hashtable();
285 InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
286 ArrayList InventoryLibRoot = new ArrayList();
287 InventoryLibRoot.Add(InventoryLibRootHash);
288 logResponse.InventoryLibRoot = InventoryLibRoot;
289
290 logResponse.InventoryLibraryOwner = GetLibraryOwner();
291 logResponse.CircuitCode = (Int32)circode;
292 //logResponse.RegionX = 0; //overwritten
293 //logResponse.RegionY = 0; //overwritten
294 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
295 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
296 //logResponse.SimAddress = "127.0.0.1"; //overwritten
297 //logResponse.SimPort = 0; //overwritten
298 logResponse.Message = GetMessage();
299 logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
300
301 try
302 {
303 CustomiseResponse(logResponse, userProfile);
304 }
305 catch (Exception ex)
306 {
307 MainLog.Instance.Verbose("LOGIN", ex.ToString());
308 return logResponse.CreateDeadRegionResponseLLSD();
309 }
310
311 CommitAgent(ref userProfile);
312
313 return logResponse.ToLLSDResponse();
314 }
315 catch (Exception ex)
316 {
317 MainLog.Instance.Verbose("LOGIN", ex.ToString());
318 return logResponse.CreateFailedResponseLLSD();
319 }
320 }
321 }
322 finally
323 {
324 m_loginMutex.ReleaseMutex();
325 }
326 }
327
201 /// <summary> 328 /// <summary>
202 /// Customises the login response and fills in missing values. 329 /// Customises the login response and fills in missing values.
203 /// </summary> 330 /// </summary>
@@ -246,6 +373,11 @@ namespace OpenSim.Framework.UserManagement
246 m_userManager.CreateAgent(profile, request); 373 m_userManager.CreateAgent(profile, request);
247 } 374 }
248 375
376 public void CreateAgent(UserProfileData profile, LLSD request)
377 {
378 m_userManager.CreateAgent(profile, request);
379 }
380
249 /// <summary> 381 /// <summary>
250 /// 382 ///
251 /// </summary> 383 /// </summary>