Add a XMLRPC method to remotely set the login level for the LLLoginService.
This requires a special XMLRPC call, which has to supply the credentials of a god user (User level >= 200). Disabled by default. Also Adds a configuration option to set the initial permitted login level.slimupdates2
parent
7aed89a8d0
commit
fe8399d1bf
|
@ -99,6 +99,43 @@ namespace OpenSim.Server.Handlers.Login
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
|
||||||
|
if (requestData != null)
|
||||||
|
{
|
||||||
|
if (requestData.ContainsKey("first") && requestData["first"] != null &&
|
||||||
|
requestData.ContainsKey("last") && requestData["last"] != null &&
|
||||||
|
requestData.ContainsKey("level") && requestData["level"] != null &&
|
||||||
|
requestData.ContainsKey("passwd") && requestData["passwd"] != null)
|
||||||
|
{
|
||||||
|
string first = requestData["first"].ToString();
|
||||||
|
string last = requestData["last"].ToString();
|
||||||
|
string passwd = requestData["passwd"].ToString();
|
||||||
|
int level = Int32.Parse(requestData["level"].ToString());
|
||||||
|
|
||||||
|
m_log.InfoFormat("[LOGIN]: XMLRPC Set Level to {2} Requested by {0} {1}", first, last, level);
|
||||||
|
|
||||||
|
Hashtable reply = m_LocalService.SetLevel(first, last, passwd, level, remoteClient);
|
||||||
|
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
response.Value = reply;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlRpcResponse failResponse = new XmlRpcResponse();
|
||||||
|
Hashtable failHash = new Hashtable();
|
||||||
|
failHash["success"] = "false";
|
||||||
|
failResponse.Value = failHash;
|
||||||
|
|
||||||
|
return failResponse;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient)
|
public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
if (request.Type == OSDType.Map)
|
if (request.Type == OSDType.Map)
|
||||||
|
|
|
@ -88,6 +88,7 @@ namespace OpenSim.Server.Handlers.Login
|
||||||
{
|
{
|
||||||
LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService);
|
LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService);
|
||||||
server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
|
server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
|
||||||
|
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
|
||||||
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
|
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
public interface ILoginService
|
public interface ILoginService
|
||||||
{
|
{
|
||||||
LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP);
|
LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP);
|
||||||
|
Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -70,6 +71,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
private bool m_RequireInventory;
|
private bool m_RequireInventory;
|
||||||
protected int m_MinLoginLevel;
|
protected int m_MinLoginLevel;
|
||||||
private string m_GatekeeperURL;
|
private string m_GatekeeperURL;
|
||||||
|
private bool m_AllowRemoteSetLoginLevel;
|
||||||
|
|
||||||
IConfig m_LoginServerConfig;
|
IConfig m_LoginServerConfig;
|
||||||
|
|
||||||
|
@ -93,6 +95,8 @@ namespace OpenSim.Services.LLLoginService
|
||||||
m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
|
m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
|
||||||
m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
||||||
m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
|
m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
|
||||||
|
m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
|
||||||
|
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
|
||||||
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
|
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
|
||||||
|
|
||||||
// These are required; the others aren't
|
// These are required; the others aren't
|
||||||
|
@ -147,6 +151,55 @@ namespace OpenSim.Services.LLLoginService
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP)
|
||||||
|
{
|
||||||
|
Hashtable response = new Hashtable();
|
||||||
|
response["success"] = "false";
|
||||||
|
|
||||||
|
if (!m_AllowRemoteSetLoginLevel)
|
||||||
|
return response;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[LLOGIN SERVICE]: Set Level failed, user {0} {1} not found", firstName, lastName);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (account.UserLevel < 200)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[LLOGIN SERVICE]: Set Level failed, reason: user level too low");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Authenticate this user
|
||||||
|
//
|
||||||
|
// We don't support clear passwords here
|
||||||
|
//
|
||||||
|
string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30);
|
||||||
|
UUID secureSession = UUID.Zero;
|
||||||
|
if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession)))
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[LLOGIN SERVICE]: SetLevel failed, reason: authentication failed");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[LLOGIN SERVICE]: SetLevel failed, exception " + e.ToString());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_MinLoginLevel = level;
|
||||||
|
m_log.InfoFormat("[LLOGIN SERVICE]: Login level set to {0} by {1} {2}", level, firstName, lastName);
|
||||||
|
|
||||||
|
response["success"] = true;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP)
|
public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
|
@ -126,6 +126,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
|
FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
|
||||||
|
|
||||||
WelcomeMessage = "Welcome, Avatar!"
|
WelcomeMessage = "Welcome, Avatar!"
|
||||||
|
AllowRemoteSetLoginLevel = "false";
|
||||||
|
|
||||||
|
|
||||||
[GridInfoService]
|
[GridInfoService]
|
||||||
|
|
Loading…
Reference in New Issue