diff options
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9950534..cd23efb 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -69,6 +69,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
69 | private string m_name = "RemoteAdminPlugin"; | 69 | private string m_name = "RemoteAdminPlugin"; |
70 | private string m_version = "0.0"; | 70 | private string m_version = "0.0"; |
71 | 71 | ||
72 | //AnakinLohner 0.6.5-post-fixes | ||
73 | //guard for XmlRpc-related methods | ||
74 | private void FailIfRemoteAdminDisabled(string requestName) | ||
75 | { | ||
76 | if (m_config == null) | ||
77 | { | ||
78 | string errorMessage = String.Format("[RADMIN] {0}: Remote admin request denied! Please set [RemoteAdmin]enabled=true in OpenSim.ini in order to enable remote admin functionality", requestName); | ||
79 | m_log.Error(errorMessage); | ||
80 | throw new ApplicationException(errorMessage); | ||
81 | } | ||
82 | } | ||
83 | |||
72 | public string Version | 84 | public string Version |
73 | { | 85 | { |
74 | get { return m_version; } | 86 | get { return m_version; } |
@@ -453,6 +465,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
453 | public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 465 | public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
454 | { | 466 | { |
455 | m_log.Info("[RADMIN]: CreateRegion: new request"); | 467 | m_log.Info("[RADMIN]: CreateRegion: new request"); |
468 | |||
469 | //AnakinLohner 0.6.5-post-fixes | ||
470 | FailIfRemoteAdminDisabled("CreateRegion"); | ||
471 | |||
456 | XmlRpcResponse response = new XmlRpcResponse(); | 472 | XmlRpcResponse response = new XmlRpcResponse(); |
457 | Hashtable responseData = new Hashtable(); | 473 | Hashtable responseData = new Hashtable(); |
458 | 474 | ||
@@ -969,6 +985,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
969 | public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 985 | public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
970 | { | 986 | { |
971 | m_log.Info("[RADMIN]: CreateUser: new request"); | 987 | m_log.Info("[RADMIN]: CreateUser: new request"); |
988 | |||
989 | //AnakinLohner 0.6.5-post-fixes | ||
990 | FailIfRemoteAdminDisabled("CreateUser"); | ||
991 | |||
972 | XmlRpcResponse response = new XmlRpcResponse(); | 992 | XmlRpcResponse response = new XmlRpcResponse(); |
973 | Hashtable responseData = new Hashtable(); | 993 | Hashtable responseData = new Hashtable(); |
974 | 994 | ||
@@ -1077,6 +1097,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1077 | public XmlRpcResponse XmlRpcUserExistsMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 1097 | public XmlRpcResponse XmlRpcUserExistsMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
1078 | { | 1098 | { |
1079 | m_log.Info("[RADMIN]: UserExists: new request"); | 1099 | m_log.Info("[RADMIN]: UserExists: new request"); |
1100 | |||
1101 | //AnakinLohner 0.6.5-post-fixes | ||
1102 | FailIfRemoteAdminDisabled("UserExists"); | ||
1103 | |||
1080 | XmlRpcResponse response = new XmlRpcResponse(); | 1104 | XmlRpcResponse response = new XmlRpcResponse(); |
1081 | Hashtable responseData = new Hashtable(); | 1105 | Hashtable responseData = new Hashtable(); |
1082 | 1106 | ||
@@ -1517,7 +1541,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1517 | try | 1541 | try |
1518 | { | 1542 | { |
1519 | 1543 | ||
1520 | string dafn = m_config.GetString("default_appearance", "default_appearance.xml"); | 1544 | string dafn = null; |
1545 | |||
1546 | //AnakinLohner 0.6.5-post-fixes | ||
1547 | //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini | ||
1548 | if (m_config != null) | ||
1549 | { | ||
1550 | dafn = m_config.GetString("default_appearance", "default_appearance.xml"); | ||
1551 | } | ||
1521 | 1552 | ||
1522 | if (File.Exists(dafn)) | 1553 | if (File.Exists(dafn)) |
1523 | { | 1554 | { |
@@ -1824,6 +1855,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1824 | public XmlRpcResponse XmlRpcLoadOARMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 1855 | public XmlRpcResponse XmlRpcLoadOARMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
1825 | { | 1856 | { |
1826 | m_log.Info("[RADMIN]: Received Load OAR Administrator Request"); | 1857 | m_log.Info("[RADMIN]: Received Load OAR Administrator Request"); |
1858 | |||
1859 | //AnakinLohner 0.6.5-post-fixes | ||
1860 | FailIfRemoteAdminDisabled("Load OAR"); | ||
1861 | |||
1827 | XmlRpcResponse response = new XmlRpcResponse(); | 1862 | XmlRpcResponse response = new XmlRpcResponse(); |
1828 | Hashtable responseData = new Hashtable(); | 1863 | Hashtable responseData = new Hashtable(); |
1829 | 1864 | ||
@@ -1923,6 +1958,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1923 | public XmlRpcResponse XmlRpcSaveOARMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 1958 | public XmlRpcResponse XmlRpcSaveOARMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
1924 | { | 1959 | { |
1925 | m_log.Info("[RADMIN]: Received Save OAR Administrator Request"); | 1960 | m_log.Info("[RADMIN]: Received Save OAR Administrator Request"); |
1961 | |||
1962 | //AnakinLohner 0.6.5-post-fixes | ||
1963 | FailIfRemoteAdminDisabled("Save OAR"); | ||
1964 | |||
1926 | XmlRpcResponse response = new XmlRpcResponse(); | 1965 | XmlRpcResponse response = new XmlRpcResponse(); |
1927 | Hashtable responseData = new Hashtable(); | 1966 | Hashtable responseData = new Hashtable(); |
1928 | 1967 | ||
@@ -2002,6 +2041,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2002 | public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 2041 | public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
2003 | { | 2042 | { |
2004 | m_log.Info("[RADMIN]: Received Load XML Administrator Request"); | 2043 | m_log.Info("[RADMIN]: Received Load XML Administrator Request"); |
2044 | |||
2045 | //AnakinLohner 0.6.5-post-fixes | ||
2046 | FailIfRemoteAdminDisabled("Load XML"); | ||
2047 | |||
2005 | XmlRpcResponse response = new XmlRpcResponse(); | 2048 | XmlRpcResponse response = new XmlRpcResponse(); |
2006 | Hashtable responseData = new Hashtable(); | 2049 | Hashtable responseData = new Hashtable(); |
2007 | 2050 | ||
@@ -2087,6 +2130,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2087 | public XmlRpcResponse XmlRpcSaveXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 2130 | public XmlRpcResponse XmlRpcSaveXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
2088 | { | 2131 | { |
2089 | m_log.Info("[RADMIN]: Received Save XML Administrator Request"); | 2132 | m_log.Info("[RADMIN]: Received Save XML Administrator Request"); |
2133 | |||
2134 | //AnakinLohner 0.6.5-post-fixes | ||
2135 | FailIfRemoteAdminDisabled("Save XML"); | ||
2136 | |||
2090 | XmlRpcResponse response = new XmlRpcResponse(); | 2137 | XmlRpcResponse response = new XmlRpcResponse(); |
2091 | Hashtable responseData = new Hashtable(); | 2138 | Hashtable responseData = new Hashtable(); |
2092 | 2139 | ||
@@ -2169,6 +2216,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2169 | public XmlRpcResponse XmlRpcRegionQueryMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 2216 | public XmlRpcResponse XmlRpcRegionQueryMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
2170 | { | 2217 | { |
2171 | m_log.Info("[RADMIN]: Received Query XML Administrator Request"); | 2218 | m_log.Info("[RADMIN]: Received Query XML Administrator Request"); |
2219 | |||
2220 | //AnakinLohner 0.6.5-post-fixes | ||
2221 | FailIfRemoteAdminDisabled("Query XML"); | ||
2222 | |||
2172 | XmlRpcResponse response = new XmlRpcResponse(); | 2223 | XmlRpcResponse response = new XmlRpcResponse(); |
2173 | Hashtable responseData = new Hashtable(); | 2224 | Hashtable responseData = new Hashtable(); |
2174 | 2225 | ||
@@ -2225,6 +2276,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2225 | public XmlRpcResponse XmlRpcConsoleCommandMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 2276 | public XmlRpcResponse XmlRpcConsoleCommandMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
2226 | { | 2277 | { |
2227 | m_log.Info("[RADMIN]: Received Command XML Administrator Request"); | 2278 | m_log.Info("[RADMIN]: Received Command XML Administrator Request"); |
2279 | |||
2280 | //AnakinLohner 0.6.5-post-fixes | ||
2281 | FailIfRemoteAdminDisabled("Command XML"); | ||
2282 | |||
2228 | XmlRpcResponse response = new XmlRpcResponse(); | 2283 | XmlRpcResponse response = new XmlRpcResponse(); |
2229 | Hashtable responseData = new Hashtable(); | 2284 | Hashtable responseData = new Hashtable(); |
2230 | 2285 | ||
@@ -2264,6 +2319,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2264 | { | 2319 | { |
2265 | 2320 | ||
2266 | m_log.Info("[RADMIN]: Received Access List Clear Request"); | 2321 | m_log.Info("[RADMIN]: Received Access List Clear Request"); |
2322 | |||
2323 | //AnakinLohner 0.6.5-post-fixes | ||
2324 | FailIfRemoteAdminDisabled("Access List Clear"); | ||
2325 | |||
2267 | XmlRpcResponse response = new XmlRpcResponse(); | 2326 | XmlRpcResponse response = new XmlRpcResponse(); |
2268 | Hashtable responseData = new Hashtable(); | 2327 | Hashtable responseData = new Hashtable(); |
2269 | 2328 | ||
@@ -2321,6 +2380,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2321 | { | 2380 | { |
2322 | 2381 | ||
2323 | m_log.Info("[RADMIN]: Received Access List Add Request"); | 2382 | m_log.Info("[RADMIN]: Received Access List Add Request"); |
2383 | |||
2384 | //AnakinLohner 0.6.5-post-fixes | ||
2385 | FailIfRemoteAdminDisabled("Access List Add"); | ||
2386 | |||
2324 | XmlRpcResponse response = new XmlRpcResponse(); | 2387 | XmlRpcResponse response = new XmlRpcResponse(); |
2325 | Hashtable responseData = new Hashtable(); | 2388 | Hashtable responseData = new Hashtable(); |
2326 | 2389 | ||
@@ -2407,6 +2470,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2407 | { | 2470 | { |
2408 | 2471 | ||
2409 | m_log.Info("[RADMIN]: Received Access List Remove Request"); | 2472 | m_log.Info("[RADMIN]: Received Access List Remove Request"); |
2473 | |||
2474 | //AnakinLohner 0.6.5-post-fixes | ||
2475 | FailIfRemoteAdminDisabled("Access List Remove"); | ||
2476 | |||
2410 | XmlRpcResponse response = new XmlRpcResponse(); | 2477 | XmlRpcResponse response = new XmlRpcResponse(); |
2411 | Hashtable responseData = new Hashtable(); | 2478 | Hashtable responseData = new Hashtable(); |
2412 | 2479 | ||
@@ -2492,6 +2559,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2492 | { | 2559 | { |
2493 | 2560 | ||
2494 | m_log.Info("[RADMIN]: Received Access List List Request"); | 2561 | m_log.Info("[RADMIN]: Received Access List List Request"); |
2562 | |||
2563 | //AnakinLohner 0.6.5-post-fixes | ||
2564 | FailIfRemoteAdminDisabled("Access List List"); | ||
2565 | |||
2495 | XmlRpcResponse response = new XmlRpcResponse(); | 2566 | XmlRpcResponse response = new XmlRpcResponse(); |
2496 | Hashtable responseData = new Hashtable(); | 2567 | Hashtable responseData = new Hashtable(); |
2497 | 2568 | ||