aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Local/LocalLoginService.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-19 17:41:21 +0000
committerJustin Clarke Casey2008-09-19 17:41:21 +0000
commit5fb7b485b211bbf19f4531a051b78dde92da4ba3 (patch)
tree655778d09beb953613b1db282dcf4cc640d90697 /OpenSim/Region/Communications/Local/LocalLoginService.cs
parentGuard LLRezObject against NaN (diff)
downloadopensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.zip
opensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.gz
opensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.bz2
opensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.xz
* Only allow logins on standalone when the sim has completed it's initial startup (script startup doesn't count here)
* There was a small window where region logins were allowed before modules were loaded - avatars logins that hit this window could have caused bad things to happen. * A similar change will follow for grid mode sometime soon
Diffstat (limited to 'OpenSim/Region/Communications/Local/LocalLoginService.cs')
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs64
1 files changed, 41 insertions, 23 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 41093c1..ded2d56 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -34,6 +34,7 @@ using OpenMetaverse;
34using log4net; 34using log4net;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Communications.Cache;
37 38
38namespace OpenSim.Region.Communications.Local 39namespace OpenSim.Region.Communications.Local
39{ 40{
@@ -43,27 +44,41 @@ namespace OpenSim.Region.Communications.Local
43 { 44 {
44 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 46
46 protected CommunicationsLocal m_Parent;
47
48 protected NetworkServersInfo serversInfo; 47 protected NetworkServersInfo serversInfo;
49 protected uint defaultHomeX; 48 protected uint defaultHomeX;
50 protected uint defaultHomeY; 49 protected uint defaultHomeY;
51 protected bool authUsers = false; 50 protected bool authUsers = false;
51
52 /// <summary>
53 /// Used by the login service to make requests to the inventory service.
54 /// </summary>
55 protected IInterServiceInventoryServices m_interServiceInventoryService;
56
57 /// <summary>
58 /// Used to make requests to the local regions.
59 /// </summary>
60 protected IGridServices m_gridService;
52 61
53 public event LoginToRegionEvent OnLoginToRegion; 62 public event LoginToRegionEvent OnLoginToRegion;
54 63
55 protected LoginToRegionEvent handlerLoginToRegion = null; // OnLoginToRegion; 64 protected LoginToRegionEvent handlerLoginToRegion = null; // OnLoginToRegion;
56 65
57 public LocalLoginService(UserManagerBase userManager, string welcomeMess, 66 public LocalLoginService(
58 CommunicationsLocal parent, NetworkServersInfo serversInfo, 67 UserManagerBase userManager, string welcomeMess,
59 bool authenticate) 68 IInterServiceInventoryServices interServiceInventoryService, LocalBackEndServices gridService,
60 : base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess) 69 NetworkServersInfo serversInfo,
70 bool authenticate, LibraryRootFolder libraryRootFolder)
71 : base(userManager, libraryRootFolder, welcomeMess)
61 { 72 {
62 m_Parent = parent;
63 this.serversInfo = serversInfo; 73 this.serversInfo = serversInfo;
64 defaultHomeX = this.serversInfo.DefaultHomeLocX; 74 defaultHomeX = this.serversInfo.DefaultHomeLocX;
65 defaultHomeY = this.serversInfo.DefaultHomeLocY; 75 defaultHomeY = this.serversInfo.DefaultHomeLocY;
66 authUsers = authenticate; 76 authUsers = authenticate;
77
78 m_interServiceInventoryService = interServiceInventoryService;
79 m_gridService = gridService;
80
81 OnLoginToRegion += gridService.AddNewSession;
67 } 82 }
68 83
69 public override UserProfileData GetTheUser(string firstname, string lastname) 84 public override UserProfileData GetTheUser(string firstname, string lastname)
@@ -84,7 +99,7 @@ namespace OpenSim.Region.Communications.Local
84 profile = m_userManager.GetUserProfile(firstname, lastname); 99 profile = m_userManager.GetUserProfile(firstname, lastname);
85 if (profile != null) 100 if (profile != null)
86 { 101 {
87 m_Parent.InterServiceInventoryService.CreateNewUserInventory(profile.ID); 102 m_interServiceInventoryService.CreateNewUserInventory(profile.ID);
88 } 103 }
89 104
90 return profile; 105 return profile;
@@ -129,11 +144,12 @@ namespace OpenSim.Region.Communications.Local
129 { 144 {
130 // HomeLocation 145 // HomeLocation
131 RegionInfo homeInfo = null; 146 RegionInfo homeInfo = null;
147
132 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 148 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
133 if (theUser.HomeRegionID != UUID.Zero) 149 if (theUser.HomeRegionID != UUID.Zero)
134 homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegionID); 150 homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegionID);
135 else 151 else
136 homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion); 152 homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegion);
137 if (homeInfo != null) 153 if (homeInfo != null)
138 { 154 {
139 response.Home = 155 response.Home =
@@ -172,7 +188,7 @@ namespace OpenSim.Region.Communications.Local
172 } 188 }
173 else if (startLocationRequest == "last") 189 else if (startLocationRequest == "last")
174 { 190 {
175 regionInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.CurrentAgent.Region); 191 regionInfo = m_gridService.RequestNeighbourInfo(theUser.CurrentAgent.Region);
176 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; 192 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
177 } 193 }
178 else 194 else
@@ -186,7 +202,7 @@ namespace OpenSim.Region.Communications.Local
186 else 202 else
187 { 203 {
188 string region = uriMatch.Groups["region"].ToString(); 204 string region = uriMatch.Groups["region"].ToString();
189 regionInfo = m_Parent.GridService.RequestClosestRegion(region); 205 regionInfo = m_gridService.RequestClosestRegion(region);
190 if (regionInfo == null) 206 if (regionInfo == null)
191 { 207 {
192 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); 208 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@@ -208,7 +224,7 @@ namespace OpenSim.Region.Communications.Local
208 } 224 }
209 225
210 // StartLocation not available, send him to a nearby region instead 226 // StartLocation not available, send him to a nearby region instead
211 // regionInfo = m_Parent.GridService.RequestClosestRegion(""); 227 // regionInfo = m_gridService.RequestClosestRegion("");
212 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName); 228 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
213 229
214 // Send him to default region instead 230 // Send him to default region instead
@@ -222,7 +238,7 @@ namespace OpenSim.Region.Communications.Local
222 } 238 }
223 239
224 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); 240 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
225 regionInfo = m_Parent.GridService.RequestNeighbourInfo(defaultHandle); 241 regionInfo = m_gridService.RequestNeighbourInfo(defaultHandle);
226 242
227 // Customise the response 243 // Customise the response
228 //response.Home = 244 //response.Home =
@@ -274,24 +290,26 @@ namespace OpenSim.Region.Communications.Local
274 loginParams.StartPos = user.CurrentAgent.Position; 290 loginParams.StartPos = user.CurrentAgent.Position;
275 loginParams.CapsPath = capsPath; 291 loginParams.CapsPath = capsPath;
276 292
277 handlerLoginToRegion = OnLoginToRegion; 293 if (m_gridService.RegionLoginsEnabled)
278 if (handlerLoginToRegion == null) 294 {
279 return false; 295 handlerLoginToRegion = OnLoginToRegion;
280 296 handlerLoginToRegion(user.CurrentAgent.Handle, loginParams);
281 handlerLoginToRegion(user.CurrentAgent.Handle, loginParams); 297 return true;
282 return true; 298 }
299
300 return false;
283 } 301 }
284 302
285 // See LoginService 303 // See LoginService
286 protected override InventoryData GetInventorySkeleton(UUID userID) 304 protected override InventoryData GetInventorySkeleton(UUID userID)
287 { 305 {
288 List<InventoryFolderBase> folders = m_Parent.InterServiceInventoryService.GetInventorySkeleton(userID); 306 List<InventoryFolderBase> folders = m_interServiceInventoryService.GetInventorySkeleton(userID);
289 307
290 // If we have user auth but no inventory folders for some reason, create a new set of folders. 308 // If we have user auth but no inventory folders for some reason, create a new set of folders.
291 if (null == folders || 0 == folders.Count) 309 if (null == folders || 0 == folders.Count)
292 { 310 {
293 m_Parent.InterServiceInventoryService.CreateNewUserInventory(userID); 311 m_interServiceInventoryService.CreateNewUserInventory(userID);
294 folders = m_Parent.InterServiceInventoryService.GetInventorySkeleton(userID); 312 folders = m_interServiceInventoryService.GetInventorySkeleton(userID);
295 } 313 }
296 314
297 UUID rootID = UUID.Zero; 315 UUID rootID = UUID.Zero;