diff options
author | Melanie Thielker | 2010-05-05 23:06:36 +0200 |
---|---|---|
committer | Melanie | 2010-05-05 20:46:53 +0100 |
commit | fe8399d1bf6ed84435c41d495b04feb25fb9a988 (patch) | |
tree | c1e9ceee956f445134d64fbf2a41061f5e892bdb /OpenSim | |
parent | Removed a test for a "can't happen" case. ParentGroup is never null anymore. (diff) | |
download | opensim-SC_OLD-fe8399d1bf6ed84435c41d495b04feb25fb9a988.zip opensim-SC_OLD-fe8399d1bf6ed84435c41d495b04feb25fb9a988.tar.gz opensim-SC_OLD-fe8399d1bf6ed84435c41d495b04feb25fb9a988.tar.bz2 opensim-SC_OLD-fe8399d1bf6ed84435c41d495b04feb25fb9a988.tar.xz |
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.
Diffstat (limited to '')
4 files changed, 92 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index daf2704..83b3e31 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -99,6 +99,43 @@ namespace OpenSim.Server.Handlers.Login | |||
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) | ||
103 | { | ||
104 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
105 | |||
106 | if (requestData != null) | ||
107 | { | ||
108 | if (requestData.ContainsKey("first") && requestData["first"] != null && | ||
109 | requestData.ContainsKey("last") && requestData["last"] != null && | ||
110 | requestData.ContainsKey("level") && requestData["level"] != null && | ||
111 | requestData.ContainsKey("passwd") && requestData["passwd"] != null) | ||
112 | { | ||
113 | string first = requestData["first"].ToString(); | ||
114 | string last = requestData["last"].ToString(); | ||
115 | string passwd = requestData["passwd"].ToString(); | ||
116 | int level = Int32.Parse(requestData["level"].ToString()); | ||
117 | |||
118 | m_log.InfoFormat("[LOGIN]: XMLRPC Set Level to {2} Requested by {0} {1}", first, last, level); | ||
119 | |||
120 | Hashtable reply = m_LocalService.SetLevel(first, last, passwd, level, remoteClient); | ||
121 | |||
122 | XmlRpcResponse response = new XmlRpcResponse(); | ||
123 | response.Value = reply; | ||
124 | |||
125 | return response; | ||
126 | |||
127 | } | ||
128 | } | ||
129 | |||
130 | XmlRpcResponse failResponse = new XmlRpcResponse(); | ||
131 | Hashtable failHash = new Hashtable(); | ||
132 | failHash["success"] = "false"; | ||
133 | failResponse.Value = failHash; | ||
134 | |||
135 | return failResponse; | ||
136 | |||
137 | } | ||
138 | |||
102 | public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient) | 139 | public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient) |
103 | { | 140 | { |
104 | if (request.Type == OSDType.Map) | 141 | if (request.Type == OSDType.Map) |
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index e24055b..67e8392 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Server.Handlers.Login | |||
88 | { | 88 | { |
89 | LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); | 89 | LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); |
90 | server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); | 90 | server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); |
91 | server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); | ||
91 | server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); | 92 | server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); |
92 | } | 93 | } |
93 | 94 | ||
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs index 49efbe2..513ab4a 100644 --- a/OpenSim/Services/Interfaces/ILoginService.cs +++ b/OpenSim/Services/Interfaces/ILoginService.cs | |||
@@ -48,6 +48,7 @@ namespace OpenSim.Services.Interfaces | |||
48 | public interface ILoginService | 48 | public interface ILoginService |
49 | { | 49 | { |
50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP); | 50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP); |
51 | Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP); | ||
51 | } | 52 | } |
52 | 53 | ||
53 | 54 | ||
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 4d7dfd1..95127d2 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Net; | 31 | using System.Net; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -70,6 +71,7 @@ namespace OpenSim.Services.LLLoginService | |||
70 | private bool m_RequireInventory; | 71 | private bool m_RequireInventory; |
71 | protected int m_MinLoginLevel; | 72 | protected int m_MinLoginLevel; |
72 | private string m_GatekeeperURL; | 73 | private string m_GatekeeperURL; |
74 | private bool m_AllowRemoteSetLoginLevel; | ||
73 | 75 | ||
74 | IConfig m_LoginServerConfig; | 76 | IConfig m_LoginServerConfig; |
75 | 77 | ||
@@ -93,6 +95,8 @@ namespace OpenSim.Services.LLLoginService | |||
93 | m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty); | 95 | m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty); |
94 | m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); | 96 | m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); |
95 | m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true); | 97 | m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true); |
98 | m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false); | ||
99 | m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); | ||
96 | m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); | 100 | m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); |
97 | 101 | ||
98 | // These are required; the others aren't | 102 | // These are required; the others aren't |
@@ -147,6 +151,55 @@ namespace OpenSim.Services.LLLoginService | |||
147 | { | 151 | { |
148 | } | 152 | } |
149 | 153 | ||
154 | public Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP) | ||
155 | { | ||
156 | Hashtable response = new Hashtable(); | ||
157 | response["success"] = "false"; | ||
158 | |||
159 | if (!m_AllowRemoteSetLoginLevel) | ||
160 | return response; | ||
161 | |||
162 | try | ||
163 | { | ||
164 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | ||
165 | if (account == null) | ||
166 | { | ||
167 | m_log.InfoFormat("[LLOGIN SERVICE]: Set Level failed, user {0} {1} not found", firstName, lastName); | ||
168 | return response; | ||
169 | } | ||
170 | |||
171 | if (account.UserLevel < 200) | ||
172 | { | ||
173 | m_log.InfoFormat("[LLOGIN SERVICE]: Set Level failed, reason: user level too low"); | ||
174 | return response; | ||
175 | } | ||
176 | |||
177 | // | ||
178 | // Authenticate this user | ||
179 | // | ||
180 | // We don't support clear passwords here | ||
181 | // | ||
182 | string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30); | ||
183 | UUID secureSession = UUID.Zero; | ||
184 | if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) | ||
185 | { | ||
186 | m_log.InfoFormat("[LLOGIN SERVICE]: SetLevel failed, reason: authentication failed"); | ||
187 | return response; | ||
188 | } | ||
189 | } | ||
190 | catch (Exception e) | ||
191 | { | ||
192 | m_log.Error("[LLOGIN SERVICE]: SetLevel failed, exception " + e.ToString()); | ||
193 | return response; | ||
194 | } | ||
195 | |||
196 | m_MinLoginLevel = level; | ||
197 | m_log.InfoFormat("[LLOGIN SERVICE]: Login level set to {0} by {1} {2}", level, firstName, lastName); | ||
198 | |||
199 | response["success"] = true; | ||
200 | return response; | ||
201 | } | ||
202 | |||
150 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP) | 203 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP) |
151 | { | 204 | { |
152 | bool success = false; | 205 | bool success = false; |