aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2019-08-17 23:57:05 +0100
committerUbitUmarov2019-08-17 23:57:05 +0100
commitdb374112c6ce406fafe30a5da3a16d327dcb7a03 (patch)
tree5e9c36d09fadd75a6218d2978df99b95f6fefd36 /OpenSim
parentEstateAccess: add some ban fields to fill one day (diff)
downloadopensim-SC-db374112c6ce406fafe30a5da3a16d327dcb7a03.zip
opensim-SC-db374112c6ce406fafe30a5da3a16d327dcb7a03.tar.gz
opensim-SC-db374112c6ce406fafe30a5da3a16d327dcb7a03.tar.bz2
opensim-SC-db374112c6ce406fafe30a5da3a16d327dcb7a03.tar.xz
EstateAccess do fill the fields(mySQL only); fix the response
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs14
-rw-r--r--OpenSim/Framework/EstateBan.cs5
-rw-r--r--OpenSim/Framework/LLSDxmlEncode.cs31
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs51
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs6
5 files changed, 64 insertions, 43 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index eeedf02..2406ee6 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -285,7 +285,7 @@ namespace OpenSim.Data.MySQL
285 285
286 using (MySqlCommand cmd = dbcon.CreateCommand()) 286 using (MySqlCommand cmd = dbcon.CreateCommand())
287 { 287 {
288 cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID"; 288 cmd.CommandText = "select * from estateban where EstateID = ?EstateID";
289 cmd.Parameters.AddWithValue("?EstateID", es.EstateID); 289 cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
290 290
291 using (IDataReader r = cmd.ExecuteReader()) 291 using (IDataReader r = cmd.ExecuteReader())
@@ -293,13 +293,11 @@ namespace OpenSim.Data.MySQL
293 while (r.Read()) 293 while (r.Read())
294 { 294 {
295 EstateBan eb = new EstateBan(); 295 EstateBan eb = new EstateBan();
296 296 eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ;
297 UUID uuid = new UUID();
298 UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
299
300 eb.BannedUserID = uuid;
301 eb.BannedHostAddress = "0.0.0.0"; 297 eb.BannedHostAddress = "0.0.0.0";
302 eb.BannedHostIPMask = "0.0.0.0"; 298 eb.BannedHostIPMask = "0.0.0.0";
299 eb.BanningUserID = DBGuid.FromDB(r["banningUUID"]);
300 eb.BanTime = Convert.ToInt32(r["banTime"]);
303 es.AddBan(eb); 301 es.AddBan(eb);
304 } 302 }
305 } 303 }
@@ -323,12 +321,14 @@ namespace OpenSim.Data.MySQL
323 321
324 cmd.Parameters.Clear(); 322 cmd.Parameters.Clear();
325 323
326 cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( ?EstateID, ?bannedUUID, '', '', '' )"; 324 cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask, banningUUID, banTime) values ( ?EstateID, ?bannedUUID, '', '', '', ?banningUUID, ?banTime)";
327 325
328 foreach (EstateBan b in es.EstateBans) 326 foreach (EstateBan b in es.EstateBans)
329 { 327 {
330 cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); 328 cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
331 cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString()); 329 cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString());
330 cmd.Parameters.AddWithValue("?banningUUID", b.BanningUserID.ToString());
331 cmd.Parameters.AddWithValue("?banTime", b.BanTime);
332 332
333 cmd.ExecuteNonQuery(); 333 cmd.ExecuteNonQuery();
334 cmd.Parameters.Clear(); 334 cmd.Parameters.Clear();
diff --git a/OpenSim/Framework/EstateBan.cs b/OpenSim/Framework/EstateBan.cs
index 12a92bb..81a56d7 100644
--- a/OpenSim/Framework/EstateBan.cs
+++ b/OpenSim/Framework/EstateBan.cs
@@ -67,6 +67,9 @@ namespace OpenSim.Framework
67 } 67 }
68 } 68 }
69 69
70 public UUID BanningUserID { get; set; }
71 public int BanTime;
72
70 private string m_bannedHostAddress = string.Empty; 73 private string m_bannedHostAddress = string.Empty;
71 /// <summary> 74 /// <summary>
72 /// IP address or domain name of the banned client. 75 /// IP address or domain name of the banned client.
@@ -143,6 +146,8 @@ namespace OpenSim.Framework
143 p.SetValue(this, Boolean.Parse((string)map[p.Name]), null); 146 p.SetValue(this, Boolean.Parse((string)map[p.Name]), null);
144 else if (value is UUID) 147 else if (value is UUID)
145 p.SetValue(this, UUID.Parse((string)map[p.Name]), null); 148 p.SetValue(this, UUID.Parse((string)map[p.Name]), null);
149 else if (value is DateTime)
150 p.SetValue(this, DateTime.Parse((string)map[p.Name]), null);
146 } 151 }
147 } 152 }
148 153
diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs
index ac9b468..97b3ca1 100644
--- a/OpenSim/Framework/LLSDxmlEncode.cs
+++ b/OpenSim/Framework/LLSDxmlEncode.cs
@@ -315,13 +315,9 @@ namespace OpenSim.Framework
315 public static void AddRawElem(string e, StringBuilder sb) 315 public static void AddRawElem(string e, StringBuilder sb)
316 { 316 {
317 if(String.IsNullOrEmpty(e)) 317 if(String.IsNullOrEmpty(e))
318 sb.Append("<string />"); 318 return;
319 else 319
320 { 320 sb.Append(e);
321 sb.Append("<string>");
322 sb.Append(e);
323 sb.Append("</string>");
324 }
325 } 321 }
326 322
327 public static void AddElem(Uri e, StringBuilder sb) 323 public static void AddElem(Uri e, StringBuilder sb)
@@ -652,18 +648,13 @@ namespace OpenSim.Framework
652 648
653 public static void AddRawElem(string name, string e, StringBuilder sb) 649 public static void AddRawElem(string name, string e, StringBuilder sb)
654 { 650 {
651 if (String.IsNullOrEmpty(e))
652 return;
653
655 sb.Append("<key>"); 654 sb.Append("<key>");
656 sb.Append(name); 655 sb.Append(name);
657 sb.Append("</key>"); 656 sb.Append("</key>");
658 657 sb.Append(e);
659 if(String.IsNullOrEmpty(e))
660 sb.Append("<string />");
661 else
662 {
663 sb.Append("<string>");
664 sb.Append(e);
665 sb.Append("</string>");
666 }
667 } 658 }
668 659
669 public static void AddElem(string name, Uri e, StringBuilder sb) 660 public static void AddElem(string name, Uri e, StringBuilder sb)
@@ -723,6 +714,14 @@ namespace OpenSim.Framework
723 sb.Append(e); 714 sb.Append(e);
724 } 715 }
725 716
717 public static void AddLLSD(string name, string e, StringBuilder sb)
718 {
719 sb.Append("<key>");
720 sb.Append(name);
721 sb.Append("</key>");
722 sb.Append(e);
723 }
724
726 public static void EscapeToXML(string s, StringBuilder sb) 725 public static void EscapeToXML(string s, StringBuilder sb)
727 { 726 {
728 int i; 727 int i;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
index c3a48d9..3a4d9a5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Globalization;
31using System.Text; 32using System.Text;
32 33
33using log4net; 34using log4net;
@@ -166,59 +167,73 @@ namespace OpenSim.Region.ClientStack.Linden
166 EstateBan[] EstateBans = regionSettings.EstateBans; 167 EstateBan[] EstateBans = regionSettings.EstateBans;
167 168
168 StringBuilder sb = LLSDxmlEncode.Start(); 169 StringBuilder sb = LLSDxmlEncode.Start();
169 LLSDxmlEncode.AddArray(sb); 170 LLSDxmlEncode.AddMap(sb);
170 171
171 if (allowed != null && allowed.Length > 0) 172 if (allowed != null && allowed.Length > 0)
172 { 173 {
173 LLSDxmlEncode.AddMap("AllowedAgents", sb); 174 LLSDxmlEncode.AddArray("AllowedAgents", sb);
174 for (int i = 0; i < allowed.Length; ++i) 175 for (int i = 0; i < allowed.Length; ++i)
175 { 176 {
176 UUID id = allowed[i]; 177 UUID id = allowed[i];
177 if (id == UUID.Zero) 178 if (id == UUID.Zero)
178 continue; 179 continue;
179 LLSDxmlEncode.AddElem("id", id, sb); 180 LLSDxmlEncode.AddMap(sb);
181 LLSDxmlEncode.AddElem("id", id, sb);
182 LLSDxmlEncode.AddEndMap(sb);
180 } 183 }
181 LLSDxmlEncode.AddEndMap(sb); 184 LLSDxmlEncode.AddEndArray(sb);
182 } 185 }
183 186
184 if (groups != null && groups.Length > 0) 187 if (groups != null && groups.Length > 0)
185 { 188 {
186 LLSDxmlEncode.AddMap("AllowedGroups", sb); 189 LLSDxmlEncode.AddArray("AllowedGroups", sb);
187 for (int i = 0; i < groups.Length; ++i) 190 for (int i = 0; i < groups.Length; ++i)
188 { 191 {
189 UUID id = groups[i]; 192 UUID id = groups[i];
190 if (id == UUID.Zero) 193 if (id == UUID.Zero)
191 continue; 194 continue;
192 LLSDxmlEncode.AddElem("id", id, sb); 195 LLSDxmlEncode.AddMap(sb);
196 LLSDxmlEncode.AddElem("id", id, sb);
197 LLSDxmlEncode.AddEndMap(sb);
193 } 198 }
194 LLSDxmlEncode.AddEndMap(sb); 199 LLSDxmlEncode.AddEndArray(sb);
195 } 200 }
196 201
197 if (EstateBans != null && EstateBans.Length > 0) 202 if (EstateBans != null && EstateBans.Length > 0)
198 { 203 {
199 LLSDxmlEncode.AddMap("BannedAgents", sb); 204 LLSDxmlEncode.AddArray("BannedAgents", sb);
200 for (int i = 0; i < EstateBans.Length; ++i) 205 for (int i = 0; i < EstateBans.Length; ++i)
201 { 206 {
202 UUID id = EstateBans[i].BannedUserID; 207 EstateBan ban = EstateBans[i];
208 UUID id = ban.BannedUserID;
203 if (id == UUID.Zero) 209 if (id == UUID.Zero)
204 continue; 210 continue;
205 LLSDxmlEncode.AddElem("id", id, sb); 211 LLSDxmlEncode.AddMap(sb);
206 LLSDxmlEncode.AddElem("last_login_date", "0000-00-00 00:00:00", sb); // We will not have this 212 LLSDxmlEncode.AddElem("id", id, sb);
207 LLSDxmlEncode.AddElem("ban_date", "0000-00-00 00:00:00", sb); // We will have this 213 LLSDxmlEncode.AddElem("banning_id", ban.BanningUserID, sb);
208 LLSDxmlEncode.AddElem("banning_id", UUID.Zero, sb); // we will have this one day 214 LLSDxmlEncode.AddElem("last_login_date", "na", sb); // We will not have this. This information is far at grid
215 if (ban.BanTime == 0)
216 LLSDxmlEncode.AddElem("ban_date", "0000-00-00 00:00", sb);
217 else
218 LLSDxmlEncode.AddElem("ban_date", (Util.ToDateTime(ban.BanTime)).ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture), sb);
219 LLSDxmlEncode.AddEndMap(sb);
209 } 220 }
210 LLSDxmlEncode.AddEndMap(sb); 221 LLSDxmlEncode.AddEndArray(sb);
211 } 222 }
212 223
213 if (managers != null && managers.Length > 0) 224 if (managers != null && managers.Length > 0)
214 { 225 {
215 LLSDxmlEncode.AddMap("Managers", sb); 226 LLSDxmlEncode.AddArray("Managers", sb);
216 for (int i = 0; i < managers.Length; ++i) 227 for (int i = 0; i < managers.Length; ++i)
217 LLSDxmlEncode.AddElem("id", managers[i], sb); 228 {
218 LLSDxmlEncode.AddEndMap(sb); 229 LLSDxmlEncode.AddMap(sb);
230 LLSDxmlEncode.AddElem("id", managers[i], sb);
231 LLSDxmlEncode.AddEndMap(sb);
232 }
233 LLSDxmlEncode.AddEndArray(sb);
219 } 234 }
220 235
221 LLSDxmlEncode.AddEndArray(sb); 236 LLSDxmlEncode.AddEndMap(sb);
222 responsedata["str_response_string"] = LLSDxmlEncode.End(sb); 237 responsedata["str_response_string"] = LLSDxmlEncode.End(sb);
223 238
224 return responsedata; 239 return responsedata;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index c91933f..00c77d7 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -969,11 +969,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
969 continue; 969 continue;
970 970
971 EstateBan bitem = new EstateBan(); 971 EstateBan bitem = new EstateBan();
972
973 bitem.BannedUserID = user; 972 bitem.BannedUserID = user;
974 bitem.EstateID = estateSettings.EstateID; 973 bitem.EstateID = estateSettings.EstateID;
975 bitem.BannedHostAddress = "0.0.0.0"; 974 bitem.BannedHostAddress = "0.0.0.0";
976 bitem.BannedHostIPMask = "0.0.0.0"; 975 bitem.BannedHostIPMask = "0.0.0.0";
976 bitem.BanningUserID = remote_client.AgentId;
977 bitem.BanTime = Util.UnixTimeSinceEpoch();
977 978
978 estateSettings.AddBan(bitem); 979 estateSettings.AddBan(bitem);
979 estateSettings.RemoveEstateUser(user); 980 estateSettings.RemoveEstateUser(user);
@@ -982,11 +983,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
982 } 983 }
983 984
984 EstateBan item = new EstateBan(); 985 EstateBan item = new EstateBan();
985
986 item.BannedUserID = user; 986 item.BannedUserID = user;
987 item.EstateID = Scene.RegionInfo.EstateSettings.EstateID; 987 item.EstateID = Scene.RegionInfo.EstateSettings.EstateID;
988 item.BannedHostAddress = "0.0.0.0"; 988 item.BannedHostAddress = "0.0.0.0";
989 item.BannedHostIPMask = "0.0.0.0"; 989 item.BannedHostIPMask = "0.0.0.0";
990 item.BanningUserID = remote_client.AgentId;
991 item.BanTime = Util.UnixTimeSinceEpoch();
990 992
991 thisSettings.AddBan(item); 993 thisSettings.AddBan(item);
992 thisSettings.RemoveEstateUser(user); 994 thisSettings.RemoveEstateUser(user);