aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/LLLoginService
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Services/LLLoginService
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Services/LLLoginService')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs39
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs211
-rw-r--r--OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs10
3 files changed, 186 insertions, 74 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index c3756d0..823fd36 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -55,12 +55,13 @@ namespace OpenSim.Services.LLLoginService
55 public static LLFailedLoginResponse InventoryProblem; 55 public static LLFailedLoginResponse InventoryProblem;
56 public static LLFailedLoginResponse DeadRegionProblem; 56 public static LLFailedLoginResponse DeadRegionProblem;
57 public static LLFailedLoginResponse LoginBlockedProblem; 57 public static LLFailedLoginResponse LoginBlockedProblem;
58 public static LLFailedLoginResponse UnverifiedAccountProblem;
58 public static LLFailedLoginResponse AlreadyLoggedInProblem; 59 public static LLFailedLoginResponse AlreadyLoggedInProblem;
59 public static LLFailedLoginResponse InternalError; 60 public static LLFailedLoginResponse InternalError;
60 61
61 static LLFailedLoginResponse() 62 static LLFailedLoginResponse()
62 { 63 {
63 UserProblem = new LLFailedLoginResponse("key", 64 UserProblem = new LLFailedLoginResponse("key",
64 "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", 65 "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
65 "false"); 66 "false");
66 GridProblem = new LLFailedLoginResponse("key", 67 GridProblem = new LLFailedLoginResponse("key",
@@ -75,11 +76,14 @@ namespace OpenSim.Services.LLLoginService
75 LoginBlockedProblem = new LLFailedLoginResponse("presence", 76 LoginBlockedProblem = new LLFailedLoginResponse("presence",
76 "Logins are currently restricted. Please try again later.", 77 "Logins are currently restricted. Please try again later.",
77 "false"); 78 "false");
79 UnverifiedAccountProblem = new LLFailedLoginResponse("presence",
80 "Your account has not yet been verified. Please check " +
81 "your email and click the provided link.",
82 "false");
78 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", 83 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence",
79 "You appear to be already logged in. " + 84 "You appear to be already logged in. " +
80 "If this is not the case please wait for your session to timeout. " + 85 "Please wait a a minute or two and retry. " +
81 "If this takes longer than a few minutes please contact the grid owner. " + 86 "If this takes longer than a few minutes please contact the grid owner. ",
82 "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.",
83 "false"); 87 "false");
84 InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false"); 88 InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false");
85 } 89 }
@@ -145,6 +149,7 @@ namespace OpenSim.Services.LLLoginService
145 private UUID agentID; 149 private UUID agentID;
146 private UUID sessionID; 150 private UUID sessionID;
147 private UUID secureSessionID; 151 private UUID secureSessionID;
152 private UUID realID;
148 153
149 // Login Flags 154 // Login Flags
150 private string dst; 155 private string dst;
@@ -228,8 +233,9 @@ namespace OpenSim.Services.LLLoginService
228 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 233 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
229 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 234 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
230 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 235 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
231 GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency, 236
232 string DSTZone, string destinationsURL, string avatarsURL, string classifiedFee, int maxAgentGroups) 237 GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency,
238 string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee,int maxAgentGroups)
233 : this() 239 : this()
234 { 240 {
235 FillOutInventoryData(invSkel, libService); 241 FillOutInventoryData(invSkel, libService);
@@ -242,6 +248,7 @@ namespace OpenSim.Services.LLLoginService
242 AgentID = account.PrincipalID; 248 AgentID = account.PrincipalID;
243 SessionID = aCircuit.SessionID; 249 SessionID = aCircuit.SessionID;
244 SecureSessionID = aCircuit.SecureSessionID; 250 SecureSessionID = aCircuit.SecureSessionID;
251 RealID = realID;
245 Message = message; 252 Message = message;
246 BuddList = ConvertFriendListItem(friendsList); 253 BuddList = ConvertFriendListItem(friendsList);
247 StartLocation = where; 254 StartLocation = where;
@@ -299,7 +306,7 @@ namespace OpenSim.Services.LLLoginService
299 { 306 {
300 DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; 307 DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
301 } 308 }
302 309
303 break; 310 break;
304 } 311 }
305 } 312 }
@@ -383,6 +390,7 @@ namespace OpenSim.Services.LLLoginService
383 private void FillOutRegionData(GridRegion destination) 390 private void FillOutRegionData(GridRegion destination)
384 { 391 {
385 IPEndPoint endPoint = destination.ExternalEndPoint; 392 IPEndPoint endPoint = destination.ExternalEndPoint;
393 if (endPoint == null) return;
386 SimAddress = endPoint.Address.ToString(); 394 SimAddress = endPoint.Address.ToString();
387 SimPort = (uint)endPoint.Port; 395 SimPort = (uint)endPoint.Port;
388 RegionX = (uint)destination.RegionLocX; 396 RegionX = (uint)destination.RegionLocX;
@@ -408,7 +416,7 @@ namespace OpenSim.Services.LLLoginService
408// try 416// try
409// { 417// {
410// // First try to fetch DST from Pacific Standard Time, because this is 418// // First try to fetch DST from Pacific Standard Time, because this is
411// // the one expected by the viewer. "US/Pacific" is the string to search 419// // the one expected by the viewer. "US/Pacific" is the string to search
412// // on linux and mac, and should work also on Windows (to confirm) 420// // on linux and mac, and should work also on Windows (to confirm)
413// gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific"); 421// gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific");
414// } 422// }
@@ -438,7 +446,7 @@ namespace OpenSim.Services.LLLoginService
438 ErrorReason = "key"; 446 ErrorReason = "key";
439 welcomeMessage = "Welcome to OpenSim!"; 447 welcomeMessage = "Welcome to OpenSim!";
440 seedCapability = String.Empty; 448 seedCapability = String.Empty;
441 home = "{'region_handle':[" 449 home = "{'region_handle':["
442 + "r" + Util.RegionToWorldLoc(1000).ToString() 450 + "r" + Util.RegionToWorldLoc(1000).ToString()
443 + "," 451 + ","
444 + "r" + Util.RegionToWorldLoc(1000).ToString() 452 + "r" + Util.RegionToWorldLoc(1000).ToString()
@@ -473,6 +481,7 @@ namespace OpenSim.Services.LLLoginService
473 SessionID = UUID.Random(); 481 SessionID = UUID.Random();
474 SecureSessionID = UUID.Random(); 482 SecureSessionID = UUID.Random();
475 AgentID = UUID.Random(); 483 AgentID = UUID.Random();
484 RealID = UUID.Zero;
476 485
477 Hashtable InitialOutfitHash = new Hashtable(); 486 Hashtable InitialOutfitHash = new Hashtable();
478 InitialOutfitHash["folder_name"] = "Nightclub Female"; 487 InitialOutfitHash["folder_name"] = "Nightclub Female";
@@ -518,6 +527,7 @@ namespace OpenSim.Services.LLLoginService
518 responseData["http_port"] = (Int32)SimHttpPort; 527 responseData["http_port"] = (Int32)SimHttpPort;
519 528
520 responseData["agent_id"] = AgentID.ToString(); 529 responseData["agent_id"] = AgentID.ToString();
530 responseData["real_id"] = RealID.ToString();
521 responseData["session_id"] = SessionID.ToString(); 531 responseData["session_id"] = SessionID.ToString();
522 responseData["secure_session_id"] = SecureSessionID.ToString(); 532 responseData["secure_session_id"] = SecureSessionID.ToString();
523 responseData["circuit_code"] = CircuitCode; 533 responseData["circuit_code"] = CircuitCode;
@@ -582,7 +592,7 @@ namespace OpenSim.Services.LLLoginService
582 // responseData["real_currency"] = currency; 592 // responseData["real_currency"] = currency;
583 responseData["currency"] = currency; 593 responseData["currency"] = currency;
584 } 594 }
585 595
586 if (ClassifiedFee != String.Empty) 596 if (ClassifiedFee != String.Empty)
587 responseData["classified_fee"] = ClassifiedFee; 597 responseData["classified_fee"] = ClassifiedFee;
588 598
@@ -613,6 +623,7 @@ namespace OpenSim.Services.LLLoginService
613 map["sim_ip"] = OSD.FromString(SimAddress); 623 map["sim_ip"] = OSD.FromString(SimAddress);
614 624
615 map["agent_id"] = OSD.FromUUID(AgentID); 625 map["agent_id"] = OSD.FromUUID(AgentID);
626 map["real_id"] = OSD.FromUUID(RealID);
616 map["session_id"] = OSD.FromUUID(SessionID); 627 map["session_id"] = OSD.FromUUID(SessionID);
617 map["secure_session_id"] = OSD.FromUUID(SecureSessionID); 628 map["secure_session_id"] = OSD.FromUUID(SecureSessionID);
618 map["circuit_code"] = OSD.FromInteger(CircuitCode); 629 map["circuit_code"] = OSD.FromInteger(CircuitCode);
@@ -924,6 +935,12 @@ namespace OpenSim.Services.LLLoginService
924 set { secureSessionID = value; } 935 set { secureSessionID = value; }
925 } 936 }
926 937
938 public UUID RealID
939 {
940 get { return realID; }
941 set { realID = value; }
942 }
943
927 public Int32 CircuitCode 944 public Int32 CircuitCode
928 { 945 {
929 get { return circuitCode; } 946 get { return circuitCode; }
@@ -1052,7 +1069,7 @@ namespace OpenSim.Services.LLLoginService
1052 get { return activeGestures; } 1069 get { return activeGestures; }
1053 set { activeGestures = value; } 1070 set { activeGestures = value; }
1054 } 1071 }
1055 1072
1056 public string Home 1073 public string Home
1057 { 1074 {
1058 get { return home; } 1075 get { return home; }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 0b38738..3ccdc9c 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -40,6 +40,7 @@ using OpenMetaverse;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Framework.Console; 41using OpenSim.Framework.Console;
42using OpenSim.Server.Base; 42using OpenSim.Server.Base;
43using OpenSim.Services.Connectors.InstantMessage;
43using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion; 45using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 46using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
@@ -77,16 +78,19 @@ namespace OpenSim.Services.LLLoginService
77 protected string m_GatekeeperURL; 78 protected string m_GatekeeperURL;
78 protected bool m_AllowRemoteSetLoginLevel; 79 protected bool m_AllowRemoteSetLoginLevel;
79 protected string m_MapTileURL; 80 protected string m_MapTileURL;
81 protected string m_ProfileURL;
82 protected string m_OpenIDURL;
80 protected string m_SearchURL; 83 protected string m_SearchURL;
81 protected string m_Currency; 84 protected string m_Currency;
82 protected string m_ClassifiedFee; 85 protected string m_ClassifiedFee;
83 protected int m_MaxAgentGroups; 86 protected int m_MaxAgentGroups = 42;
84 protected string m_DestinationGuide; 87 protected string m_DestinationGuide;
85 protected string m_AvatarPicker; 88 protected string m_AvatarPicker;
86 protected string m_AllowedClients; 89 protected string m_AllowedClients;
87 protected string m_DeniedClients; 90 protected string m_DeniedClients;
88 protected string m_MessageUrl; 91 protected string m_MessageUrl;
89 protected string m_DSTZone; 92 protected string m_DSTZone;
93 protected bool m_allowDuplicatePresences = false;
90 94
91 IConfig m_LoginServerConfig; 95 IConfig m_LoginServerConfig;
92// IConfig m_ClientsConfig; 96// IConfig m_ClientsConfig;
@@ -117,6 +121,8 @@ namespace OpenSim.Services.LLLoginService
117 m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", 121 m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
118 new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); 122 new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
119 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); 123 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
124 m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
125 m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
120 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 126 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
121 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); 127 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
122 m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); 128 m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty);
@@ -127,7 +133,7 @@ namespace OpenSim.Services.LLLoginService
127 m_AllowedClients = Util.GetConfigVarFromSections<string>( 133 m_AllowedClients = Util.GetConfigVarFromSections<string>(
128 config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); 134 config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
129 m_DeniedClients = Util.GetConfigVarFromSections<string>( 135 m_DeniedClients = Util.GetConfigVarFromSections<string>(
130 config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); 136 config, "DeniedClients", possibleAccessControlConfigSections, string.Empty);
131 137
132 m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); 138 m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty);
133 m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); 139 m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");
@@ -136,6 +142,11 @@ namespace OpenSim.Services.LLLoginService
136 if (groupConfig != null) 142 if (groupConfig != null)
137 m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); 143 m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42);
138 144
145 IConfig presenceConfig = config.Configs["PresenceService"];
146 if (presenceConfig != null)
147 {
148 m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
149 }
139 150
140 // Clean up some of these vars 151 // Clean up some of these vars
141 if (m_MapTileURL != String.Empty) 152 if (m_MapTileURL != String.Empty)
@@ -155,7 +166,8 @@ namespace OpenSim.Services.LLLoginService
155 Object[] args = new Object[] { config }; 166 Object[] args = new Object[] { config };
156 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 167 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
157 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); 168 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
158 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); 169 Object[] authArgs = new Object[] { config, m_UserAccountService };
170 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs);
159 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); 171 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
160 172
161 if (gridService != string.Empty) 173 if (gridService != string.Empty)
@@ -175,9 +187,14 @@ namespace OpenSim.Services.LLLoginService
175 string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty); 187 string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);
176 if (hgInvServicePlugin != string.Empty) 188 if (hgInvServicePlugin != string.Empty)
177 { 189 {
190 // TODO: Remove HGInventoryServiceConstructorArg after 0.9 release
178 string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty); 191 string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
179 Object[] args2 = new Object[] { config, hgInvServiceArg }; 192 if (hgInvServiceArg != String.Empty)
180 m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args2); 193 {
194 m_log.Warn("[LLOGIN SERVICE]: You are using HGInventoryServiceConstructorArg, which is deprecated. See example file for correct syntax.");
195 hgInvServicePlugin = hgInvServiceArg + "@" + hgInvServicePlugin;
196 }
197 m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args);
181 } 198 }
182 199
183 // 200 //
@@ -260,16 +277,20 @@ namespace OpenSim.Services.LLLoginService
260 return response; 277 return response;
261 } 278 }
262 279
263 public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, 280 public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID,
264 string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP) 281 string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient)
265 { 282 {
266 bool success = false; 283 bool success = false;
267 UUID session = UUID.Random(); 284 UUID session = UUID.Random();
285
268 string processedMessage; 286 string processedMessage;
269 287
270 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", 288 if (clientVersion.Contains("Radegast"))
271 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); 289 LibOMVclient = false;
272 290
291 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ",
292 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0, LibOMVclient.ToString());
293
273 try 294 try
274 { 295 {
275 // 296 //
@@ -345,7 +366,8 @@ namespace OpenSim.Services.LLLoginService
345 if (!passwd.StartsWith("$1$")) 366 if (!passwd.StartsWith("$1$"))
346 passwd = "$1$" + Util.Md5Hash(passwd); 367 passwd = "$1$" + Util.Md5Hash(passwd);
347 passwd = passwd.Remove(0, 3); //remove $1$ 368 passwd = passwd.Remove(0, 3); //remove $1$
348 string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30); 369 UUID realID;
370 string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out realID);
349 UUID secureSession = UUID.Zero; 371 UUID secureSession = UUID.Zero;
350 if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) 372 if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession)))
351 { 373 {
@@ -355,6 +377,29 @@ namespace OpenSim.Services.LLLoginService
355 return LLFailedLoginResponse.UserProblem; 377 return LLFailedLoginResponse.UserProblem;
356 } 378 }
357 379
380 if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
381 {
382 // really?
383 return LLFailedLoginResponse.UserProblem;
384 }
385
386 string PrincipalIDstr = account.PrincipalID.ToString();
387 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr);
388
389 if(!m_allowDuplicatePresences)
390 {
391 if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero)
392 {
393 if(SendAgentGodKillToRegion(scopeID, account.PrincipalID, guinfo))
394 {
395 m_log.InfoFormat(
396 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: already logged in",
397 firstName, lastName);
398 return LLFailedLoginResponse.AlreadyLoggedInProblem;
399 }
400 }
401 }
402
358 // 403 //
359 // Get the user's inventory 404 // Get the user's inventory
360 // 405 //
@@ -391,7 +436,7 @@ namespace OpenSim.Services.LLLoginService
391 // 436 //
392 if (m_PresenceService != null) 437 if (m_PresenceService != null)
393 { 438 {
394 success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); 439 success = m_PresenceService.LoginAgent(PrincipalIDstr, session, secureSession);
395 440
396 if (!success) 441 if (!success)
397 { 442 {
@@ -406,7 +451,6 @@ namespace OpenSim.Services.LLLoginService
406 // Change Online status and get the home region 451 // Change Online status and get the home region
407 // 452 //
408 GridRegion home = null; 453 GridRegion home = null;
409 GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
410 454
411 // We are only going to complain about no home if the user actually tries to login there, to avoid 455 // We are only going to complain about no home if the user actually tries to login there, to avoid
412 // spamming the console. 456 // spamming the console.
@@ -437,7 +481,7 @@ namespace OpenSim.Services.LLLoginService
437 guinfo = new GridUserInfo(); 481 guinfo = new GridUserInfo();
438 guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); 482 guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
439 } 483 }
440 484
441 // 485 //
442 // Find the destination region/grid 486 // Find the destination region/grid
443 // 487 //
@@ -479,7 +523,7 @@ namespace OpenSim.Services.LLLoginService
479 // 523 //
480 string reason = string.Empty; 524 string reason = string.Empty;
481 GridRegion dest; 525 GridRegion dest;
482 AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where, 526 AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where,
483 clientVersion, channel, mac, id0, clientIP, flags, out where, out reason, out dest); 527 clientVersion, channel, mac, id0, clientIP, flags, out where, out reason, out dest);
484 destination = dest; 528 destination = dest;
485 if (aCircuit == null) 529 if (aCircuit == null)
@@ -489,7 +533,11 @@ namespace OpenSim.Services.LLLoginService
489 return new LLFailedLoginResponse("key", reason, "false"); 533 return new LLFailedLoginResponse("key", reason, "false");
490 534
491 } 535 }
492 // Get Friends list 536
537 // only now we can assume a login
538 guinfo = m_GridUserService.LoggedIn(PrincipalIDstr);
539
540 // Get Friends list
493 FriendInfo[] friendsList = new FriendInfo[0]; 541 FriendInfo[] friendsList = new FriendInfo[0];
494 if (m_FriendsService != null) 542 if (m_FriendsService != null)
495 { 543 {
@@ -502,8 +550,8 @@ namespace OpenSim.Services.LLLoginService
502 // 550 //
503 if (m_MessageUrl != String.Empty) 551 if (m_MessageUrl != String.Empty)
504 { 552 {
505 WebClient client = new WebClient(); 553 using(WebClient client = new WebClient())
506 processedMessage = client.DownloadString(m_MessageUrl); 554 processedMessage = client.DownloadString(m_MessageUrl);
507 } 555 }
508 else 556 else
509 { 557 {
@@ -512,11 +560,11 @@ namespace OpenSim.Services.LLLoginService
512 processedMessage = processedMessage.Replace("\\n", "\n").Replace("<USERNAME>", firstName + " " + lastName); 560 processedMessage = processedMessage.Replace("\\n", "\n").Replace("<USERNAME>", firstName + " " + lastName);
513 561
514 LLLoginResponse response 562 LLLoginResponse response
515 = new LLLoginResponse( 563 = new LLLoginResponse(
516 account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 564 account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
517 where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP, 565 where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP,
518 m_MapTileURL, m_SearchURL, m_Currency, m_DSTZone, 566 m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone,
519 m_DestinationGuide, m_AvatarPicker, m_ClassifiedFee, m_MaxAgentGroups); 567 m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee,m_MaxAgentGroups);
520 568
521 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); 569 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName);
522 570
@@ -572,12 +620,13 @@ namespace OpenSim.Services.LLLoginService
572 lookAt = pinfo.HomeLookAt; 620 lookAt = pinfo.HomeLookAt;
573 flags |= TeleportFlags.ViaHome; 621 flags |= TeleportFlags.ViaHome;
574 } 622 }
575 623
576 if (tryDefaults) 624 if (tryDefaults)
577 { 625 {
578 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); 626 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
579 if (defaults != null && defaults.Count > 0) 627 if (defaults != null && defaults.Count > 0)
580 { 628 {
629 flags |= TeleportFlags.ViaRegionID;
581 region = defaults[0]; 630 region = defaults[0];
582 where = "safe"; 631 where = "safe";
583 } 632 }
@@ -587,7 +636,10 @@ namespace OpenSim.Services.LLLoginService
587 account.FirstName, account.LastName); 636 account.FirstName, account.LastName);
588 region = FindAlternativeRegion(scopeID); 637 region = FindAlternativeRegion(scopeID);
589 if (region != null) 638 if (region != null)
639 {
640 flags |= TeleportFlags.ViaRegionID;
590 where = "safe"; 641 where = "safe";
642 }
591 } 643 }
592 } 644 }
593 645
@@ -608,6 +660,7 @@ namespace OpenSim.Services.LLLoginService
608 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); 660 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
609 if (defaults != null && defaults.Count > 0) 661 if (defaults != null && defaults.Count > 0)
610 { 662 {
663 flags |= TeleportFlags.ViaRegionID;
611 region = defaults[0]; 664 region = defaults[0];
612 where = "safe"; 665 where = "safe";
613 } 666 }
@@ -616,7 +669,10 @@ namespace OpenSim.Services.LLLoginService
616 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); 669 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
617 region = FindAlternativeRegion(scopeID); 670 region = FindAlternativeRegion(scopeID);
618 if (region != null) 671 if (region != null)
672 {
673 flags |= TeleportFlags.ViaRegionID;
619 where = "safe"; 674 where = "safe";
675 }
620 } 676 }
621 677
622 } 678 }
@@ -625,7 +681,7 @@ namespace OpenSim.Services.LLLoginService
625 position = pinfo.LastPosition; 681 position = pinfo.LastPosition;
626 lookAt = pinfo.LastLookAt; 682 lookAt = pinfo.LastLookAt;
627 } 683 }
628 684
629 return region; 685 return region;
630 } 686 }
631 else 687 else
@@ -661,7 +717,7 @@ namespace OpenSim.Services.LLLoginService
661 regions = m_GridService.GetDefaultRegions(scopeID); 717 regions = m_GridService.GetDefaultRegions(scopeID);
662 if (regions != null && regions.Count > 0) 718 if (regions != null && regions.Count > 0)
663 { 719 {
664 where = "safe"; 720 where = "safe";
665 return regions[0]; 721 return regions[0];
666 } 722 }
667 else 723 else
@@ -696,7 +752,7 @@ namespace OpenSim.Services.LLLoginService
696 return null; 752 return null;
697 } 753 }
698 // Valid specification of a remote grid 754 // Valid specification of a remote grid
699 755
700 regionName = parts[0]; 756 regionName = parts[0];
701 string domainLocator = parts[1]; 757 string domainLocator = parts[1];
702 parts = domainLocator.Split(new char[] {':'}); 758 parts = domainLocator.Split(new char[] {':'});
@@ -714,7 +770,7 @@ namespace OpenSim.Services.LLLoginService
714 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); 770 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
715 if (defaults != null && defaults.Count > 0) 771 if (defaults != null && defaults.Count > 0)
716 { 772 {
717 where = "safe"; 773 where = "safe";
718 return defaults[0]; 774 return defaults[0];
719 } 775 }
720 else 776 else
@@ -767,12 +823,15 @@ namespace OpenSim.Services.LLLoginService
767 ulong handle; 823 ulong handle;
768 string imageURL = string.Empty, reason = string.Empty; 824 string imageURL = string.Empty, reason = string.Empty;
769 string message; 825 string message;
770 if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) 826 int sizeX = (int)Constants.RegionSize;
827 int sizeY = (int)Constants.RegionSize;
828
829 if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason, out sizeX, out sizeY))
771 { 830 {
772 string homeURI = null; 831 string homeURI = null;
773 if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey("HomeURI")) 832 if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey("HomeURI"))
774 homeURI = (string)account.ServiceURLs["HomeURI"]; 833 homeURI = (string)account.ServiceURLs["HomeURI"];
775 834
776 GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, account.PrincipalID, homeURI, out message); 835 GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, account.PrincipalID, homeURI, out message);
777 return destination; 836 return destination;
778 } 837 }
@@ -806,6 +865,9 @@ namespace OpenSim.Services.LLLoginService
806 reason = string.Empty; 865 reason = string.Empty;
807 uint circuitCode = 0; 866 uint circuitCode = 0;
808 AgentCircuitData aCircuit = null; 867 AgentCircuitData aCircuit = null;
868 dest = null;
869
870 bool success = false;
809 871
810 if (m_UserAgentService == null) 872 if (m_UserAgentService == null)
811 { 873 {
@@ -816,28 +878,14 @@ namespace OpenSim.Services.LLLoginService
816 simConnector = m_LocalSimulationService; 878 simConnector = m_LocalSimulationService;
817 else if (m_RemoteSimulationService != null) 879 else if (m_RemoteSimulationService != null)
818 simConnector = m_RemoteSimulationService; 880 simConnector = m_RemoteSimulationService;
819 }
820 else // User Agent Service is on
821 {
822 if (gatekeeper == null) // login to local grid
823 {
824 if (hostName == string.Empty)
825 SetHostAndPort(m_GatekeeperURL);
826
827 gatekeeper = new GridRegion(destination);
828 gatekeeper.ExternalHostName = hostName;
829 gatekeeper.HttpPort = (uint)port;
830 gatekeeper.ServerURI = m_GatekeeperURL;
831 }
832 m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL);
833 }
834 881
835 bool success = false; 882 if(simConnector == null)
883 return null;
836 884
837 if (m_UserAgentService == null && simConnector != null)
838 {
839 circuitCode = (uint)Util.RandomClass.Next(); ; 885 circuitCode = (uint)Util.RandomClass.Next(); ;
840 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); 886 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position,
887 clientIP.Address.ToString(), viewer, channel, mac, id0);
888
841 success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason); 889 success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason);
842 if (!success && m_GridService != null) 890 if (!success && m_GridService != null)
843 { 891 {
@@ -859,10 +907,22 @@ namespace OpenSim.Services.LLLoginService
859 } 907 }
860 } 908 }
861 909
862 if (m_UserAgentService != null) 910 else
863 { 911 {
912 if (gatekeeper == null) // login to local grid
913 {
914 if (hostName == string.Empty)
915 SetHostAndPort(m_GatekeeperURL);
916
917 gatekeeper = new GridRegion(destination);
918 gatekeeper.ExternalHostName = hostName;
919 gatekeeper.HttpPort = (uint)port;
920 gatekeeper.ServerURI = m_GatekeeperURL;
921 }
864 circuitCode = (uint)Util.RandomClass.Next(); ; 922 circuitCode = (uint)Util.RandomClass.Next(); ;
865 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); 923 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position,
924 clientIP.Address.ToString(), viewer, channel, mac, id0);
925
866 aCircuit.teleportFlags |= (uint)flags; 926 aCircuit.teleportFlags |= (uint)flags;
867 success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); 927 success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason);
868 if (!success && m_GridService != null) 928 if (!success && m_GridService != null)
@@ -891,8 +951,8 @@ namespace OpenSim.Services.LLLoginService
891 return null; 951 return null;
892 } 952 }
893 953
894 private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, 954 private AgentCircuitData MakeAgent(GridRegion region, UserAccount account,
895 AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, 955 AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position,
896 string ipaddress, string viewer, string channel, string mac, string id0) 956 string ipaddress, string viewer, string channel, string mac, string id0)
897 { 957 {
898 AgentCircuitData aCircuit = new AgentCircuitData(); 958 AgentCircuitData aCircuit = new AgentCircuitData();
@@ -930,7 +990,7 @@ namespace OpenSim.Services.LLLoginService
930 if (account.ServiceURLs == null) 990 if (account.ServiceURLs == null)
931 return; 991 return;
932 992
933 // Old style: get the service keys from the DB 993 // Old style: get the service keys from the DB
934 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) 994 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
935 { 995 {
936 if (kvp.Value != null) 996 if (kvp.Value != null)
@@ -989,7 +1049,7 @@ namespace OpenSim.Services.LLLoginService
989 region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) 1049 region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
990 return false; 1050 return false;
991 1051
992 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); 1052 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason);
993 } 1053 }
994 1054
995 private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) 1055 private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)
@@ -1027,7 +1087,7 @@ namespace OpenSim.Services.LLLoginService
1027 switch (subcommand) 1087 switch (subcommand)
1028 { 1088 {
1029 case "level": 1089 case "level":
1030 // Set the minimum level to allow login 1090 // Set the minimum level to allow login
1031 // Useful to allow grid update without worrying about users. 1091 // Useful to allow grid update without worrying about users.
1032 // or fixing critical issues 1092 // or fixing critical issues
1033 // 1093 //
@@ -1040,8 +1100,8 @@ namespace OpenSim.Services.LLLoginService
1040 } 1100 }
1041 break; 1101 break;
1042 1102
1043 case "reset": 1103 case "reset":
1044 m_MinLoginLevel = 0; 1104 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
1045 MainConsole.Instance.OutputFormat("Reset min login level to {0}", m_MinLoginLevel); 1105 MainConsole.Instance.OutputFormat("Reset min login level to {0}", m_MinLoginLevel);
1046 break; 1106 break;
1047 1107
@@ -1054,6 +1114,41 @@ namespace OpenSim.Services.LLLoginService
1054 break; 1114 break;
1055 } 1115 }
1056 } 1116 }
1117
1118 private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo)
1119 {
1120 UUID regionID = guinfo.LastRegionID;
1121 GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID);
1122 if(regInfo == null)
1123 return false;
1124
1125 string regURL = regInfo.ServerURI;
1126 if(String.IsNullOrEmpty(regURL))
1127 return false;
1128
1129 UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e");
1130
1131 GridInstantMessage msg = new GridInstantMessage();
1132 msg.imSessionID = UUID.Zero.Guid;
1133 msg.fromAgentID = guuid.Guid;
1134 msg.toAgentID = agentID.Guid;
1135 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
1136 msg.fromAgentName = "GRID";
1137 msg.message = string.Format("New login detected");
1138 msg.dialog = 250; // God kick
1139 msg.fromGroup = false;
1140 msg.offline = (byte)0;
1141 msg.ParentEstateID = 0;
1142 msg.Position = Vector3.Zero;
1143 msg.RegionID = scopeID.Guid;
1144 msg.binaryBucket = new byte[1] {0};
1145 InstantMessageServiceConnector.SendInstantMessage(regURL,msg);
1146
1147 m_GridUserService.LoggedOut(agentID.ToString(),
1148 UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
1149
1150 return true;
1151 }
1057 } 1152 }
1058 1153
1059 #endregion 1154 #endregion
diff --git a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
index 5c150e3..005ddd8 100644
--- a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.LLLoginService")] 8[assembly: AssemblyTitle("OpenSim.Services.LLLoginService")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
@@ -25,9 +25,9 @@ using System.Runtime.InteropServices;
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.3.*")] 32[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
33 33