aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
authorMelanie2010-01-16 00:05:08 +0000
committerMelanie2010-01-16 00:05:08 +0000
commit10f8c2ea9b67158c32b361f9652d503ea48de292 (patch)
treebe0d88bc4b6df3825a0d27f62a08170d7c7ad262 /OpenSim/Services/GridService
parentMerge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff)
parentAdd "create user" instructions to README.txt (diff)
downloadopensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.zip
opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.gz
opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.bz2
opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.xz
Merge branch 'master' into presence-refactor
This merge was very conflicted. I think I got them all, but I can't be sure. I had to merge to master or risk divergence to the point of unmergeability.
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs37
1 files changed, 27 insertions, 10 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 5c55c0b..e912705 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Services.GridService
52 protected IConfigSource m_config; 52 protected IConfigSource m_config;
53 53
54 protected IAuthenticationService m_AuthenticationService = null; 54 protected IAuthenticationService m_AuthenticationService = null;
55 protected bool m_AllowDuplicateNames = false;
55 56
56 public GridService(IConfigSource config) 57 public GridService(IConfigSource config)
57 : base(config) 58 : base(config)
@@ -71,6 +72,7 @@ namespace OpenSim.Services.GridService
71 Object[] args = new Object[] { config }; 72 Object[] args = new Object[] { config };
72 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); 73 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
73 } 74 }
75 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
74 } 76 }
75 77
76 if (m_RootInstance == null) 78 if (m_RootInstance == null)
@@ -95,7 +97,7 @@ namespace OpenSim.Services.GridService
95 97
96 #region IGridService 98 #region IGridService
97 99
98 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) 100 public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
99 { 101 {
100 IConfig gridConfig = m_config.Configs["GridService"]; 102 IConfig gridConfig = m_config.Configs["GridService"];
101 // This needs better sanity testing. What if regionInfo is registering in 103 // This needs better sanity testing. What if regionInfo is registering in
@@ -116,7 +118,7 @@ namespace OpenSim.Services.GridService
116 // Regions reserved for the null key cannot be taken. 118 // Regions reserved for the null key cannot be taken.
117 // 119 //
118 if (region.Data["PrincipalID"] == UUID.Zero.ToString()) 120 if (region.Data["PrincipalID"] == UUID.Zero.ToString())
119 return false; 121 return "Region location us reserved";
120 122
121 // Treat it as an auth request 123 // Treat it as an auth request
122 // 124 //
@@ -132,12 +134,10 @@ namespace OpenSim.Services.GridService
132 // Can we authenticate at all? 134 // Can we authenticate at all?
133 // 135 //
134 if (m_AuthenticationService == null) 136 if (m_AuthenticationService == null)
135 return false; 137 return "No authentication possible";
136 138
137 if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30)) 139 if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30))
138 return false; 140 return "Bad authentication";
139
140 return false;
141 } 141 }
142 } 142 }
143 143
@@ -145,13 +145,13 @@ namespace OpenSim.Services.GridService
145 { 145 {
146 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 146 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
147 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 147 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
148 return false; 148 return "Region overlaps another region";
149 } 149 }
150 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 150 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
151 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 151 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
152 { 152 {
153 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) 153 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0)
154 return false; 154 return "Can't move this region";
155 155
156 // Region reregistering in other coordinates. Delete the old entry 156 // Region reregistering in other coordinates. Delete the old entry
157 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 157 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
@@ -167,6 +167,23 @@ namespace OpenSim.Services.GridService
167 } 167 }
168 } 168 }
169 169
170 if (!m_AllowDuplicateNames)
171 {
172 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
173 if (dupe != null && dupe.Count > 0)
174 {
175 foreach (RegionData d in dupe)
176 {
177 if (d.RegionID != regionInfos.RegionID)
178 {
179 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
180 regionInfos.RegionName, regionInfos.RegionID);
181 return "Duplicate region name";
182 }
183 }
184 }
185 }
186
170 // Everything is ok, let's register 187 // Everything is ok, let's register
171 RegionData rdata = RegionInfo2RegionData(regionInfos); 188 RegionData rdata = RegionInfo2RegionData(regionInfos);
172 rdata.ScopeID = scopeID; 189 rdata.ScopeID = scopeID;
@@ -175,7 +192,7 @@ namespace OpenSim.Services.GridService
175 { 192 {
176 int oldFlags = Convert.ToInt32(region.Data["flags"]); 193 int oldFlags = Convert.ToInt32(region.Data["flags"]);
177 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) 194 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
178 return false; 195 return "Region locked out";
179 196
180 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; 197 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation;
181 198
@@ -211,7 +228,7 @@ namespace OpenSim.Services.GridService
211 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", 228 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
212 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 229 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
213 230
214 return true; 231 return String.Empty;
215 } 232 }
216 233
217 public bool DeregisterRegion(UUID regionID) 234 public bool DeregisterRegion(UUID regionID)