diff options
-rw-r--r-- | OpenSim/Framework/Util.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Services/HypergridService/GatekeeperService.cs | 12 |
6 files changed, 48 insertions, 13 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index efaed62..5805dc8 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -2288,6 +2288,38 @@ namespace OpenSim.Framework | |||
2288 | { | 2288 | { |
2289 | return str.Replace("_", "\\_").Replace("%", "\\%"); | 2289 | return str.Replace("_", "\\_").Replace("%", "\\%"); |
2290 | } | 2290 | } |
2291 | |||
2292 | /// <summary> | ||
2293 | /// Returns the name of the user's viewer. | ||
2294 | /// </summary> | ||
2295 | /// <remarks> | ||
2296 | /// This method handles two ways that viewers specify their name: | ||
2297 | /// 1. Viewer = "Firestorm-Release 4.4.2.34167", Channel = "(don't care)" -> "Firestorm-Release 4.4.2.34167" | ||
2298 | /// 2. Viewer = "4.5.1.38838", Channel = "Firestorm-Beta" -> "Firestorm-Beta 4.5.1.38838" | ||
2299 | /// </remarks> | ||
2300 | public static string GetViewerName(AgentCircuitData agent) | ||
2301 | { | ||
2302 | string name = agent.Viewer; | ||
2303 | if (name == null) | ||
2304 | name = ""; | ||
2305 | else | ||
2306 | name = name.Trim(); | ||
2307 | |||
2308 | // Check if 'Viewer' is just a version number. If it's *not*, then we | ||
2309 | // assume that it contains the real viewer name, and we return it. | ||
2310 | foreach (char c in name) | ||
2311 | { | ||
2312 | if (Char.IsLetter(c)) | ||
2313 | return name; | ||
2314 | } | ||
2315 | |||
2316 | // The 'Viewer' string contains just a version number. If there's anything in | ||
2317 | // 'Channel' then assume that it's the viewer name. | ||
2318 | if ((agent.Channel != null) && (agent.Channel.Length > 0)) | ||
2319 | name = agent.Channel.Trim() + " " + name; | ||
2320 | |||
2321 | return name; | ||
2322 | } | ||
2291 | } | 2323 | } |
2292 | 2324 | ||
2293 | public class DoubleQueue<T> where T:class | 2325 | public class DoubleQueue<T> where T:class |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 6d3331b..5c3039d 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -982,7 +982,7 @@ namespace OpenSim | |||
982 | aCircuit.child ? "child" : "root", | 982 | aCircuit.child ? "child" : "root", |
983 | aCircuit.circuitcode.ToString(), | 983 | aCircuit.circuitcode.ToString(), |
984 | aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", | 984 | aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", |
985 | aCircuit.Viewer); | 985 | Util.GetViewerName(aCircuit)); |
986 | }); | 986 | }); |
987 | 987 | ||
988 | MainConsole.Instance.Output(cdt.ToString()); | 988 | MainConsole.Instance.Output(cdt.ToString()); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 08a2301..51f6c5e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3413,6 +3413,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3413 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport | 3413 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport |
3414 | 3414 | ||
3415 | // Don't disable this log message - it's too helpful | 3415 | // Don't disable this log message - it's too helpful |
3416 | string curViewer = Util.GetViewerName(acd); | ||
3416 | m_log.DebugFormat( | 3417 | m_log.DebugFormat( |
3417 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", | 3418 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", |
3418 | RegionInfo.RegionName, | 3419 | RegionInfo.RegionName, |
@@ -3422,7 +3423,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3422 | acd.AgentID, | 3423 | acd.AgentID, |
3423 | acd.circuitcode, | 3424 | acd.circuitcode, |
3424 | acd.IPAddress, | 3425 | acd.IPAddress, |
3425 | acd.Viewer, | 3426 | curViewer, |
3426 | ((TPFlags)teleportFlags).ToString(), | 3427 | ((TPFlags)teleportFlags).ToString(), |
3427 | acd.startpos | 3428 | acd.startpos |
3428 | ); | 3429 | ); |
@@ -3442,7 +3443,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3442 | { | 3443 | { |
3443 | foreach (string viewer in m_AllowedViewers) | 3444 | foreach (string viewer in m_AllowedViewers) |
3444 | { | 3445 | { |
3445 | if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) | 3446 | if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower()) |
3446 | { | 3447 | { |
3447 | ViewerDenied = false; | 3448 | ViewerDenied = false; |
3448 | break; | 3449 | break; |
@@ -3459,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3459 | { | 3460 | { |
3460 | foreach (string viewer in m_BannedViewers) | 3461 | foreach (string viewer in m_BannedViewers) |
3461 | { | 3462 | { |
3462 | if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) | 3463 | if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower()) |
3463 | { | 3464 | { |
3464 | ViewerDenied = true; | 3465 | ViewerDenied = true; |
3465 | break; | 3466 | break; |
@@ -3471,7 +3472,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3471 | { | 3472 | { |
3472 | m_log.DebugFormat( | 3473 | m_log.DebugFormat( |
3473 | "[SCENE]: Access denied for {0} {1} using {2}", | 3474 | "[SCENE]: Access denied for {0} {1} using {2}", |
3474 | acd.firstname, acd.lastname, acd.Viewer); | 3475 | acd.firstname, acd.lastname, curViewer); |
3475 | reason = "Access denied, your viewer is banned by the region owner"; | 3476 | reason = "Access denied, your viewer is banned by the region owner"; |
3476 | return false; | 3477 | return false; |
3477 | } | 3478 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 491d0bf..64c464d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
848 | 848 | ||
849 | public string Viewer | 849 | public string Viewer |
850 | { | 850 | { |
851 | get { return m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode).Viewer; } | 851 | get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); } |
852 | } | 852 | } |
853 | 853 | ||
854 | #endregion | 854 | #endregion |
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index ec18db0..44d4e93 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -669,7 +669,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
669 | aCircuit = new AgentCircuitData(); | 669 | aCircuit = new AgentCircuitData(); |
670 | 670 | ||
671 | if (!llClient.SceneAgent.IsChildAgent) | 671 | if (!llClient.SceneAgent.IsChildAgent) |
672 | m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, aCircuit.Viewer, aCircuit.Id0); | 672 | m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0); |
673 | 673 | ||
674 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); | 674 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); |
675 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); | 675 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); |
@@ -706,4 +706,4 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
706 | m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum); | 706 | m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum); |
707 | } | 707 | } |
708 | } | 708 | } |
709 | } \ No newline at end of file | 709 | } |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index f6136b5..7a0228b 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -228,17 +228,19 @@ namespace OpenSim.Services.HypergridService | |||
228 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, | 228 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, |
229 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); | 229 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); |
230 | 230 | ||
231 | string curViewer = Util.GetViewerName(aCircuit); | ||
232 | |||
231 | // | 233 | // |
232 | // Check client | 234 | // Check client |
233 | // | 235 | // |
234 | if (m_AllowedClients != string.Empty) | 236 | if (m_AllowedClients != string.Empty) |
235 | { | 237 | { |
236 | Regex arx = new Regex(m_AllowedClients); | 238 | Regex arx = new Regex(m_AllowedClients); |
237 | Match am = arx.Match(aCircuit.Viewer); | 239 | Match am = arx.Match(curViewer); |
238 | 240 | ||
239 | if (!am.Success) | 241 | if (!am.Success) |
240 | { | 242 | { |
241 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", aCircuit.Viewer); | 243 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer); |
242 | return false; | 244 | return false; |
243 | } | 245 | } |
244 | } | 246 | } |
@@ -246,11 +248,11 @@ namespace OpenSim.Services.HypergridService | |||
246 | if (m_DeniedClients != string.Empty) | 248 | if (m_DeniedClients != string.Empty) |
247 | { | 249 | { |
248 | Regex drx = new Regex(m_DeniedClients); | 250 | Regex drx = new Regex(m_DeniedClients); |
249 | Match dm = drx.Match(aCircuit.Viewer); | 251 | Match dm = drx.Match(curViewer); |
250 | 252 | ||
251 | if (dm.Success) | 253 | if (dm.Success) |
252 | { | 254 | { |
253 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", aCircuit.Viewer); | 255 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer); |
254 | return false; | 256 | return false; |
255 | } | 257 | } |
256 | } | 258 | } |