diff options
author | Charles Krinke | 2009-01-10 04:16:06 +0000 |
---|---|---|
committer | Charles Krinke | 2009-01-10 04:16:06 +0000 |
commit | 5e87e49570aa35275e2485937e76128ed930ec0d (patch) | |
tree | 9d352253000c8fd3205d5ffae75c041f99cf873d /OpenSim | |
parent | Thanks jhurliman for a patch that implements progressive texture downloading ... (diff) | |
download | opensim-SC-5e87e49570aa35275e2485937e76128ed930ec0d.zip opensim-SC-5e87e49570aa35275e2485937e76128ed930ec0d.tar.gz opensim-SC-5e87e49570aa35275e2485937e76128ed930ec0d.tar.bz2 opensim-SC-5e87e49570aa35275e2485937e76128ed930ec0d.tar.xz |
Thank you kindly, StrawberryFride for a patch that:
Enable users to enable only selected methods out of the
available set of remote methods to restrict remote
functionality to less harmful methods, such as
admin_broadcast, or admin_region_query.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 4645ee6..d9cf5bd 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework.Servers; | |||
40 | using OpenSim.Region.Environment.Interfaces; | 40 | using OpenSim.Region.Environment.Interfaces; |
41 | using OpenSim.Region.Environment.Modules.World.Terrain; | 41 | using OpenSim.Region.Environment.Modules.World.Terrain; |
42 | using OpenSim.Region.Environment.Scenes; | 42 | using OpenSim.Region.Environment.Scenes; |
43 | using System.Collections.Generic; | ||
43 | 44 | ||
44 | namespace OpenSim.ApplicationPlugins.RemoteController | 45 | namespace OpenSim.ApplicationPlugins.RemoteController |
45 | { | 46 | { |
@@ -84,24 +85,44 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
84 | requiredPassword = m_config.GetString("access_password", String.Empty); | 85 | requiredPassword = m_config.GetString("access_password", String.Empty); |
85 | 86 | ||
86 | m_app = openSim; | 87 | m_app = openSim; |
87 | m_httpd = openSim.HttpServer; | 88 | m_httpd = openSim.HttpServer; |
88 | 89 | ||
89 | m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod, false); | 90 | Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>(); |
90 | m_httpd.AddXmlRPCHandler("admin_delete_region", XmlRpcDeleteRegionMethod, false); | 91 | availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; |
91 | m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod, false); | 92 | availableMethods["admin_delete_region"] = XmlRpcDeleteRegionMethod; |
92 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod, false); | 93 | availableMethods["admin_shutdown"] = XmlRpcShutdownMethod; |
93 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod, false); | 94 | availableMethods["admin_broadcast"] = XmlRpcAlertMethod; |
94 | m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod, false); | 95 | availableMethods["admin_restart"] = XmlRpcRestartMethod; |
95 | m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod, false); | 96 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; |
96 | //This handler creates a user with a email, | 97 | availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; |
97 | m_httpd.AddXmlRPCHandler("admin_create_user_email", XmlRpcCreateUserMethodEmail, false); | 98 | availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethodEmail; |
98 | m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod, false); | 99 | availableMethods["admin_exists_user"] = XmlRpcUserExistsMethod; |
99 | m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod, false); | 100 | availableMethods["admin_update_user"] = XmlRpcUpdateUserAccountMethod; |
100 | m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod, false); | 101 | availableMethods["admin_load_xml"] = XmlRpcLoadXMLMethod; |
101 | m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod, false); | 102 | availableMethods["admin_save_xml"] = XmlRpcSaveXMLMethod; |
102 | m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod, false); | 103 | availableMethods["admin_load_oar"] = XmlRpcLoadOARMethod; |
103 | m_httpd.AddXmlRPCHandler("admin_save_oar", XmlRpcSaveOARMethod, false); | 104 | availableMethods["admin_save_oar"] = XmlRpcSaveOARMethod; |
104 | m_httpd.AddXmlRPCHandler("admin_region_query", XmlRpcRegionQueryMethod, false); | 105 | availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod; |
106 | |||
107 | // Either enable full remote functionality or just selected features | ||
108 | string enabledMethods = m_config.GetString("enabled_methods", "all"); | ||
109 | |||
110 | // The assumption here is that simply enabling Remote Admin as before will produce the same | ||
111 | // behavior - enable all methods unless the whitelist is in place for backward-compatibility. | ||
112 | if (enabledMethods.ToLower() == "all" || String.IsNullOrEmpty(enabledMethods)) | ||
113 | { | ||
114 | foreach (string method in availableMethods.Keys) | ||
115 | { | ||
116 | m_httpd.AddXmlRPCHandler(method, availableMethods[method]); | ||
117 | } | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | foreach (string enabledMethod in enabledMethods.Split('|')) | ||
122 | { | ||
123 | m_httpd.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]); | ||
124 | } | ||
125 | } | ||
105 | } | 126 | } |
106 | } | 127 | } |
107 | catch (NullReferenceException) | 128 | catch (NullReferenceException) |
@@ -871,8 +892,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
871 | m_log.ErrorFormat("[RADMIN] UserExists: failed: {0}", e.Message); | 892 | m_log.ErrorFormat("[RADMIN] UserExists: failed: {0}", e.Message); |
872 | m_log.DebugFormat("[RADMIN] UserExists: failed: {0}", e.ToString()); | 893 | m_log.DebugFormat("[RADMIN] UserExists: failed: {0}", e.ToString()); |
873 | 894 | ||
874 | responseData["success"] = "false"; | 895 | responseData["success"] = "false"; |
875 | responseData["error"] = e.Message; | 896 | responseData["error"] = e.Message; |
876 | 897 | ||
877 | response.Value = responseData; | 898 | response.Value = responseData; |
878 | } | 899 | } |
@@ -987,7 +1008,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
987 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) | 1008 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) |
988 | throw new Exception("did not manage to update user profile"); | 1009 | throw new Exception("did not manage to update user profile"); |
989 | 1010 | ||
990 | responseData["success"] = "true"; | 1011 | responseData["success"] = "true"; |
991 | 1012 | ||
992 | response.Value = responseData; | 1013 | response.Value = responseData; |
993 | 1014 | ||
@@ -999,8 +1020,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
999 | m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); | 1020 | m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); |
1000 | m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); | 1021 | m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); |
1001 | 1022 | ||
1002 | responseData["success"] = "false"; | 1023 | responseData["success"] = "false"; |
1003 | responseData["error"] = e.Message; | 1024 | responseData["error"] = e.Message; |
1004 | 1025 | ||
1005 | response.Value = responseData; | 1026 | response.Value = responseData; |
1006 | } | 1027 | } |
@@ -1088,19 +1109,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1088 | else | 1109 | else |
1089 | throw new Exception("Archiver module not present for scene"); | 1110 | throw new Exception("Archiver module not present for scene"); |
1090 | 1111 | ||
1091 | responseData["loaded"] = "true"; | 1112 | responseData["loaded"] = "true"; |
1092 | 1113 | ||
1093 | response.Value = responseData; | 1114 | response.Value = responseData; |
1094 | } | 1115 | } |
1095 | catch (Exception e) | 1116 | catch (Exception e) |
1096 | { | 1117 | { |
1097 | m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message); | 1118 | m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message); |
1098 | m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString()); | 1119 | m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString()); |
1099 | 1120 | ||
1100 | responseData["loaded"] = "false"; | 1121 | responseData["loaded"] = "false"; |
1101 | responseData["error"] = e.Message; | 1122 | responseData["error"] = e.Message; |
1102 | 1123 | ||
1103 | response.Value = responseData; | 1124 | response.Value = responseData; |
1104 | } | 1125 | } |
1105 | 1126 | ||
1106 | return response; | 1127 | return response; |
@@ -1184,19 +1205,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1184 | else | 1205 | else |
1185 | throw new Exception("Archiver module not present for scene"); | 1206 | throw new Exception("Archiver module not present for scene"); |
1186 | 1207 | ||
1187 | responseData["saved"] = "true"; | 1208 | responseData["saved"] = "true"; |
1188 | 1209 | ||
1189 | response.Value = responseData; | 1210 | response.Value = responseData; |
1190 | } | 1211 | } |
1191 | catch (Exception e) | 1212 | catch (Exception e) |
1192 | { | 1213 | { |
1193 | m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message); | 1214 | m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message); |
1194 | m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString()); | 1215 | m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString()); |
1195 | 1216 | ||
1196 | responseData["saved"] = "false"; | 1217 | responseData["saved"] = "false"; |
1197 | responseData["error"] = e.Message; | 1218 | responseData["error"] = e.Message; |
1198 | 1219 | ||
1199 | response.Value = responseData; | 1220 | response.Value = responseData; |
1200 | } | 1221 | } |
1201 | 1222 | ||
1202 | return response; | 1223 | return response; |
@@ -1266,8 +1287,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1266 | throw new Exception(String.Format("unknown Xml{0} format", xml_version)); | 1287 | throw new Exception(String.Format("unknown Xml{0} format", xml_version)); |
1267 | } | 1288 | } |
1268 | 1289 | ||
1269 | responseData["loaded"] = "true"; | 1290 | responseData["loaded"] = "true"; |
1270 | response.Value = responseData; | 1291 | response.Value = responseData; |
1271 | } | 1292 | } |
1272 | catch (Exception e) | 1293 | catch (Exception e) |
1273 | { | 1294 | { |
@@ -1276,9 +1297,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1276 | 1297 | ||
1277 | responseData["loaded"] = "false"; | 1298 | responseData["loaded"] = "false"; |
1278 | responseData["switched"] = "false"; | 1299 | responseData["switched"] = "false"; |
1279 | responseData["error"] = e.Message; | 1300 | responseData["error"] = e.Message; |
1280 | 1301 | ||
1281 | response.Value = responseData; | 1302 | response.Value = responseData; |
1282 | } | 1303 | } |
1283 | 1304 | ||
1284 | return response; | 1305 | return response; |
@@ -1354,10 +1375,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1354 | } | 1375 | } |
1355 | catch (Exception e) | 1376 | catch (Exception e) |
1356 | { | 1377 | { |
1357 | m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); | 1378 | m_log.InfoFormat("[RADMIN] SaveXml: {0}", e.Message); |
1358 | m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); | 1379 | m_log.DebugFormat("[RADMIN] SaveXml: {0}", e.ToString()); |
1359 | 1380 | ||
1360 | responseData["loaded"] = "false"; | 1381 | responseData["saved"] = "false"; |
1361 | responseData["switched"] = "false"; | 1382 | responseData["switched"] = "false"; |
1362 | responseData["error"] = e.Message; | 1383 | responseData["error"] = e.Message; |
1363 | 1384 | ||