aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs171
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs4
2 files changed, 103 insertions, 72 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 8122b8a..9ae1a7b 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -53,7 +53,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
53 { 53 {
54 private OpenSimMain m_app; 54 private OpenSimMain m_app;
55 private BaseHttpServer m_httpd; 55 private BaseHttpServer m_httpd;
56 56 private string requiredPassword = "";
57 public void Initialise(OpenSimMain openSim) 57 public void Initialise(OpenSimMain openSim)
58 { 58 {
59 try 59 try
@@ -61,6 +61,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
61 if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) 61 if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
62 { 62 {
63 MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled"); 63 MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled");
64 requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", "");
64 65
65 m_app = openSim; 66 m_app = openSim;
66 m_httpd = openSim.HttpServer; 67 m_httpd = openSim.HttpServer;
@@ -85,19 +86,27 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
85 LLUUID regionID = new LLUUID((string)requestData["regionID"]); 86 LLUUID regionID = new LLUUID((string)requestData["regionID"]);
86 87
87 Hashtable responseData = new Hashtable(); 88 Hashtable responseData = new Hashtable();
88 responseData["accepted"] = "true"; 89 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
89 response.Value = responseData;
90
91 OpenSim.Region.Environment.Scenes.Scene RebootedScene;
92
93 if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene))
94 { 90 {
95 responseData["rebooting"] = "true"; 91 responseData["accepted"] = "false";
96 RebootedScene.Restart(30); 92 response.Value = responseData;
97 } 93 }
98 else 94 else
99 { 95 {
100 responseData["rebooting"] = "false"; 96 responseData["accepted"] = "true";
97 response.Value = responseData;
98
99 OpenSim.Region.Environment.Scenes.Scene RebootedScene;
100
101 if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene))
102 {
103 responseData["rebooting"] = "true";
104 RebootedScene.Restart(30);
105 }
106 else
107 {
108 responseData["rebooting"] = "false";
109 }
101 } 110 }
102 111
103 return response; 112 return response;
@@ -108,14 +117,23 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
108 XmlRpcResponse response = new XmlRpcResponse(); 117 XmlRpcResponse response = new XmlRpcResponse();
109 Hashtable requestData = (Hashtable)request.Params[0]; 118 Hashtable requestData = (Hashtable)request.Params[0];
110 119
111 string message = (string)requestData["message"];
112 MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message);
113
114 Hashtable responseData = new Hashtable(); 120 Hashtable responseData = new Hashtable();
115 responseData["accepted"] = "true"; 121 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
116 response.Value = responseData; 122 {
123 responseData["accepted"] = "false";
124 response.Value = responseData;
125 }
126 else
127 {
128
129 string message = (string)requestData["message"];
130 MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message);
131
132 responseData["accepted"] = "true";
133 response.Value = responseData;
117 134
118 m_app.SceneManager.SendGeneralMessage(message); 135 m_app.SceneManager.SendGeneralMessage(message);
136 }
119 137
120 return response; 138 return response;
121 } 139 }
@@ -125,42 +143,49 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
125 MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request"); 143 MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request");
126 XmlRpcResponse response = new XmlRpcResponse(); 144 XmlRpcResponse response = new XmlRpcResponse();
127 Hashtable requestData = (Hashtable)request.Params[0]; 145 Hashtable requestData = (Hashtable)request.Params[0];
128 146 Hashtable responseData = new Hashtable();
129 if ((string)requestData["shutdown"] == "delayed") 147 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
130 { 148 {
131 int timeout = (Int32)requestData["milliseconds"]; 149 responseData["accepted"] = "false";
132
133 Hashtable responseData = new Hashtable();
134 responseData["accepted"] = "true";
135 response.Value = responseData; 150 response.Value = responseData;
136
137 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() +
138 " second(s). Please save what you are doing and log out.");
139
140 // Perform shutdown
141 Timer shutdownTimer = new Timer(timeout); // Wait before firing
142 shutdownTimer.AutoReset = false;
143 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
144 shutdownTimer.Start();
145
146 return response;
147 } 151 }
148 else 152 else
149 { 153 {
150 Hashtable responseData = new Hashtable(); 154 if ((string)requestData["shutdown"] == "delayed")
151 responseData["accepted"] = "true"; 155 {
152 response.Value = responseData; 156 int timeout = (Int32)requestData["milliseconds"];
157
158 responseData["accepted"] = "true";
159 response.Value = responseData;
160
161 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() +
162 " second(s). Please save what you are doing and log out.");
163
164 // Perform shutdown
165 Timer shutdownTimer = new Timer(timeout); // Wait before firing
166 shutdownTimer.AutoReset = false;
167 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
168 shutdownTimer.Start();
169
170 return response;
171 }
172 else
173 {
174 responseData["accepted"] = "true";
175 response.Value = responseData;
153 176
154 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 177 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
155 178
156 // Perform shutdown 179 // Perform shutdown
157 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing 180 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
158 shutdownTimer.AutoReset = false; 181 shutdownTimer.AutoReset = false;
159 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); 182 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
160 shutdownTimer.Start(); 183 shutdownTimer.Start();
161 184
162 return response; 185 return response;
186 }
163 } 187 }
188 return response;
164 } 189 }
165 190
166 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) 191 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
@@ -173,40 +198,46 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
173 MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request"); 198 MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request");
174 XmlRpcResponse response = new XmlRpcResponse(); 199 XmlRpcResponse response = new XmlRpcResponse();
175 Hashtable requestData = (Hashtable)request.Params[0]; 200 Hashtable requestData = (Hashtable)request.Params[0];
176 201 Hashtable responseData = new Hashtable();
177 RegionInfo newRegionData = new RegionInfo(); 202 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
178
179 try
180 { 203 {
181 newRegionData.RegionID = (string)requestData["region_id"]; 204 responseData["created"] = "false";
182 newRegionData.RegionName = (string)requestData["region_name"]; 205 response.Value = responseData;
183 newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]); 206 }
184 newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]); 207 else
208 {
209 RegionInfo newRegionData = new RegionInfo();
185 210
186 // Security risk 211 try
187 newRegionData.DataStore = (string)requestData["datastore"]; 212 {
213 newRegionData.RegionID = (string)requestData["region_id"];
214 newRegionData.RegionName = (string)requestData["region_name"];
215 newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]);
216 newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]);
188 217
189 newRegionData.InternalEndPoint = new IPEndPoint( 218 // Security risk
190 IPAddress.Parse((string)requestData["listen_ip"]), 0); 219 newRegionData.DataStore = (string)requestData["datastore"];
191 220
192 newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"]; 221 newRegionData.InternalEndPoint = new IPEndPoint(
193 newRegionData.ExternalHostName = (string)requestData["external_address"]; 222 IPAddress.Parse((string)requestData["listen_ip"]), 0);
194 223
195 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; 224 newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"];
196 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; 225 newRegionData.ExternalHostName = (string)requestData["external_address"];
197 226
198 m_app.CreateRegion(newRegionData); 227 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"];
228 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"];
199 229
200 Hashtable responseData = new Hashtable(); 230 m_app.CreateRegion(newRegionData);
201 responseData["created"] = "true"; 231
202 response.Value = responseData; 232 responseData["created"] = "true";
203 } 233 response.Value = responseData;
204 catch (Exception e) 234 }
205 { 235 catch (Exception e)
206 Hashtable responseData = new Hashtable(); 236 {
207 responseData["created"] = "false"; 237 responseData["created"] = "false";
208 responseData["error"] = e.ToString(); 238 responseData["error"] = e.ToString();
209 response.Value = responseData; 239 response.Value = responseData;
240 }
210 } 241 }
211 242
212 return response; 243 return response;
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 11ff0ee..7977c78 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.LandManagement
472 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) 472 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
473 { 473 {
474 //Throw an exception - The bitmap is not 64x64 474 //Throw an exception - The bitmap is not 64x64
475 throw new Exception("Error: Invalid Parcel Bitmap"); 475 //throw new Exception("Error: Invalid Parcel Bitmap");
476 } 476 }
477 else 477 else
478 { 478 {
@@ -584,7 +584,7 @@ namespace OpenSim.Region.Environment.LandManagement
584 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) 584 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
585 { 585 {
586 //Throw an exception - The bitmap is not 64x64 586 //Throw an exception - The bitmap is not 64x64
587 throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); 587 //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()");
588 } 588 }
589 589
590 int x, y; 590 int x, y;