aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/GatekeeperService.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs34
1 files changed, 33 insertions, 1 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index ec7ef1d..a5bd881 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -112,6 +112,10 @@ namespace OpenSim.Services.HypergridService
112 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", regionName); 112 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", regionName);
113 if (!m_AllowTeleportsToAnyRegion) 113 if (!m_AllowTeleportsToAnyRegion)
114 { 114 {
115 List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);
116 if (defs != null && defs.Count > 0)
117 m_DefaultGatewayRegion = defs[0];
118
115 try 119 try
116 { 120 {
117 regionID = m_DefaultGatewayRegion.RegionID; 121 regionID = m_DefaultGatewayRegion.RegionID;
@@ -150,6 +154,8 @@ namespace OpenSim.Services.HypergridService
150 154
151 public GridRegion GetHyperlinkRegion(UUID regionID) 155 public GridRegion GetHyperlinkRegion(UUID regionID)
152 { 156 {
157 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get hyperlink region {0}", regionID);
158
153 if (!m_AllowTeleportsToAnyRegion) 159 if (!m_AllowTeleportsToAnyRegion)
154 // Don't even check the given regionID 160 // Don't even check the given regionID
155 return m_DefaultGatewayRegion; 161 return m_DefaultGatewayRegion;
@@ -160,23 +166,43 @@ namespace OpenSim.Services.HypergridService
160 166
161 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) 167 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination)
162 { 168 {
169 string authURL = string.Empty;
170 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
171 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
172
173 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}",
174 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName);
175
163 if (!Authenticate(aCircuit)) 176 if (!Authenticate(aCircuit))
177 {
178 m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname);
164 return false; 179 return false;
180 }
165 181
166 // Check to see if we have a local user with that UUID 182 // Check to see if we have a local user with that UUID
167 UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); 183 UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
168 if (account != null) 184 if (account != null)
185 {
169 // No, sorry; go away 186 // No, sorry; go away
187 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.",
188 aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID);
170 return false; 189 return false;
190 }
171 191
172 // May want to authorize 192 // May want to authorize
173 193
174 // Login the presence 194 // Login the presence
175 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) 195 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
196 {
197 m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.",
198 aCircuit.firstname, aCircuit.lastname);
176 return false; 199 return false;
200 }
177 201
178 // Finally launch the agent at the destination 202 // Finally launch the agent at the destination
179 string reason = string.Empty; 203 string reason = string.Empty;
204 aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
205 aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString();
180 return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); 206 return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason);
181 } 207 }
182 208
@@ -188,9 +214,15 @@ namespace OpenSim.Services.HypergridService
188 214
189 protected bool Authenticate(AgentCircuitData aCircuit) 215 protected bool Authenticate(AgentCircuitData aCircuit)
190 { 216 {
191 string authURL = string.Empty; // GetAuthURL(aCircuit); 217 string authURL = string.Empty;
218 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
219 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
220
192 if (authURL == string.Empty) 221 if (authURL == string.Empty)
222 {
223 m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL");
193 return false; 224 return false;
225 }
194 226
195 Object[] args = new Object[] { authURL }; 227 Object[] args = new Object[] { authURL };
196 IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); 228 IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args);