mantis 8396: on access control, change viewer string to match so it does include the viewer name, not just version

0.9.1.0-post-fixes
UbitUmarov 2018-11-09 15:22:15 +00:00
parent 492b9e3326
commit f9a2fbed83
1 changed files with 10 additions and 4 deletions

View File

@ -301,16 +301,22 @@ namespace OpenSim.Services.LLLoginService
// //
// Check client // Check client
// //
string clientNameToCheck;
if(clientVersion.Contains(" "))
clientNameToCheck = clientVersion;
else
clientNameToCheck = channel + " " + clientVersion;
if (!String.IsNullOrWhiteSpace(m_AllowedClients)) if (!String.IsNullOrWhiteSpace(m_AllowedClients))
{ {
Regex arx = new Regex(m_AllowedClients); Regex arx = new Regex(m_AllowedClients);
Match am = arx.Match(clientVersion); Match am = arx.Match(clientNameToCheck);
if (!am.Success) if (!am.Success)
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is not allowed", "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is not allowed",
firstName, lastName, clientVersion); firstName, lastName, clientNameToCheck);
return LLFailedLoginResponse.LoginBlockedProblem; return LLFailedLoginResponse.LoginBlockedProblem;
} }
} }
@ -318,13 +324,13 @@ namespace OpenSim.Services.LLLoginService
if (!String.IsNullOrWhiteSpace(m_DeniedClients)) if (!String.IsNullOrWhiteSpace(m_DeniedClients))
{ {
Regex drx = new Regex(m_DeniedClients); Regex drx = new Regex(m_DeniedClients);
Match dm = drx.Match(clientVersion); Match dm = drx.Match(clientNameToCheck);
if (dm.Success) if (dm.Success)
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is denied", "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is denied",
firstName, lastName, clientVersion); firstName, lastName, clientNameToCheck);
return LLFailedLoginResponse.LoginBlockedProblem; return LLFailedLoginResponse.LoginBlockedProblem;
} }
} }