diff options
author | Melanie | 2011-10-12 07:09:04 +0100 |
---|---|---|
committer | Melanie | 2011-10-12 07:09:04 +0100 |
commit | 2c23fc9e6818ff22845ac5ecb32732a4240f54c0 (patch) | |
tree | 9c9fb52da0cb6a29513f42e605e468875b4da5a2 /OpenSim | |
parent | Merge commit 'ff80113534182bbcbcb49a73035776134fb04e3e' into bigmerge (diff) | |
parent | Add option to allow only explicitly listed IPs to access RemoteAdmin facilities. (diff) | |
download | opensim-SC-2c23fc9e6818ff22845ac5ecb32732a4240f54c0.zip opensim-SC-2c23fc9e6818ff22845ac5ecb32732a4240f54c0.tar.gz opensim-SC-2c23fc9e6818ff22845ac5ecb32732a4240f54c0.tar.bz2 opensim-SC-2c23fc9e6818ff22845ac5ecb32732a4240f54c0.tar.xz |
Merge commit '4073cd6ced525cb36e4335e79e3f94ad4872b263' into bigmerge
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 240 |
1 files changed, 116 insertions, 124 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 76ff68b..ba461f0 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -67,21 +67,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
67 | private IConfig m_config; | 67 | private IConfig m_config; |
68 | private IConfigSource m_configSource; | 68 | private IConfigSource m_configSource; |
69 | private string m_requiredPassword = String.Empty; | 69 | private string m_requiredPassword = String.Empty; |
70 | private List<string> m_accessIP; | ||
70 | 71 | ||
71 | private string m_name = "RemoteAdminPlugin"; | 72 | private string m_name = "RemoteAdminPlugin"; |
72 | private string m_version = "0.0"; | 73 | private string m_version = "0.0"; |
73 | 74 | ||
74 | //guard for XmlRpc-related methods | ||
75 | private void FailIfRemoteAdminDisabled(string requestName) | ||
76 | { | ||
77 | if (m_config == null) | ||
78 | { | ||
79 | 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); | ||
80 | m_log.Error(errorMessage); | ||
81 | throw new ApplicationException(errorMessage); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | public string Version | 75 | public string Version |
86 | { | 76 | { |
87 | get { return m_version; } | 77 | get { return m_version; } |
@@ -115,6 +105,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
115 | m_requiredPassword = m_config.GetString("access_password", String.Empty); | 105 | m_requiredPassword = m_config.GetString("access_password", String.Empty); |
116 | int port = m_config.GetInt("port", 0); | 106 | int port = m_config.GetInt("port", 0); |
117 | 107 | ||
108 | string accessIP = m_config.GetString("access_ip_addresses", String.Empty); | ||
109 | m_accessIP = new List<string>(); | ||
110 | if (accessIP != String.Empty) | ||
111 | { | ||
112 | string[] ips = accessIP.Split(new char[] { ',' }); | ||
113 | foreach (string ip in ips) | ||
114 | { | ||
115 | string current = ip.Trim(); | ||
116 | |||
117 | if (current != String.Empty) | ||
118 | m_accessIP.Add(current); | ||
119 | } | ||
120 | } | ||
121 | |||
118 | m_application = openSim; | 122 | m_application = openSim; |
119 | string bind_ip_address = m_config.GetString("bind_ip_address", "0.0.0.0"); | 123 | string bind_ip_address = m_config.GetString("bind_ip_address", "0.0.0.0"); |
120 | IPAddress ipaddr = IPAddress.Parse(bind_ip_address); | 124 | IPAddress ipaddr = IPAddress.Parse(bind_ip_address); |
@@ -190,6 +194,31 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
190 | } | 194 | } |
191 | } | 195 | } |
192 | 196 | ||
197 | private void FailIfRemoteAdminDisabled(string requestName) | ||
198 | { | ||
199 | if (m_config == null) | ||
200 | { | ||
201 | 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); | ||
202 | m_log.Error(errorMessage); | ||
203 | throw new ApplicationException(errorMessage); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | private void FailIfRemoteAdminNotAllowed(string password, string check_ip_address) | ||
208 | { | ||
209 | if (m_accessIP.Count > 0 && !m_accessIP.Contains(check_ip_address)) | ||
210 | { | ||
211 | m_log.WarnFormat("[RADMIN]: Unauthorized acess blocked from IP {0}", check_ip_address); | ||
212 | throw new Exception("not authorized"); | ||
213 | } | ||
214 | |||
215 | if (m_requiredPassword != String.Empty && password != m_requiredPassword) | ||
216 | { | ||
217 | m_log.WarnFormat("[RADMIN]: Wrong password, blocked access from IP {0}", check_ip_address); | ||
218 | throw new Exception("wrong password"); | ||
219 | } | ||
220 | } | ||
221 | |||
193 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 222 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
194 | { | 223 | { |
195 | XmlRpcResponse response = new XmlRpcResponse(); | 224 | XmlRpcResponse response = new XmlRpcResponse(); |
@@ -202,11 +231,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
202 | m_log.Info("[RADMIN]: Request to restart Region."); | 231 | m_log.Info("[RADMIN]: Request to restart Region."); |
203 | CheckStringParameters(request, new string[] {"password", "regionID"}); | 232 | CheckStringParameters(request, new string[] {"password", "regionID"}); |
204 | 233 | ||
205 | if (m_requiredPassword != String.Empty && | 234 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
206 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | ||
207 | { | ||
208 | throw new Exception("wrong password"); | ||
209 | } | ||
210 | 235 | ||
211 | UUID regionID = new UUID((string) requestData["regionID"]); | 236 | UUID regionID = new UUID((string) requestData["regionID"]); |
212 | 237 | ||
@@ -292,9 +317,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
292 | 317 | ||
293 | CheckStringParameters(request, new string[] {"password", "message"}); | 318 | CheckStringParameters(request, new string[] {"password", "message"}); |
294 | 319 | ||
295 | if (m_requiredPassword != String.Empty && | 320 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
296 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | ||
297 | throw new Exception("wrong password"); | ||
298 | 321 | ||
299 | string message = (string) requestData["message"]; | 322 | string message = (string) requestData["message"]; |
300 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | 323 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); |
@@ -392,9 +415,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
392 | 415 | ||
393 | CheckStringParameters(request, new string[] {"password", "filename", "regionid"}); | 416 | CheckStringParameters(request, new string[] {"password", "filename", "regionid"}); |
394 | 417 | ||
395 | if (m_requiredPassword != String.Empty && | 418 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
396 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | ||
397 | throw new Exception("wrong password"); | ||
398 | 419 | ||
399 | string file = (string) requestData["filename"]; | 420 | string file = (string) requestData["filename"]; |
400 | UUID regionID = (UUID) (string) requestData["regionid"]; | 421 | UUID regionID = (UUID) (string) requestData["regionid"]; |
@@ -457,9 +478,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
457 | 478 | ||
458 | CheckStringParameters(request, new string[] { "password", "filename", "regionid" }); | 479 | CheckStringParameters(request, new string[] { "password", "filename", "regionid" }); |
459 | 480 | ||
460 | if (m_requiredPassword != String.Empty && | 481 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
461 | (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) | ||
462 | throw new Exception("wrong password"); | ||
463 | 482 | ||
464 | string file = (string)requestData["filename"]; | 483 | string file = (string)requestData["filename"]; |
465 | UUID regionID = (UUID)(string)requestData["regionid"]; | 484 | UUID regionID = (UUID)(string)requestData["regionid"]; |
@@ -507,9 +526,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
507 | { | 526 | { |
508 | Hashtable requestData = (Hashtable) request.Params[0]; | 527 | Hashtable requestData = (Hashtable) request.Params[0]; |
509 | 528 | ||
510 | if (m_requiredPassword != String.Empty && | 529 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
511 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | ||
512 | throw new Exception("wrong password"); | ||
513 | 530 | ||
514 | responseData["accepted"] = true; | 531 | responseData["accepted"] = true; |
515 | response.Value = responseData; | 532 | response.Value = responseData; |
@@ -681,9 +698,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
681 | }); | 698 | }); |
682 | CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); | 699 | CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); |
683 | 700 | ||
684 | // check password | 701 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
685 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
686 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
687 | 702 | ||
688 | // check whether we still have space left (iff we are using limits) | 703 | // check whether we still have space left (iff we are using limits) |
689 | if (m_regionLimit != 0 && m_application.SceneManager.Scenes.Count >= m_regionLimit) | 704 | if (m_regionLimit != 0 && m_application.SceneManager.Scenes.Count >= m_regionLimit) |
@@ -945,6 +960,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
945 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 960 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
946 | { | 961 | { |
947 | m_log.Info("[RADMIN]: DeleteRegion: new request"); | 962 | m_log.Info("[RADMIN]: DeleteRegion: new request"); |
963 | |||
948 | XmlRpcResponse response = new XmlRpcResponse(); | 964 | XmlRpcResponse response = new XmlRpcResponse(); |
949 | Hashtable responseData = new Hashtable(); | 965 | Hashtable responseData = new Hashtable(); |
950 | 966 | ||
@@ -955,6 +971,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
955 | Hashtable requestData = (Hashtable) request.Params[0]; | 971 | Hashtable requestData = (Hashtable) request.Params[0]; |
956 | CheckStringParameters(request, new string[] {"password", "region_name"}); | 972 | CheckStringParameters(request, new string[] {"password", "region_name"}); |
957 | 973 | ||
974 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); | ||
975 | |||
958 | Scene scene = null; | 976 | Scene scene = null; |
959 | string regionName = (string) requestData["region_name"]; | 977 | string regionName = (string) requestData["region_name"]; |
960 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) | 978 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
@@ -1024,6 +1042,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1024 | Hashtable requestData = (Hashtable) request.Params[0]; | 1042 | Hashtable requestData = (Hashtable) request.Params[0]; |
1025 | CheckStringParameters(request, new string[] {"password"}); | 1043 | CheckStringParameters(request, new string[] {"password"}); |
1026 | 1044 | ||
1045 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); | ||
1046 | |||
1027 | if (requestData.ContainsKey("region_id") && | 1047 | if (requestData.ContainsKey("region_id") && |
1028 | !String.IsNullOrEmpty((string) requestData["region_id"])) | 1048 | !String.IsNullOrEmpty((string) requestData["region_id"])) |
1029 | { | 1049 | { |
@@ -1118,6 +1138,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1118 | Hashtable requestData = (Hashtable) request.Params[0]; | 1138 | Hashtable requestData = (Hashtable) request.Params[0]; |
1119 | CheckStringParameters(request, new string[] {"password", "region_name"}); | 1139 | CheckStringParameters(request, new string[] {"password", "region_name"}); |
1120 | 1140 | ||
1141 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); | ||
1142 | |||
1121 | Scene scene = null; | 1143 | Scene scene = null; |
1122 | string regionName = (string) requestData["region_name"]; | 1144 | string regionName = (string) requestData["region_name"]; |
1123 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) | 1145 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
@@ -1231,9 +1253,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1231 | }); | 1253 | }); |
1232 | CheckIntegerParams(request, new string[] {"start_region_x", "start_region_y"}); | 1254 | CheckIntegerParams(request, new string[] {"start_region_x", "start_region_y"}); |
1233 | 1255 | ||
1234 | // check password | 1256 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
1235 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
1236 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
1237 | 1257 | ||
1238 | // do the job | 1258 | // do the job |
1239 | string firstName = (string) requestData["user_firstname"]; | 1259 | string firstName = (string) requestData["user_firstname"]; |
@@ -1341,6 +1361,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1341 | // check completeness | 1361 | // check completeness |
1342 | CheckStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); | 1362 | CheckStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); |
1343 | 1363 | ||
1364 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); | ||
1365 | |||
1344 | string firstName = (string) requestData["user_firstname"]; | 1366 | string firstName = (string) requestData["user_firstname"]; |
1345 | string lastName = (string) requestData["user_lastname"]; | 1367 | string lastName = (string) requestData["user_lastname"]; |
1346 | 1368 | ||
@@ -1425,7 +1447,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1425 | /// </description></item> | 1447 | /// </description></item> |
1426 | /// </list> | 1448 | /// </list> |
1427 | /// </remarks> | 1449 | /// </remarks> |
1428 | |||
1429 | public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 1450 | public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
1430 | { | 1451 | { |
1431 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); | 1452 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); |
@@ -1447,9 +1468,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1447 | "password", "user_firstname", | 1468 | "password", "user_firstname", |
1448 | "user_lastname"}); | 1469 | "user_lastname"}); |
1449 | 1470 | ||
1450 | // check password | 1471 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
1451 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
1452 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
1453 | 1472 | ||
1454 | // do the job | 1473 | // do the job |
1455 | string firstName = (string) requestData["user_firstname"]; | 1474 | string firstName = (string) requestData["user_firstname"]; |
@@ -1565,7 +1584,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1565 | /// file, or pre-existing in the user database. | 1584 | /// file, or pre-existing in the user database. |
1566 | /// This should probably get moved into somewhere more core eventually. | 1585 | /// This should probably get moved into somewhere more core eventually. |
1567 | /// </summary> | 1586 | /// </summary> |
1568 | |||
1569 | private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) | 1587 | private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) |
1570 | { | 1588 | { |
1571 | m_log.DebugFormat("[RADMIN]: updateUserAppearance"); | 1589 | m_log.DebugFormat("[RADMIN]: updateUserAppearance"); |
@@ -1647,7 +1665,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1647 | /// ratified, or an appropriate default value has been adopted. The intended prototype | 1665 | /// ratified, or an appropriate default value has been adopted. The intended prototype |
1648 | /// is known to exist, as is the target avatar. | 1666 | /// is known to exist, as is the target avatar. |
1649 | /// </summary> | 1667 | /// </summary> |
1650 | |||
1651 | private void EstablishAppearance(UUID destination, UUID source) | 1668 | private void EstablishAppearance(UUID destination, UUID source) |
1652 | { | 1669 | { |
1653 | m_log.DebugFormat("[RADMIN]: Initializing inventory for {0} from {1}", destination, source); | 1670 | m_log.DebugFormat("[RADMIN]: Initializing inventory for {0} from {1}", destination, source); |
@@ -1715,7 +1732,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1715 | /// worn or attached to the Clothing inventory folder of the receiving avatar. | 1732 | /// worn or attached to the Clothing inventory folder of the receiving avatar. |
1716 | /// In parallel the avatar wearables and attachments are updated. | 1733 | /// In parallel the avatar wearables and attachments are updated. |
1717 | /// </summary> | 1734 | /// </summary> |
1718 | |||
1719 | private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance) | 1735 | private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance) |
1720 | { | 1736 | { |
1721 | IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; | 1737 | IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; |
@@ -1745,7 +1761,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1745 | AvatarWearable[] wearables = avatarAppearance.Wearables; | 1761 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1746 | AvatarWearable wearable; | 1762 | AvatarWearable wearable; |
1747 | 1763 | ||
1748 | for (int i=0; i<wearables.Length; i++) | 1764 | for (int i = 0; i<wearables.Length; i++) |
1749 | { | 1765 | { |
1750 | wearable = wearables[i]; | 1766 | wearable = wearables[i]; |
1751 | if (wearable[0].ItemID != UUID.Zero) | 1767 | if (wearable[0].ItemID != UUID.Zero) |
@@ -1848,15 +1864,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1848 | } | 1864 | } |
1849 | } | 1865 | } |
1850 | } | 1866 | } |
1851 | |||
1852 | |||
1853 | } | 1867 | } |
1854 | 1868 | ||
1855 | /// <summary> | 1869 | /// <summary> |
1856 | /// This method is called by establishAppearance to copy inventory folders to make | 1870 | /// This method is called by establishAppearance to copy inventory folders to make |
1857 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments | 1871 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments |
1858 | /// </summary> | 1872 | /// </summary> |
1859 | |||
1860 | private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap, | 1873 | private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap, |
1861 | AvatarAppearance avatarAppearance) | 1874 | AvatarAppearance avatarAppearance) |
1862 | { | 1875 | { |
@@ -1891,9 +1904,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1891 | { | 1904 | { |
1892 | destinationFolder = new InventoryFolderBase(); | 1905 | destinationFolder = new InventoryFolderBase(); |
1893 | destinationFolder.ID = UUID.Random(); | 1906 | destinationFolder.ID = UUID.Random(); |
1894 | if (assetType == AssetType.Clothing) { | 1907 | if (assetType == AssetType.Clothing) |
1908 | { | ||
1895 | destinationFolder.Name = "Clothing"; | 1909 | destinationFolder.Name = "Clothing"; |
1896 | } else { | 1910 | } |
1911 | else | ||
1912 | { | ||
1897 | destinationFolder.Name = "Body Parts"; | 1913 | destinationFolder.Name = "Body Parts"; |
1898 | } | 1914 | } |
1899 | destinationFolder.Owner = destination; | 1915 | destinationFolder.Owner = destination; |
@@ -1909,7 +1925,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1909 | 1925 | ||
1910 | foreach (InventoryFolderBase folder in folders) | 1926 | foreach (InventoryFolderBase folder in folders) |
1911 | { | 1927 | { |
1912 | |||
1913 | extraFolder = new InventoryFolderBase(); | 1928 | extraFolder = new InventoryFolderBase(); |
1914 | extraFolder.ID = UUID.Random(); | 1929 | extraFolder.ID = UUID.Random(); |
1915 | extraFolder.Name = folder.Name; | 1930 | extraFolder.Name = folder.Name; |
@@ -1967,7 +1982,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1967 | /// <summary> | 1982 | /// <summary> |
1968 | /// Apply next owner permissions. | 1983 | /// Apply next owner permissions. |
1969 | /// </summary> | 1984 | /// </summary> |
1970 | |||
1971 | private void ApplyNextOwnerPermissions(InventoryItemBase item) | 1985 | private void ApplyNextOwnerPermissions(InventoryItemBase item) |
1972 | { | 1986 | { |
1973 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 1987 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) |
@@ -2360,18 +2374,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2360 | { | 2374 | { |
2361 | Hashtable requestData = (Hashtable) request.Params[0]; | 2375 | Hashtable requestData = (Hashtable) request.Params[0]; |
2362 | 2376 | ||
2363 | // check completeness | 2377 | CheckStringParameters(request, new string[] { |
2364 | foreach (string parameter in new string[] {"password", "filename"}) | 2378 | "password", "filename"}); |
2365 | { | ||
2366 | if (!requestData.Contains(parameter)) | ||
2367 | throw new Exception(String.Format("missing parameter {0}", parameter)); | ||
2368 | if (String.IsNullOrEmpty((string) requestData[parameter])) | ||
2369 | throw new Exception(String.Format("parameter {0} is empty", parameter)); | ||
2370 | } | ||
2371 | 2379 | ||
2372 | // check password | 2380 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2373 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
2374 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
2375 | 2381 | ||
2376 | string filename = (string) requestData["filename"]; | 2382 | string filename = (string) requestData["filename"]; |
2377 | Scene scene = null; | 2383 | Scene scene = null; |
@@ -2477,18 +2483,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2477 | { | 2483 | { |
2478 | Hashtable requestData = (Hashtable) request.Params[0]; | 2484 | Hashtable requestData = (Hashtable) request.Params[0]; |
2479 | 2485 | ||
2480 | // check completeness | 2486 | CheckStringParameters(request, new string[] { |
2481 | foreach (string p in new string[] {"password", "filename"}) | 2487 | "password", "filename"}); |
2482 | { | ||
2483 | if (!requestData.Contains(p)) | ||
2484 | throw new Exception(String.Format("missing parameter {0}", p)); | ||
2485 | if (String.IsNullOrEmpty((string) requestData[p])) | ||
2486 | throw new Exception(String.Format("parameter {0} is empty")); | ||
2487 | } | ||
2488 | 2488 | ||
2489 | // check password | 2489 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2490 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
2491 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
2492 | 2490 | ||
2493 | string filename = (string) requestData["filename"]; | 2491 | string filename = (string) requestData["filename"]; |
2494 | Scene scene = null; | 2492 | Scene scene = null; |
@@ -2534,11 +2532,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2534 | { | 2532 | { |
2535 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; | 2533 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; |
2536 | archiver.ArchiveRegion(filename, options); | 2534 | archiver.ArchiveRegion(filename, options); |
2537 | lock (m_saveOarLock) Monitor.Wait(m_saveOarLock,5000); | 2535 | |
2536 | lock (m_saveOarLock) | ||
2537 | Monitor.Wait(m_saveOarLock,5000); | ||
2538 | |||
2538 | scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; | 2539 | scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; |
2539 | } | 2540 | } |
2540 | else | 2541 | else |
2542 | { | ||
2541 | throw new Exception("Archiver module not present for scene"); | 2543 | throw new Exception("Archiver module not present for scene"); |
2544 | } | ||
2542 | 2545 | ||
2543 | responseData["saved"] = true; | 2546 | responseData["saved"] = true; |
2544 | 2547 | ||
@@ -2579,18 +2582,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2579 | { | 2582 | { |
2580 | Hashtable requestData = (Hashtable) request.Params[0]; | 2583 | Hashtable requestData = (Hashtable) request.Params[0]; |
2581 | 2584 | ||
2582 | // check completeness | 2585 | CheckStringParameters(request, new string[] { |
2583 | foreach (string p in new string[] {"password", "filename"}) | 2586 | "password", "filename"}); |
2584 | { | ||
2585 | if (!requestData.Contains(p)) | ||
2586 | throw new Exception(String.Format("missing parameter {0}", p)); | ||
2587 | if (String.IsNullOrEmpty((string) requestData[p])) | ||
2588 | throw new Exception(String.Format("parameter {0} is empty")); | ||
2589 | } | ||
2590 | 2587 | ||
2591 | // check password | 2588 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2592 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
2593 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
2594 | 2589 | ||
2595 | string filename = (string) requestData["filename"]; | 2590 | string filename = (string) requestData["filename"]; |
2596 | if (requestData.Contains("region_uuid")) | 2591 | if (requestData.Contains("region_uuid")) |
@@ -2598,6 +2593,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2598 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2593 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2599 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | 2594 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2600 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2595 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2596 | |||
2601 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | 2597 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); |
2602 | } | 2598 | } |
2603 | else if (requestData.Contains("region_name")) | 2599 | else if (requestData.Contains("region_name")) |
@@ -2605,6 +2601,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2605 | string region_name = (string) requestData["region_name"]; | 2601 | string region_name = (string) requestData["region_name"]; |
2606 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | 2602 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2607 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2603 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2604 | |||
2608 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | 2605 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); |
2609 | } | 2606 | } |
2610 | else throw new Exception("neither region_name nor region_uuid given"); | 2607 | else throw new Exception("neither region_name nor region_uuid given"); |
@@ -2663,18 +2660,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2663 | { | 2660 | { |
2664 | Hashtable requestData = (Hashtable) request.Params[0]; | 2661 | Hashtable requestData = (Hashtable) request.Params[0]; |
2665 | 2662 | ||
2666 | // check completeness | 2663 | CheckStringParameters(request, new string[] { |
2667 | foreach (string p in new string[] {"password", "filename"}) | 2664 | "password", "filename"}); |
2668 | { | ||
2669 | if (!requestData.Contains(p)) | ||
2670 | throw new Exception(String.Format("missing parameter {0}", p)); | ||
2671 | if (String.IsNullOrEmpty((string) requestData[p])) | ||
2672 | throw new Exception(String.Format("parameter {0} is empty")); | ||
2673 | } | ||
2674 | 2665 | ||
2675 | // check password | 2666 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2676 | if (!String.IsNullOrEmpty(m_requiredPassword) && | ||
2677 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
2678 | 2667 | ||
2679 | string filename = (string) requestData["filename"]; | 2668 | string filename = (string) requestData["filename"]; |
2680 | if (requestData.Contains("region_uuid")) | 2669 | if (requestData.Contains("region_uuid")) |
@@ -2749,17 +2738,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2749 | 2738 | ||
2750 | Hashtable requestData = (Hashtable) request.Params[0]; | 2739 | Hashtable requestData = (Hashtable) request.Params[0]; |
2751 | 2740 | ||
2752 | // check completeness | 2741 | CheckStringParameters(request, new string[] { |
2753 | if (!requestData.Contains("password")) | 2742 | "password"}); |
2754 | throw new Exception(String.Format("missing required parameter")); | 2743 | |
2755 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 2744 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2756 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
2757 | 2745 | ||
2758 | if (requestData.Contains("region_uuid")) | 2746 | if (requestData.Contains("region_uuid")) |
2759 | { | 2747 | { |
2760 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2748 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2761 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | 2749 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2762 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2750 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2751 | |||
2763 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | 2752 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); |
2764 | } | 2753 | } |
2765 | else if (requestData.Contains("region_name")) | 2754 | else if (requestData.Contains("region_name")) |
@@ -2767,6 +2756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2767 | string region_name = (string) requestData["region_name"]; | 2756 | string region_name = (string) requestData["region_name"]; |
2768 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | 2757 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2769 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2758 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2759 | |||
2770 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | 2760 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); |
2771 | } | 2761 | } |
2772 | else throw new Exception("neither region_name nor region_uuid given"); | 2762 | else throw new Exception("neither region_name nor region_uuid given"); |
@@ -2792,6 +2782,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2792 | } | 2782 | } |
2793 | 2783 | ||
2794 | m_log.Info("[RADMIN]: Query XML Administrator Request complete"); | 2784 | m_log.Info("[RADMIN]: Query XML Administrator Request complete"); |
2785 | |||
2795 | return response; | 2786 | return response; |
2796 | } | 2787 | } |
2797 | 2788 | ||
@@ -2810,14 +2801,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2810 | 2801 | ||
2811 | Hashtable requestData = (Hashtable) request.Params[0]; | 2802 | Hashtable requestData = (Hashtable) request.Params[0]; |
2812 | 2803 | ||
2813 | // check completeness | 2804 | CheckStringParameters(request, new string[] { |
2814 | if (!requestData.Contains("password")) | 2805 | "password", "command"}); |
2815 | throw new Exception(String.Format("missing required parameter")); | 2806 | |
2816 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 2807 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2817 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | ||
2818 | 2808 | ||
2819 | if (!requestData.Contains("command")) | ||
2820 | throw new Exception(String.Format("missing required parameter")); | ||
2821 | MainConsole.Instance.RunCommand(requestData["command"].ToString()); | 2809 | MainConsole.Instance.RunCommand(requestData["command"].ToString()); |
2822 | 2810 | ||
2823 | response.Value = responseData; | 2811 | response.Value = responseData; |
@@ -2851,10 +2839,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2851 | 2839 | ||
2852 | Hashtable requestData = (Hashtable) request.Params[0]; | 2840 | Hashtable requestData = (Hashtable) request.Params[0]; |
2853 | 2841 | ||
2854 | if (!requestData.Contains("password")) | 2842 | CheckStringParameters(request, new string[] { |
2855 | throw new Exception(String.Format("missing required parameter")); | 2843 | "password"}); |
2856 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 2844 | |
2857 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 2845 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2858 | 2846 | ||
2859 | if (requestData.Contains("region_uuid")) | 2847 | if (requestData.Contains("region_uuid")) |
2860 | { | 2848 | { |
@@ -2868,12 +2856,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2868 | string region_name = (string) requestData["region_name"]; | 2856 | string region_name = (string) requestData["region_name"]; |
2869 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | 2857 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2870 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2858 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2859 | |||
2871 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | 2860 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); |
2872 | } | 2861 | } |
2873 | else throw new Exception("neither region_name nor region_uuid given"); | 2862 | else throw new Exception("neither region_name nor region_uuid given"); |
2874 | 2863 | ||
2875 | Scene scene = m_application.SceneManager.CurrentScene; | 2864 | Scene scene = m_application.SceneManager.CurrentScene; |
2876 | scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; | 2865 | scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; |
2866 | |||
2877 | if (scene.RegionInfo.Persistent) | 2867 | if (scene.RegionInfo.Persistent) |
2878 | scene.RegionInfo.EstateSettings.Save(); | 2868 | scene.RegionInfo.EstateSettings.Save(); |
2879 | } | 2869 | } |
@@ -2908,10 +2898,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2908 | 2898 | ||
2909 | Hashtable requestData = (Hashtable) request.Params[0]; | 2899 | Hashtable requestData = (Hashtable) request.Params[0]; |
2910 | 2900 | ||
2911 | if (!requestData.Contains("password")) | 2901 | CheckStringParameters(request, new string[] { |
2912 | throw new Exception(String.Format("missing required parameter")); | 2902 | "password"}); |
2913 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 2903 | |
2914 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 2904 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
2915 | 2905 | ||
2916 | if (requestData.Contains("region_uuid")) | 2906 | if (requestData.Contains("region_uuid")) |
2917 | { | 2907 | { |
@@ -2995,10 +2985,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2995 | 2985 | ||
2996 | Hashtable requestData = (Hashtable) request.Params[0]; | 2986 | Hashtable requestData = (Hashtable) request.Params[0]; |
2997 | 2987 | ||
2998 | if (!requestData.Contains("password")) | 2988 | CheckStringParameters(request, new string[] { |
2999 | throw new Exception(String.Format("missing required parameter")); | 2989 | "password"}); |
3000 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 2990 | |
3001 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 2991 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
3002 | 2992 | ||
3003 | if (requestData.Contains("region_uuid")) | 2993 | if (requestData.Contains("region_uuid")) |
3004 | { | 2994 | { |
@@ -3082,10 +3072,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3082 | 3072 | ||
3083 | Hashtable requestData = (Hashtable) request.Params[0]; | 3073 | Hashtable requestData = (Hashtable) request.Params[0]; |
3084 | 3074 | ||
3085 | if (!requestData.Contains("password")) | 3075 | CheckStringParameters(request, new string[] { |
3086 | throw new Exception(String.Format("missing required parameter")); | 3076 | "password"}); |
3087 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 3077 | |
3088 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 3078 | FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString()); |
3089 | 3079 | ||
3090 | if (requestData.Contains("region_uuid")) | 3080 | if (requestData.Contains("region_uuid")) |
3091 | { | 3081 | { |
@@ -3299,7 +3289,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3299 | bool success = false; | 3289 | bool success = false; |
3300 | if (authenticationService != null) | 3290 | if (authenticationService != null) |
3301 | success = authenticationService.SetPassword(account.PrincipalID, password); | 3291 | success = authenticationService.SetPassword(account.PrincipalID, password); |
3302 | if (!success) { | 3292 | |
3293 | if (!success) | ||
3294 | { | ||
3303 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | 3295 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", |
3304 | firstName, lastName); | 3296 | firstName, lastName); |
3305 | return false; | 3297 | return false; |
@@ -3313,4 +3305,4 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3313 | } | 3305 | } |
3314 | } | 3306 | } |
3315 | } | 3307 | } |
3316 | } | 3308 | } \ No newline at end of file |