aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs5
-rw-r--r--OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs8
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs62
-rw-r--r--OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs5
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs118
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs16
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs11
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs90
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs5
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs18
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs5
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs62
-rw-r--r--OpenSim/Services/HypergridService/UserAccountCache.cs5
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs10
-rw-r--r--OpenSim/Services/Interfaces/IAttachmentsService.cs17
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs14
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs8
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs5
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs6
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs9
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs21
23 files changed, 401 insertions, 103 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 2ea513b..0feb59d 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -178,7 +178,10 @@ namespace OpenSim.Services.AssetService
178 { 178 {
179// m_log.DebugFormat( 179// m_log.DebugFormat(
180// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); 180// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
181 m_Database.StoreAsset(asset); 181 if (!m_Database.StoreAsset(asset))
182 {
183 return UUID.Zero.ToString();
184 }
182 } 185 }
183// else 186// else
184// { 187// {
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
index edc1097..5980f0c 100644
--- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
+++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
@@ -31,6 +31,8 @@ using log4net;
31using Nini.Config; 31using Nini.Config;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Services.Base; 33using OpenSim.Services.Base;
34using OpenSim.Server.Base;
35using OpenSim.Services.Interfaces;
34using OpenSim.Data; 36using OpenSim.Data;
35using OpenSim.Framework; 37using OpenSim.Framework;
36 38
@@ -49,6 +51,12 @@ namespace OpenSim.Services.AuthenticationService
49 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
50 52
51 protected IAuthenticationData m_Database; 53 protected IAuthenticationData m_Database;
54 protected IUserAccountService m_UserAccountService = null;
55
56 public AuthenticationServiceBase(IConfigSource config, IUserAccountService acct) : this(config)
57 {
58 m_UserAccountService = acct;
59 }
52 60
53 public AuthenticationServiceBase(IConfigSource config) : base(config) 61 public AuthenticationServiceBase(IConfigSource config) : base(config)
54 { 62 {
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 2fc9248..cf7496f 100644
--- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
@@ -51,6 +51,12 @@ namespace OpenSim.Services.AuthenticationService
51 LogManager.GetLogger( 51 LogManager.GetLogger(
52 MethodBase.GetCurrentMethod().DeclaringType); 52 MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 public PasswordAuthenticationService(IConfigSource config, IUserAccountService userService) :
55 base(config, userService)
56 {
57 m_log.Debug("[AUTH SERVICE]: Started with User Account access");
58 }
59
54 public PasswordAuthenticationService(IConfigSource config) : 60 public PasswordAuthenticationService(IConfigSource config) :
55 base(config) 61 base(config)
56 { 62 {
@@ -58,28 +64,70 @@ namespace OpenSim.Services.AuthenticationService
58 64
59 public string Authenticate(UUID principalID, string password, int lifetime) 65 public string Authenticate(UUID principalID, string password, int lifetime)
60 { 66 {
67 m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null);
61 AuthenticationData data = m_Database.Get(principalID); 68 AuthenticationData data = m_Database.Get(principalID);
69 UserAccount user = null;
70 if (m_UserAccountService != null)
71 user = m_UserAccountService.GetUserAccount(UUID.Zero, principalID);
72
73 if (data == null || data.Data == null)
74 {
75 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
76 return String.Empty;
77 }
78
79 if (!data.Data.ContainsKey("passwordHash") ||
80 !data.Data.ContainsKey("passwordSalt"))
81 {
82 return String.Empty;
83 }
84
85 string hashed = Util.Md5Hash(password + ":" +
86 data.Data["passwordSalt"].ToString());
87
88 m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString());
62 89
63 if (data != null && data.Data != null) 90 if (data.Data["passwordHash"].ToString() == hashed)
64 { 91 {
65 if (!data.Data.ContainsKey("passwordHash") || 92 return GetToken(principalID, lifetime);
93 }
94
95 if (user == null)
96 {
97 m_log.DebugFormat("[PASS AUTH]: No user record for {0}", principalID);
98 return String.Empty;
99 }
100
101 int impersonateFlag = 1 << 6;
102
103 if ((user.UserFlags & impersonateFlag) == 0)
104 return String.Empty;
105
106 List<UserAccount> accounts = m_UserAccountService.GetUserAccountsWhere(UUID.Zero, "UserLevel >= 200");
107 if (accounts == null || accounts.Count == 0)
108 return String.Empty;
109
110 foreach (UserAccount a in accounts)
111 {
112 data = m_Database.Get(a.PrincipalID);
113 if (data == null || data.Data == null ||
114 !data.Data.ContainsKey("passwordHash") ||
66 !data.Data.ContainsKey("passwordSalt")) 115 !data.Data.ContainsKey("passwordSalt"))
67 { 116 {
68 return String.Empty; 117 continue;
69 } 118 }
70 119
71 string hashed = Util.Md5Hash(password + ":" + 120 hashed = Util.Md5Hash(password + ":" +
72 data.Data["passwordSalt"].ToString()); 121 data.Data["passwordSalt"].ToString());
73 122
74 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString());
75
76 if (data.Data["passwordHash"].ToString() == hashed) 123 if (data.Data["passwordHash"].ToString() == hashed)
77 { 124 {
125 m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID);
78 return GetToken(principalID, lifetime); 126 return GetToken(principalID, lifetime);
79 } 127 }
80 } 128 }
81 129
82 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); 130 m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID);
83 return String.Empty; 131 return String.Empty;
84 } 132 }
85 } 133 }
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
index 2344c0e..d02ff9b 100644
--- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
@@ -49,6 +49,11 @@ namespace OpenSim.Services.AuthenticationService
49 private static readonly ILog m_log = 49 private static readonly ILog m_log =
50 LogManager.GetLogger( 50 LogManager.GetLogger(
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52
53 public WebkeyAuthenticationService(IConfigSource config, IUserAccountService userService) :
54 base(config, userService)
55 {
56 }
52 57
53 public WebkeyAuthenticationService(IConfigSource config) : 58 public WebkeyAuthenticationService(IConfigSource config) :
54 base(config) 59 base(config)
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index fdab254..2bfa597 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -30,6 +30,7 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Timers;
33using Nini.Config; 34using Nini.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -47,7 +48,9 @@ namespace OpenSim.Services.Connectors
47 48
48 private string m_ServerURI = String.Empty; 49 private string m_ServerURI = String.Empty;
49 private IImprovedAssetCache m_Cache = null; 50 private IImprovedAssetCache m_Cache = null;
50 51 private int m_retryCounter;
52 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
53 private Timer m_retryTimer;
51 private delegate void AssetRetrievedEx(AssetBase asset); 54 private delegate void AssetRetrievedEx(AssetBase asset);
52 55
53 // Keeps track of concurrent requests for the same asset, so that it's only loaded once. 56 // Keeps track of concurrent requests for the same asset, so that it's only loaded once.
@@ -91,6 +94,55 @@ namespace OpenSim.Services.Connectors
91 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", 94 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset",
92 "dump asset <id> <file>", 95 "dump asset <id> <file>",
93 "dump one cached asset", HandleDumpAsset); 96 "dump one cached asset", HandleDumpAsset);
97
98 m_retryTimer = new Timer();
99 m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
100 m_retryTimer.Interval = 60000;
101 }
102
103 protected void retryCheck(object source, ElapsedEventArgs e)
104 {
105 m_retryCounter++;
106 if (m_retryCounter > 60) m_retryCounter -= 60;
107 List<int> keys = new List<int>();
108 foreach (int a in m_retryQueue.Keys)
109 {
110 keys.Add(a);
111 }
112 foreach (int a in keys)
113 {
114 //We exponentially fall back on frequency until we reach one attempt per hour
115 //The net result is that we end up in the queue for roughly 24 hours..
116 //24 hours worth of assets could be a lot, so the hope is that the region admin
117 //will have gotten the asset connector back online quickly!
118
119 int timefactor = a ^ 2;
120 if (timefactor > 60)
121 {
122 timefactor = 60;
123 }
124
125 //First, find out if we care about this timefactor
126 if (timefactor % a == 0)
127 {
128 //Yes, we do!
129 List<AssetBase> retrylist = m_retryQueue[a];
130 m_retryQueue.Remove(a);
131
132 foreach(AssetBase ass in retrylist)
133 {
134 Store(ass); //Store my ass. This function will put it back in the dictionary if it fails
135 }
136 }
137 }
138
139 if (m_retryQueue.Count == 0)
140 {
141 //It might only be one tick per minute, but I have
142 //repented and abandoned my wasteful ways
143 m_retryCounter = 0;
144 m_retryTimer.Stop();
145 }
94 } 146 }
95 147
96 protected void SetCache(IImprovedAssetCache cache) 148 protected void SetCache(IImprovedAssetCache cache)
@@ -105,8 +157,8 @@ namespace OpenSim.Services.Connectors
105 AssetBase asset = null; 157 AssetBase asset = null;
106 if (m_Cache != null) 158 if (m_Cache != null)
107 asset = m_Cache.Get(id); 159 asset = m_Cache.Get(id);
108 160
109 if (asset == null) 161 if (asset == null || asset.Data == null || asset.Data.Length == 0)
110 { 162 {
111 asset = SynchronousRestObjectRequester. 163 asset = SynchronousRestObjectRequester.
112 MakeRequest<int, AssetBase>("GET", uri, 0); 164 MakeRequest<int, AssetBase>("GET", uri, 0);
@@ -183,7 +235,7 @@ namespace OpenSim.Services.Connectors
183 if (m_Cache != null) 235 if (m_Cache != null)
184 asset = m_Cache.Get(id); 236 asset = m_Cache.Get(id);
185 237
186 if (asset == null) 238 if (asset == null || asset.Data == null || asset.Data.Length == 0)
187 { 239 {
188 lock (m_AssetHandlers) 240 lock (m_AssetHandlers)
189 { 241 {
@@ -243,11 +295,10 @@ namespace OpenSim.Services.Connectors
243 295
244 public string Store(AssetBase asset) 296 public string Store(AssetBase asset)
245 { 297 {
298 if (m_Cache != null)
299 m_Cache.Cache(asset);
246 if (asset.Temporary || asset.Local) 300 if (asset.Temporary || asset.Local)
247 { 301 {
248 if (m_Cache != null)
249 m_Cache.Cache(asset);
250
251 return asset.ID; 302 return asset.ID;
252 } 303 }
253 304
@@ -257,24 +308,57 @@ namespace OpenSim.Services.Connectors
257 try 308 try
258 { 309 {
259 newID = SynchronousRestObjectRequester. 310 newID = SynchronousRestObjectRequester.
260 MakeRequest<AssetBase, string>("POST", uri, asset); 311 MakeRequest<AssetBase, string>("POST", uri, asset, 25);
312 if (newID == null || newID == "")
313 {
314 newID = UUID.Zero.ToString();
315 }
261 } 316 }
262 catch (Exception e) 317 catch (Exception e)
263 { 318 {
264 m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); 319 newID = UUID.Zero.ToString();
265 } 320 }
266 321
267 if (newID != String.Empty) 322 if (newID == UUID.Zero.ToString())
323 {
324 //The asset upload failed, put it in a queue for later
325 asset.UploadAttempts++;
326 if (asset.UploadAttempts > 30)
327 {
328 //By this stage we've been in the queue for a good few hours;
329 //We're going to drop the asset.
330 m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString());
331 }
332 else
333 {
334 if (!m_retryQueue.ContainsKey(asset.UploadAttempts))
335 {
336 m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>());
337 }
338 List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts];
339 m_queue.Add(asset);
340 m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString());
341 m_retryTimer.Start();
342 }
343 }
344 else
268 { 345 {
269 // Placing this here, so that this work with old asset servers that don't send any reply back 346 if (asset.UploadAttempts > 0)
270 // SynchronousRestObjectRequester returns somethins that is not an empty string 347 {
271 if (newID != null) 348 m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString());
272 asset.ID = newID; 349 }
350 if (newID != String.Empty)
351 {
352 // Placing this here, so that this work with old asset servers that don't send any reply back
353 // SynchronousRestObjectRequester returns somethins that is not an empty string
354 if (newID != null)
355 asset.ID = newID;
273 356
274 if (m_Cache != null) 357 if (m_Cache != null)
275 m_Cache.Cache(asset); 358 m_Cache.Cache(asset);
359 }
276 } 360 }
277 return newID; 361 return asset.ID;
278 } 362 }
279 363
280 public bool UpdateContent(string id, byte[] data) 364 public bool UpdateContent(string id, byte[] data)
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 0430ef6..bc0bc54 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -158,17 +158,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
158 try 158 try
159 { 159 {
160 WebClient c = new WebClient(); 160 WebClient c = new WebClient();
161 //m_log.Debug("JPEG: " + imageURL);
161 string name = regionID.ToString(); 162 string name = regionID.ToString();
162 filename = Path.Combine(storagePath, name + ".jpg"); 163 filename = Path.Combine(storagePath, name + ".jpg");
163 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); 164 c.DownloadFile(imageURL, filename);
164 if (!File.Exists(filename))
165 {
166 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading...");
167 c.DownloadFile(imageURL, filename);
168 }
169 else
170 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
171
172 bitmap = new Bitmap(filename); 165 bitmap = new Bitmap(filename);
173 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); 166 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
174 byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true); 167 byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
@@ -179,11 +172,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
179 172
180 ass.Data = imageData; 173 ass.Data = imageData;
181 174
182 mapTile = ass.FullID;
183
184 // finally
185 m_AssetService.Store(ass); 175 m_AssetService.Store(ass);
186 176
177 // finally
178 mapTile = ass.FullID;
187 } 179 }
188 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke 180 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
189 { 181 {
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 63aabad..2c36bf5 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -98,8 +98,6 @@ namespace OpenSim.Services.Connectors.Hypergrid
98 throw new Exception("UserAgent connector init error"); 98 throw new Exception("UserAgent connector init error");
99 } 99 }
100 m_ServerURL = serviceURI; 100 m_ServerURL = serviceURI;
101 if (!m_ServerURL.EndsWith("/"))
102 m_ServerURL += "/";
103 101
104 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); 102 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
105 } 103 }
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index 30a73a4..833e22a 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -130,4 +130,4 @@ namespace OpenSim.Services.Connectors
130 return landData; 130 return landData;
131 } 131 }
132 } 132 }
133} \ No newline at end of file 133}
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 7238afc..e16dc36 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -299,6 +299,17 @@ namespace OpenSim.Services.Connectors
299 { 299 {
300 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); 300 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]);
301 } 301 }
302 else
303 {
304 if (replyData["result"].ToString() == "null")
305 return null;
306
307 m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString());
308 }
309 }
310 else
311 {
312 m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for sessionID {0}", sessionID.ToString());
302 } 313 }
303 314
304 return pinfo; 315 return pinfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 918544f..feea196 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
31using System.IO; 33using System.IO;
32using System.Net; 34using System.Net;
33using System.Reflection; 35using System.Reflection;
@@ -100,6 +102,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
100 102
101 public string RegisterRegion(UUID scopeID, GridRegion regionInfo) 103 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
102 { 104 {
105 IPEndPoint ext = regionInfo.ExternalEndPoint;
106 if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint";
107 // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service
108// Scene scene;
109// if (m_scenes.TryGetValue(regionInfo.RegionID, out scene))
110// UploadMapTile(scene);
111// else
112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
113
103 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
104 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
105 116
@@ -108,7 +119,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
108 { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, 119 { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
109 { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, 120 { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) },
110 { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, 121 { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) },
111 { "ExternalAddress", OSD.FromString(regionInfo.ExternalEndPoint.Address.ToString()) }, 122 { "ExternalAddress", OSD.FromString(ext.Address.ToString()) },
112 { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, 123 { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) },
113 { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, 124 { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) },
114 { "Access", OSD.FromInteger(regionInfo.Access) }, 125 { "Access", OSD.FromInteger(regionInfo.Access) },
@@ -371,6 +382,83 @@ namespace OpenSim.Services.Connectors.SimianGrid
371 382
372 #endregion IGridService 383 #endregion IGridService
373 384
385 private void UploadMapTile(IScene scene)
386 {
387 string errorMessage = null;
388
389 // Create a PNG map tile and upload it to the AddMapTile API
390 byte[] pngData = Utils.EmptyBytes;
391 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
392 if (tileGenerator == null)
393 {
394 m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
395 return;
396 }
397
398 using (Image mapTile = tileGenerator.CreateMapTile())
399 {
400 using (MemoryStream stream = new MemoryStream())
401 {
402 mapTile.Save(stream, ImageFormat.Png);
403 pngData = stream.ToArray();
404 }
405 }
406
407 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
408 {
409 new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
410 new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
411 new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
412 };
413
414 // Make the remote storage request
415 try
416 {
417 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
418
419 HttpWebResponse response = MultipartForm.Post(request, postParameters);
420 using (Stream responseStream = response.GetResponseStream())
421 {
422 string responseStr = null;
423
424 try
425 {
426 responseStr = responseStream.GetStreamString();
427 OSD responseOSD = OSDParser.Deserialize(responseStr);
428 if (responseOSD.Type == OSDType.Map)
429 {
430 OSDMap responseMap = (OSDMap)responseOSD;
431 if (responseMap["Success"].AsBoolean())
432 m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
433 else
434 errorMessage = "Upload failed: " + responseMap["Message"].AsString();
435 }
436 else
437 {
438 errorMessage = "Response format was invalid:\n" + responseStr;
439 }
440 }
441 catch (Exception ex)
442 {
443 if (!String.IsNullOrEmpty(responseStr))
444 errorMessage = "Failed to parse the response:\n" + responseStr;
445 else
446 errorMessage = "Failed to retrieve the response: " + ex.Message;
447 }
448 }
449 }
450 catch (WebException ex)
451 {
452 errorMessage = ex.Message;
453 }
454
455 if (!String.IsNullOrEmpty(errorMessage))
456 {
457 m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
458 pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' '));
459 }
460 }
461
374 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) 462 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
375 { 463 {
376 NameValueCollection requestArgs = new NameValueCollection 464 NameValueCollection requestArgs = new NameValueCollection
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 91e2976..801b424 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -191,6 +191,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
191 return accounts; 191 return accounts;
192 } 192 }
193 193
194 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
195 {
196 return null;
197 }
198
194 public bool StoreUserAccount(UserAccount data) 199 public bool StoreUserAccount(UserAccount data)
195 { 200 {
196// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 201// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 7cbd361..6fb583c 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -337,6 +337,10 @@ namespace OpenSim.Services.Connectors.Simulation
337 return false; 337 return false;
338 } 338 }
339 339
340 OSDMap resp = (OSDMap)result["_Result"];
341 success = resp["success"].AsBoolean();
342 reason = resp["reason"].AsString();
343
340 return success; 344 return success;
341 } 345 }
342 catch (Exception e) 346 catch (Exception e)
@@ -365,9 +369,7 @@ namespace OpenSim.Services.Connectors.Simulation
365 return true; 369 return true;
366 } 370 }
367 371
368 /// <summary> 372 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
369 /// </summary>
370 public bool CloseAgent(GridRegion destination, UUID id)
371 { 373 {
372 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); 374 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
373 375
@@ -385,6 +387,16 @@ namespace OpenSim.Services.Connectors.Simulation
385 return true; 387 return true;
386 } 388 }
387 389
390 public bool CloseChildAgent(GridRegion destination, UUID id)
391 {
392 return CloseAgent(destination, id, true);
393 }
394
395 public bool CloseAgent(GridRegion destination, UUID id)
396 {
397 return CloseAgent(destination, id, false);
398 }
399
388 #endregion Agents 400 #endregion Agents
389 401
390 #region Objects 402 #region Objects
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
index f6835b9..60f3abe 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
@@ -186,6 +186,11 @@ namespace OpenSim.Services.Connectors
186 return accounts; 186 return accounts;
187 } 187 }
188 188
189 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where)
190 {
191 return null; // Not implemented for regions
192 }
193
189 public virtual bool StoreUserAccount(UserAccount data) 194 public virtual bool StoreUserAccount(UserAccount data)
190 { 195 {
191 Dictionary<string, object> sendData = new Dictionary<string, object>(); 196 Dictionary<string, object> sendData = new Dictionary<string, object>();
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 83ec122..186ca71 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -174,7 +174,6 @@ namespace OpenSim.Services.GridService
174 174
175 #region Link Region 175 #region Link Region
176 176
177 // from map search
178 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 177 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
179 { 178 {
180 string reason = string.Empty; 179 string reason = string.Empty;
@@ -184,7 +183,7 @@ namespace OpenSim.Services.GridService
184 183
185 private static Random random = new Random(); 184 private static Random random = new Random();
186 185
187 // From the command line link-region (obsolete) and the map 186 // From the command line link-region
188 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 187 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
189 { 188 {
190 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 189 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -193,54 +192,19 @@ namespace OpenSim.Services.GridService
193 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 192 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
194 { 193 {
195 reason = string.Empty; 194 reason = string.Empty;
196 GridRegion regInfo = null; 195 uint port = 0;
197 196 string[] parts = mapName.Split(new char[] {':'});
198 if (!mapName.StartsWith("http")) 197 string regionName = String.Empty;
198 if (parts.Length > 1)
199 { 199 {
200 string host = "127.0.0.1"; 200 regionName = mapName.Substring(parts[0].Length + 1);
201 string portstr; 201 regionName = regionName.Trim(new char[] {'"'});
202 string regionName = "";
203 uint port = 0;
204 string[] parts = mapName.Split(new char[] { ':' });
205 if (parts.Length >= 1)
206 {
207 host = parts[0];
208 }
209 if (parts.Length >= 2)
210 {
211 portstr = parts[1];
212 //m_log.Debug("-- port = " + portstr);
213 if (!UInt32.TryParse(portstr, out port))
214 regionName = parts[1];
215 }
216 // always take the last one
217 if (parts.Length >= 3)
218 {
219 regionName = parts[2];
220 }
221
222
223 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
224 if (success)
225 {
226 regInfo.RegionName = mapName;
227 return regInfo;
228 }
229 } 202 }
230 else 203 GridRegion regInfo;
204 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
231 { 205 {
232 string[] parts = mapName.Split(new char[] {' '}); 206 regInfo.RegionName = mapName;
233 string regionName = String.Empty; 207 return regInfo;
234 if (parts.Length > 1)
235 {
236 regionName = mapName.Substring(parts[0].Length + 1);
237 regionName = regionName.Trim(new char[] {'"'});
238 }
239 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
240 {
241 regInfo.RegionName = mapName;
242 return regInfo;
243 }
244 } 208 }
245 209
246 return null; 210 return null;
@@ -253,7 +217,7 @@ namespace OpenSim.Services.GridService
253 217
254 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) 218 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
255 { 219 {
256 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 220 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
257 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 221 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
258 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 222 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
259 223
@@ -376,7 +340,7 @@ namespace OpenSim.Services.GridService
376 regInfo.RegionSecret = handle.ToString(); 340 regInfo.RegionSecret = handle.ToString();
377 341
378 AddHyperlinkRegion(regInfo, handle); 342 AddHyperlinkRegion(regInfo, handle);
379 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 343 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
380 return true; 344 return true;
381 } 345 }
382 346
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs
index 65f9dd5..e0a3e61 100644
--- a/OpenSim/Services/HypergridService/UserAccountCache.cs
+++ b/OpenSim/Services/HypergridService/UserAccountCache.cs
@@ -90,6 +90,11 @@ namespace OpenSim.Services.HypergridService
90 return null; 90 return null;
91 } 91 }
92 92
93 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
94 {
95 return null;
96 }
97
93 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 98 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
94 { 99 {
95 return null; 100 return null;
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 1559cf3..ac53583 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -301,13 +301,11 @@ namespace OpenSim.Services.HypergridService
301 301
302 if (m_TravelingAgents.ContainsKey(sessionID)) 302 if (m_TravelingAgents.ContainsKey(sessionID))
303 { 303 {
304 bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || 304 m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}",
305 m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed 305 m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress);
306
307 m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}",
308 reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result);
309 306
310 return result; 307 return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
308 m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
311 } 309 }
312 310
313 return false; 311 return false;
diff --git a/OpenSim/Services/Interfaces/IAttachmentsService.cs b/OpenSim/Services/Interfaces/IAttachmentsService.cs
new file mode 100644
index 0000000..bdde369
--- /dev/null
+++ b/OpenSim/Services/Interfaces/IAttachmentsService.cs
@@ -0,0 +1,17 @@
1////////////////////////////////////////////////////////////////
2//
3// (c) 2009, 2010 Careminster Limited and Melanie Thielker
4//
5// All rights reserved
6//
7using System;
8using Nini.Config;
9
10namespace OpenSim.Services.Interfaces
11{
12 public interface IAttachmentsService
13 {
14 string Get(string id);
15 void Store(string id, string data);
16 }
17}
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 41dd20c..a084309 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -306,9 +306,13 @@ namespace OpenSim.Services.Interfaces
306 } 306 }
307 catch (SocketException e) 307 catch (SocketException e)
308 { 308 {
309 throw new Exception( 309 /*throw new Exception(
310 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + 310 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
311 e + "' attached to this exception", e); 311 e + "' attached to this exception", e);*/
312 // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
313 // Reason is, on systems such as OSgrid it has occured that known hostnames stop
314 // resolving and thus make surrounding regions crash out with this exception.
315 return null;
312 } 316 }
313 317
314 return new IPEndPoint(ia, m_internalEndPoint.Port); 318 return new IPEndPoint(ia, m_internalEndPoint.Port);
@@ -366,6 +370,12 @@ namespace OpenSim.Services.Interfaces
366 if (kvp.ContainsKey("regionName")) 370 if (kvp.ContainsKey("regionName"))
367 RegionName = (string)kvp["regionName"]; 371 RegionName = (string)kvp["regionName"];
368 372
373 if (kvp.ContainsKey("access"))
374 {
375 byte access = Convert.ToByte((string)kvp["access"]);
376 Maturity = (int)Util.ConvertAccessLevelToMaturity(access);
377 }
378
369 if (kvp.ContainsKey("serverIP")) 379 if (kvp.ContainsKey("serverIP"))
370 { 380 {
371 //int port = 0; 381 //int port = 0;
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 5f9ce6d..ae6bd72 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -80,6 +80,14 @@ namespace OpenSim.Services.Interfaces
80 bool ReleaseAgent(UUID originRegion, UUID id, string uri); 80 bool ReleaseAgent(UUID originRegion, UUID id, string uri);
81 81
82 /// <summary> 82 /// <summary>
83 /// Close child agent.
84 /// </summary>
85 /// <param name="regionHandle"></param>
86 /// <param name="id"></param>
87 /// <returns></returns>
88 bool CloseChildAgent(GridRegion destination, UUID id);
89
90 /// <summary>
83 /// Close agent. 91 /// Close agent.
84 /// </summary> 92 /// </summary>
85 /// <param name="regionHandle"></param> 93 /// <param name="regionHandle"></param>
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 9c992e0..a91aa0f 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Services.Interfaces
63 public int UserLevel; 63 public int UserLevel;
64 public int UserFlags; 64 public int UserFlags;
65 public string UserTitle; 65 public string UserTitle;
66 public string UserCountry;
66 67
67 public Dictionary<string, object> ServiceURLs; 68 public Dictionary<string, object> ServiceURLs;
68 69
@@ -91,6 +92,8 @@ namespace OpenSim.Services.Interfaces
91 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString()); 92 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString());
92 if (kvp.ContainsKey("UserTitle")) 93 if (kvp.ContainsKey("UserTitle"))
93 UserTitle = kvp["UserTitle"].ToString(); 94 UserTitle = kvp["UserTitle"].ToString();
95 if (kvp.ContainsKey("UserCountry"))
96 UserCountry = kvp["UserCountry"].ToString();
94 97
95 if (kvp.ContainsKey("Created")) 98 if (kvp.ContainsKey("Created"))
96 Created = Convert.ToInt32(kvp["Created"].ToString()); 99 Created = Convert.ToInt32(kvp["Created"].ToString());
@@ -124,6 +127,7 @@ namespace OpenSim.Services.Interfaces
124 result["UserLevel"] = UserLevel.ToString(); 127 result["UserLevel"] = UserLevel.ToString();
125 result["UserFlags"] = UserFlags.ToString(); 128 result["UserFlags"] = UserFlags.ToString();
126 result["UserTitle"] = UserTitle; 129 result["UserTitle"] = UserTitle;
130 result["UserCountry"] = UserCountry;
127 131
128 string str = string.Empty; 132 string str = string.Empty;
129 foreach (KeyValuePair<string, object> kvp in ServiceURLs) 133 foreach (KeyValuePair<string, object> kvp in ServiceURLs)
@@ -150,6 +154,7 @@ namespace OpenSim.Services.Interfaces
150 /// <param name="query"></param> 154 /// <param name="query"></param>
151 /// <returns></returns> 155 /// <returns></returns>
152 List<UserAccount> GetUserAccounts(UUID scopeID, string query); 156 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
157 List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where);
153 158
154 /// <summary> 159 /// <summary>
155 /// Store the data given, wich replaces the stored data, therefore must be complete. 160 /// Store the data given, wich replaces the stored data, therefore must be complete.
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 1a874c8..de05f28 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.LLLoginService
55 public static LLFailedLoginResponse InventoryProblem; 55 public static LLFailedLoginResponse InventoryProblem;
56 public static LLFailedLoginResponse DeadRegionProblem; 56 public static LLFailedLoginResponse DeadRegionProblem;
57 public static LLFailedLoginResponse LoginBlockedProblem; 57 public static LLFailedLoginResponse LoginBlockedProblem;
58 public static LLFailedLoginResponse UnverifiedAccountProblem;
58 public static LLFailedLoginResponse AlreadyLoggedInProblem; 59 public static LLFailedLoginResponse AlreadyLoggedInProblem;
59 public static LLFailedLoginResponse InternalError; 60 public static LLFailedLoginResponse InternalError;
60 61
@@ -75,6 +76,10 @@ namespace OpenSim.Services.LLLoginService
75 LoginBlockedProblem = new LLFailedLoginResponse("presence", 76 LoginBlockedProblem = new LLFailedLoginResponse("presence",
76 "Logins are currently restricted. Please try again later.", 77 "Logins are currently restricted. Please try again later.",
77 "false"); 78 "false");
79 UnverifiedAccountProblem = new LLFailedLoginResponse("presence",
80 "Your account has not yet been verified. Please check " +
81 "your email and click the provided link.",
82 "false");
78 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", 83 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence",
79 "You appear to be already logged in. " + 84 "You appear to be already logged in. " +
80 "If this is not the case please wait for your session to timeout. " + 85 "If this is not the case please wait for your session to timeout. " +
@@ -327,6 +332,7 @@ namespace OpenSim.Services.LLLoginService
327 private void FillOutRegionData(GridRegion destination) 332 private void FillOutRegionData(GridRegion destination)
328 { 333 {
329 IPEndPoint endPoint = destination.ExternalEndPoint; 334 IPEndPoint endPoint = destination.ExternalEndPoint;
335 if (endPoint == null) return;
330 SimAddress = endPoint.Address.ToString(); 336 SimAddress = endPoint.Address.ToString();
331 SimPort = (uint)endPoint.Port; 337 SimPort = (uint)endPoint.Port;
332 RegionX = (uint)destination.RegionLocX; 338 RegionX = (uint)destination.RegionLocX;
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 6fec276..d8a2054 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -129,7 +129,8 @@ namespace OpenSim.Services.LLLoginService
129 Object[] args = new Object[] { config }; 129 Object[] args = new Object[] { config };
130 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 130 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
131 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); 131 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
132 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); 132 Object[] authArgs = new Object[] { config, m_UserAccountService };
133 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs);
133 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); 134 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
134 135
135 if (gridService != string.Empty) 136 if (gridService != string.Empty)
@@ -272,6 +273,12 @@ namespace OpenSim.Services.LLLoginService
272 return LLFailedLoginResponse.UserProblem; 273 return LLFailedLoginResponse.UserProblem;
273 } 274 }
274 275
276 if (account.UserLevel < 0)
277 {
278 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: Unverified account");
279 return LLFailedLoginResponse.UnverifiedAccountProblem;
280 }
281
275 if (account.UserLevel < m_MinLoginLevel) 282 if (account.UserLevel < m_MinLoginLevel)
276 { 283 {
277 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); 284 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel);
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index e071b94..4c6122d 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -173,6 +173,10 @@ namespace OpenSim.Services.UserAccountService
173 Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); 173 Int32.TryParse(d.Data["UserLevel"], out u.UserLevel);
174 if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) 174 if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null)
175 Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); 175 Int32.TryParse(d.Data["UserFlags"], out u.UserFlags);
176 if (d.Data.ContainsKey("UserCountry") && d.Data["UserCountry"] != null)
177 u.UserCountry = d.Data["UserCountry"].ToString();
178 else
179 u.UserTitle = string.Empty;
176 180
177 if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) 181 if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null)
178 { 182 {
@@ -294,7 +298,22 @@ namespace OpenSim.Services.UserAccountService
294 298
295 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 299 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
296 { 300 {
297 UserAccountData[] d = m_Database.GetUsers(scopeID, query); 301 UserAccountData[] d = m_Database.GetUsers(scopeID, query.Trim());
302
303 if (d == null)
304 return new List<UserAccount>();
305
306 List<UserAccount> ret = new List<UserAccount>();
307
308 foreach (UserAccountData data in d)
309 ret.Add(MakeUserAccount(data));
310
311 return ret;
312 }
313
314 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where)
315 {
316 UserAccountData[] d = m_Database.GetUsersWhere(scopeID, where);
298 317
299 if (d == null) 318 if (d == null)
300 return new List<UserAccount>(); 319 return new List<UserAccount>();