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.cs9
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs64
-rw-r--r--OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs5
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs197
-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, 464 insertions, 122 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 4f4cbf6..d4bfe8f 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -168,7 +168,10 @@ namespace OpenSim.Services.AssetService
168 { 168 {
169// m_log.DebugFormat( 169// m_log.DebugFormat(
170// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); 170// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
171 m_Database.StoreAsset(asset); 171 if (!m_Database.StoreAsset(asset))
172 {
173 return UUID.Zero.ToString();
174 }
172 } 175 }
173// else 176// else
174// { 177// {
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
index 229f557..e42f9a0 100644
--- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
+++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
@@ -30,10 +30,11 @@ using OpenMetaverse;
30using log4net; 30using log4net;
31using Nini.Config; 31using Nini.Config;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
33using OpenSim.Data; 35using OpenSim.Data;
34using OpenSim.Framework; 36using OpenSim.Framework;
35using OpenSim.Services.Base; 37using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces;
37 38
38namespace OpenSim.Services.AuthenticationService 39namespace OpenSim.Services.AuthenticationService
39{ 40{
@@ -50,6 +51,12 @@ namespace OpenSim.Services.AuthenticationService
50 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
51 52
52 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 }
53 60
54 public AuthenticationServiceBase(IConfigSource config) : base(config) 61 public AuthenticationServiceBase(IConfigSource config) : base(config)
55 { 62 {
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 14d96cb..d5a6521 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,32 +64,65 @@ 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);
62 72
63 if (data == null) 73 if (data == null || data.Data == null)
64 { 74 {
65 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} not found", principalID); 75 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
66 return String.Empty; 76 return String.Empty;
67 } 77 }
68 else if (data.Data == null) 78
79 if (!data.Data.ContainsKey("passwordHash") ||
80 !data.Data.ContainsKey("passwordSalt"))
69 { 81 {
70 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} data not found", principalID);
71 return String.Empty; 82 return String.Empty;
72 } 83 }
73 else if (!data.Data.ContainsKey("passwordHash") || !data.Data.ContainsKey("passwordSalt")) 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());
89
90 if (data.Data["passwordHash"].ToString() == hashed)
91 {
92 return GetToken(principalID, lifetime);
93 }
94
95 if (user == null)
74 { 96 {
75 m_log.DebugFormat( 97 m_log.DebugFormat("[PASS AUTH]: No user record for {0}", principalID);
76 "[AUTH SERVICE]: PrincipalID {0} data didn't contain either passwordHash or passwordSalt", principalID);
77 return String.Empty; 98 return String.Empty;
78 } 99 }
79 else 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)
80 { 111 {
81 string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); 112 data = m_Database.Get(a.PrincipalID);
113 if (data == null || data.Data == null ||
114 !data.Data.ContainsKey("passwordHash") ||
115 !data.Data.ContainsKey("passwordSalt"))
116 {
117 continue;
118 }
82 119
83 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); 120 hashed = Util.Md5Hash(password + ":" +
121 data.Data["passwordSalt"].ToString());
84 122
85 if (data.Data["passwordHash"].ToString() == hashed) 123 if (data.Data["passwordHash"].ToString() == hashed)
86 { 124 {
125 m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID);
87 return GetToken(principalID, lifetime); 126 return GetToken(principalID, lifetime);
88 } 127 }
89 else 128 else
@@ -94,6 +133,9 @@ namespace OpenSim.Services.AuthenticationService
94 return String.Empty; 133 return String.Empty;
95 } 134 }
96 } 135 }
136
137 m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID);
138 return String.Empty;
97 } 139 }
98 } 140 }
99} \ No newline at end of file 141}
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 e4c3eaf..9bd04ed 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,13 +48,15 @@ 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.
54 // Maps: Asset ID -> Handlers which will be called when the asset has been loaded 57 // Maps: Asset ID -> Handlers which will be called when the asset has been loaded
55 private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); 58 private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>();
56 59 private Dictionary<string, string> m_UriMap = new Dictionary<string, string>();
57 60
58 public AssetServicesConnector() 61 public AssetServicesConnector()
59 { 62 {
@@ -87,7 +90,86 @@ namespace OpenSim.Services.Connectors
87 throw new Exception("Asset connector init error"); 90 throw new Exception("Asset connector init error");
88 } 91 }
89 92
90 m_ServerURI = serviceURI; 93 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset",
94 "dump asset <id> <file>",
95 "dump one cached asset", HandleDumpAsset);
96
97 m_retryTimer = new Timer();
98 m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
99 m_retryTimer.Interval = 60000;
100
101 Uri serverUri = new Uri(m_ServerURI);
102
103 string groupHost = serverUri.Host;
104
105 for (int i = 0 ; i < 256 ; i++)
106 {
107 string prefix = i.ToString("x2");
108 groupHost = assetConfig.GetString("AssetServerHost_"+prefix, groupHost);
109
110 m_UriMap[prefix] = groupHost;
111 //m_log.DebugFormat("[ASSET]: Using {0} for prefix {1}", groupHost, prefix);
112 }
113 }
114
115 private string MapServer(string id)
116 {
117 UriBuilder serverUri = new UriBuilder(m_ServerURI);
118
119 string prefix = id.Substring(0, 2).ToLower();
120
121 string host = m_UriMap[prefix];
122
123 serverUri.Host = host;
124
125 // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix);
126
127 return serverUri.Uri.AbsoluteUri;
128 }
129
130 protected void retryCheck(object source, ElapsedEventArgs e)
131 {
132 m_retryCounter++;
133 if (m_retryCounter > 60) m_retryCounter -= 60;
134 List<int> keys = new List<int>();
135 foreach (int a in m_retryQueue.Keys)
136 {
137 keys.Add(a);
138 }
139 foreach (int a in keys)
140 {
141 //We exponentially fall back on frequency until we reach one attempt per hour
142 //The net result is that we end up in the queue for roughly 24 hours..
143 //24 hours worth of assets could be a lot, so the hope is that the region admin
144 //will have gotten the asset connector back online quickly!
145
146 int timefactor = a ^ 2;
147 if (timefactor > 60)
148 {
149 timefactor = 60;
150 }
151
152 //First, find out if we care about this timefactor
153 if (timefactor % a == 0)
154 {
155 //Yes, we do!
156 List<AssetBase> retrylist = m_retryQueue[a];
157 m_retryQueue.Remove(a);
158
159 foreach(AssetBase ass in retrylist)
160 {
161 Store(ass); //Store my ass. This function will put it back in the dictionary if it fails
162 }
163 }
164 }
165
166 if (m_retryQueue.Count == 0)
167 {
168 //It might only be one tick per minute, but I have
169 //repented and abandoned my wasteful ways
170 m_retryCounter = 0;
171 m_retryTimer.Stop();
172 }
91 } 173 }
92 174
93 protected void SetCache(IImprovedAssetCache cache) 175 protected void SetCache(IImprovedAssetCache cache)
@@ -97,15 +179,13 @@ namespace OpenSim.Services.Connectors
97 179
98 public AssetBase Get(string id) 180 public AssetBase Get(string id)
99 { 181 {
100// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id); 182 string uri = MapServer(id) + "/assets/" + id;
101
102 string uri = m_ServerURI + "/assets/" + id;
103 183
104 AssetBase asset = null; 184 AssetBase asset = null;
105 if (m_Cache != null) 185 if (m_Cache != null)
106 asset = m_Cache.Get(id); 186 asset = m_Cache.Get(id);
107 187
108 if (asset == null) 188 if (asset == null || asset.Data == null || asset.Data.Length == 0)
109 { 189 {
110 asset = SynchronousRestObjectRequester. 190 asset = SynchronousRestObjectRequester.
111 MakeRequest<int, AssetBase>("GET", uri, 0); 191 MakeRequest<int, AssetBase>("GET", uri, 0);
@@ -136,7 +216,7 @@ namespace OpenSim.Services.Connectors
136 return fullAsset.Metadata; 216 return fullAsset.Metadata;
137 } 217 }
138 218
139 string uri = m_ServerURI + "/assets/" + id + "/metadata"; 219 string uri = MapServer(id) + "/assets/" + id + "/metadata";
140 220
141 AssetMetadata asset = SynchronousRestObjectRequester. 221 AssetMetadata asset = SynchronousRestObjectRequester.
142 MakeRequest<int, AssetMetadata>("GET", uri, 0); 222 MakeRequest<int, AssetMetadata>("GET", uri, 0);
@@ -153,7 +233,7 @@ namespace OpenSim.Services.Connectors
153 return fullAsset.Data; 233 return fullAsset.Data;
154 } 234 }
155 235
156 RestClient rc = new RestClient(m_ServerURI); 236 RestClient rc = new RestClient(MapServer(id));
157 rc.AddResourcePath("assets"); 237 rc.AddResourcePath("assets");
158 rc.AddResourcePath(id); 238 rc.AddResourcePath(id);
159 rc.AddResourcePath("data"); 239 rc.AddResourcePath("data");
@@ -178,15 +258,13 @@ namespace OpenSim.Services.Connectors
178 258
179 public bool Get(string id, Object sender, AssetRetrieved handler) 259 public bool Get(string id, Object sender, AssetRetrieved handler)
180 { 260 {
181// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); 261 string uri = MapServer(id) + "/assets/" + id;
182
183 string uri = m_ServerURI + "/assets/" + id;
184 262
185 AssetBase asset = null; 263 AssetBase asset = null;
186 if (m_Cache != null) 264 if (m_Cache != null)
187 asset = m_Cache.Get(id); 265 asset = m_Cache.Get(id);
188 266
189 if (asset == null) 267 if (asset == null || asset.Data == null || asset.Data.Length == 0)
190 { 268 {
191 lock (m_AssetHandlers) 269 lock (m_AssetHandlers)
192 { 270 {
@@ -246,38 +324,95 @@ namespace OpenSim.Services.Connectors
246 324
247 public string Store(AssetBase asset) 325 public string Store(AssetBase asset)
248 { 326 {
249 if (asset.Temporary || asset.Local) 327 // Have to assign the asset ID here. This isn't likely to
328 // trigger since current callers don't pass emtpy IDs
329 // We need the asset ID to route the request to the proper
330 // cluster member, so we can't have the server assign one.
331 if (asset.ID == string.Empty)
250 { 332 {
251 if (m_Cache != null) 333 if (asset.FullID == UUID.Zero)
252 m_Cache.Cache(asset); 334 {
335 asset.FullID = UUID.Random();
336 }
337 asset.ID = asset.FullID.ToString();
338 }
339 else if (asset.FullID == UUID.Zero)
340 {
341 UUID uuid = UUID.Zero;
342 if (UUID.TryParse(asset.ID, out uuid))
343 {
344 asset.FullID = uuid;
345 }
346 else
347 {
348 asset.FullID = UUID.Random();
349 }
350 }
253 351
352 if (m_Cache != null)
353 m_Cache.Cache(asset);
354 if (asset.Temporary || asset.Local)
355 {
254 return asset.ID; 356 return asset.ID;
255 } 357 }
256 358
257 string uri = m_ServerURI + "/assets/"; 359 string uri = MapServer(asset.FullID.ToString()) + "/assets/";
258 360
259 string newID = string.Empty; 361 string newID = string.Empty;
260 try 362 try
261 { 363 {
262 newID = SynchronousRestObjectRequester. 364 newID = SynchronousRestObjectRequester.
263 MakeRequest<AssetBase, string>("POST", uri, asset); 365 MakeRequest<AssetBase, string>("POST", uri, asset, 25);
366 if (newID == null || newID == "")
367 {
368 newID = UUID.Zero.ToString();
369 }
264 } 370 }
265 catch (Exception e) 371 catch (Exception e)
266 { 372 {
267 m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); 373 newID = UUID.Zero.ToString();
268 } 374 }
269 375
270 if (newID != String.Empty) 376 if (newID == UUID.Zero.ToString())
377 {
378 //The asset upload failed, put it in a queue for later
379 asset.UploadAttempts++;
380 if (asset.UploadAttempts > 30)
381 {
382 //By this stage we've been in the queue for a good few hours;
383 //We're going to drop the asset.
384 m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString());
385 }
386 else
387 {
388 if (!m_retryQueue.ContainsKey(asset.UploadAttempts))
389 {
390 m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>());
391 }
392 List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts];
393 m_queue.Add(asset);
394 m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString());
395 m_retryTimer.Start();
396 }
397 }
398 else
271 { 399 {
272 // Placing this here, so that this work with old asset servers that don't send any reply back 400 if (asset.UploadAttempts > 0)
273 // SynchronousRestObjectRequester returns somethins that is not an empty string 401 {
274 if (newID != null) 402 m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString());
275 asset.ID = newID; 403 }
404 if (newID != String.Empty)
405 {
406 // Placing this here, so that this work with old asset servers that don't send any reply back
407 // SynchronousRestObjectRequester returns somethins that is not an empty string
408 if (newID != null)
409 asset.ID = newID;
276 410
277 if (m_Cache != null) 411 if (m_Cache != null)
278 m_Cache.Cache(asset); 412 m_Cache.Cache(asset);
413 }
279 } 414 }
280 return newID; 415 return asset.ID;
281 } 416 }
282 417
283 public bool UpdateContent(string id, byte[] data) 418 public bool UpdateContent(string id, byte[] data)
@@ -298,7 +433,7 @@ namespace OpenSim.Services.Connectors
298 } 433 }
299 asset.Data = data; 434 asset.Data = data;
300 435
301 string uri = m_ServerURI + "/assets/" + id; 436 string uri = MapServer(id) + "/assets/" + id;
302 437
303 if (SynchronousRestObjectRequester. 438 if (SynchronousRestObjectRequester.
304 MakeRequest<AssetBase, bool>("POST", uri, asset)) 439 MakeRequest<AssetBase, bool>("POST", uri, asset))
@@ -313,7 +448,7 @@ namespace OpenSim.Services.Connectors
313 448
314 public bool Delete(string id) 449 public bool Delete(string id)
315 { 450 {
316 string uri = m_ServerURI + "/assets/" + id; 451 string uri = MapServer(id) + "/assets/" + id;
317 452
318 if (SynchronousRestObjectRequester. 453 if (SynchronousRestObjectRequester.
319 MakeRequest<int, bool>("DELETE", uri, 0)) 454 MakeRequest<int, bool>("DELETE", uri, 0))
@@ -326,4 +461,4 @@ namespace OpenSim.Services.Connectors
326 return false; 461 return false;
327 } 462 }
328 } 463 }
329} \ No newline at end of file 464}
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 5b27cf6..d617aee 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 67a65ff..0e4d794 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) },
@@ -399,6 +410,83 @@ namespace OpenSim.Services.Connectors.SimianGrid
399 410
400 #endregion IGridService 411 #endregion IGridService
401 412
413 private void UploadMapTile(IScene scene)
414 {
415 string errorMessage = null;
416
417 // Create a PNG map tile and upload it to the AddMapTile API
418 byte[] pngData = Utils.EmptyBytes;
419 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
420 if (tileGenerator == null)
421 {
422 m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
423 return;
424 }
425
426 using (Image mapTile = tileGenerator.CreateMapTile())
427 {
428 using (MemoryStream stream = new MemoryStream())
429 {
430 mapTile.Save(stream, ImageFormat.Png);
431 pngData = stream.ToArray();
432 }
433 }
434
435 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
436 {
437 new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
438 new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
439 new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
440 };
441
442 // Make the remote storage request
443 try
444 {
445 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
446
447 HttpWebResponse response = MultipartForm.Post(request, postParameters);
448 using (Stream responseStream = response.GetResponseStream())
449 {
450 string responseStr = null;
451
452 try
453 {
454 responseStr = responseStream.GetStreamString();
455 OSD responseOSD = OSDParser.Deserialize(responseStr);
456 if (responseOSD.Type == OSDType.Map)
457 {
458 OSDMap responseMap = (OSDMap)responseOSD;
459 if (responseMap["Success"].AsBoolean())
460 m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
461 else
462 errorMessage = "Upload failed: " + responseMap["Message"].AsString();
463 }
464 else
465 {
466 errorMessage = "Response format was invalid:\n" + responseStr;
467 }
468 }
469 catch (Exception ex)
470 {
471 if (!String.IsNullOrEmpty(responseStr))
472 errorMessage = "Failed to parse the response:\n" + responseStr;
473 else
474 errorMessage = "Failed to retrieve the response: " + ex.Message;
475 }
476 }
477 }
478 catch (WebException ex)
479 {
480 errorMessage = ex.Message;
481 }
482
483 if (!String.IsNullOrEmpty(errorMessage))
484 {
485 m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
486 pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' '));
487 }
488 }
489
402 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) 490 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
403 { 491 {
404 NameValueCollection requestArgs = new NameValueCollection 492 NameValueCollection requestArgs = new NameValueCollection
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 4350749..f38ebe8 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 c45f456..24a23dd 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 78eab3d..46d68c2 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -176,7 +176,6 @@ namespace OpenSim.Services.GridService
176 176
177 #region Link Region 177 #region Link Region
178 178
179 // from map search
180 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 179 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
181 { 180 {
182 string reason = string.Empty; 181 string reason = string.Empty;
@@ -186,7 +185,7 @@ namespace OpenSim.Services.GridService
186 185
187 private static Random random = new Random(); 186 private static Random random = new Random();
188 187
189 // From the command line link-region (obsolete) and the map 188 // From the command line link-region
190 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 189 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
191 { 190 {
192 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 191 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -195,54 +194,19 @@ namespace OpenSim.Services.GridService
195 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 194 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
196 { 195 {
197 reason = string.Empty; 196 reason = string.Empty;
198 GridRegion regInfo = null; 197 uint port = 0;
199 198 string[] parts = mapName.Split(new char[] {':'});
200 if (!mapName.StartsWith("http")) 199 string regionName = String.Empty;
200 if (parts.Length > 1)
201 { 201 {
202 string host = "127.0.0.1"; 202 regionName = mapName.Substring(parts[0].Length + 1);
203 string portstr; 203 regionName = regionName.Trim(new char[] {'"'});
204 string regionName = "";
205 uint port = 0;
206 string[] parts = mapName.Split(new char[] { ':' });
207 if (parts.Length >= 1)
208 {
209 host = parts[0];
210 }
211 if (parts.Length >= 2)
212 {
213 portstr = parts[1];
214 //m_log.Debug("-- port = " + portstr);
215 if (!UInt32.TryParse(portstr, out port))
216 regionName = parts[1];
217 }
218 // always take the last one
219 if (parts.Length >= 3)
220 {
221 regionName = parts[2];
222 }
223
224
225 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
226 if (success)
227 {
228 regInfo.RegionName = mapName;
229 return regInfo;
230 }
231 } 204 }
232 else 205 GridRegion regInfo;
206 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
233 { 207 {
234 string[] parts = mapName.Split(new char[] {' '}); 208 regInfo.RegionName = mapName;
235 string regionName = String.Empty; 209 return regInfo;
236 if (parts.Length > 1)
237 {
238 regionName = mapName.Substring(parts[0].Length + 1);
239 regionName = regionName.Trim(new char[] {'"'});
240 }
241 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
242 {
243 regInfo.RegionName = mapName;
244 return regInfo;
245 }
246 } 210 }
247 211
248 return null; 212 return null;
@@ -255,7 +219,7 @@ namespace OpenSim.Services.GridService
255 219
256 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) 220 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)
257 { 221 {
258 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 222 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
259 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 223 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
260 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 224 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
261 225
@@ -378,7 +342,7 @@ namespace OpenSim.Services.GridService
378 regInfo.RegionSecret = handle.ToString(); 342 regInfo.RegionSecret = handle.ToString();
379 343
380 AddHyperlinkRegion(regInfo, handle); 344 AddHyperlinkRegion(regInfo, handle);
381 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 345 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
382 return true; 346 return true;
383 } 347 }
384 348
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 f681df4..1a839f3 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -309,13 +309,11 @@ namespace OpenSim.Services.HypergridService
309 309
310 if (m_TravelingAgents.ContainsKey(sessionID)) 310 if (m_TravelingAgents.ContainsKey(sessionID))
311 { 311 {
312 bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || 312 m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}",
313 m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed 313 m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress);
314
315 m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}",
316 reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result);
317 314
318 return result; 315 return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
316 m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
319 } 317 }
320 318
321 return false; 319 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 7137f9a..2b0b947 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -321,9 +321,13 @@ namespace OpenSim.Services.Interfaces
321 } 321 }
322 catch (SocketException e) 322 catch (SocketException e)
323 { 323 {
324 throw new Exception( 324 /*throw new Exception(
325 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + 325 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
326 e + "' attached to this exception", e); 326 e + "' attached to this exception", e);*/
327 // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
328 // Reason is, on systems such as OSgrid it has occured that known hostnames stop
329 // resolving and thus make surrounding regions crash out with this exception.
330 return null;
327 } 331 }
328 332
329 return new IPEndPoint(ia, m_internalEndPoint.Port); 333 return new IPEndPoint(ia, m_internalEndPoint.Port);
@@ -381,6 +385,12 @@ namespace OpenSim.Services.Interfaces
381 if (kvp.ContainsKey("regionName")) 385 if (kvp.ContainsKey("regionName"))
382 RegionName = (string)kvp["regionName"]; 386 RegionName = (string)kvp["regionName"];
383 387
388 if (kvp.ContainsKey("access"))
389 {
390 byte access = Convert.ToByte((string)kvp["access"]);
391 Maturity = (int)Util.ConvertAccessLevelToMaturity(access);
392 }
393
384 if (kvp.ContainsKey("serverIP")) 394 if (kvp.ContainsKey("serverIP"))
385 { 395 {
386 //int port = 0; 396 //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 1b85980..6d5d2a0 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Services.Interfaces
91 public int UserLevel; 91 public int UserLevel;
92 public int UserFlags; 92 public int UserFlags;
93 public string UserTitle; 93 public string UserTitle;
94 public string UserCountry;
94 public Boolean LocalToGrid = true; 95 public Boolean LocalToGrid = true;
95 96
96 public Dictionary<string, object> ServiceURLs; 97 public Dictionary<string, object> ServiceURLs;
@@ -120,6 +121,8 @@ namespace OpenSim.Services.Interfaces
120 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString()); 121 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString());
121 if (kvp.ContainsKey("UserTitle")) 122 if (kvp.ContainsKey("UserTitle"))
122 UserTitle = kvp["UserTitle"].ToString(); 123 UserTitle = kvp["UserTitle"].ToString();
124 if (kvp.ContainsKey("UserCountry"))
125 UserCountry = kvp["UserCountry"].ToString();
123 if (kvp.ContainsKey("LocalToGrid")) 126 if (kvp.ContainsKey("LocalToGrid"))
124 Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid); 127 Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid);
125 128
@@ -155,6 +158,7 @@ namespace OpenSim.Services.Interfaces
155 result["UserLevel"] = UserLevel.ToString(); 158 result["UserLevel"] = UserLevel.ToString();
156 result["UserFlags"] = UserFlags.ToString(); 159 result["UserFlags"] = UserFlags.ToString();
157 result["UserTitle"] = UserTitle; 160 result["UserTitle"] = UserTitle;
161 result["UserCountry"] = UserCountry;
158 result["LocalToGrid"] = LocalToGrid.ToString(); 162 result["LocalToGrid"] = LocalToGrid.ToString();
159 163
160 string str = string.Empty; 164 string str = string.Empty;
@@ -182,6 +186,7 @@ namespace OpenSim.Services.Interfaces
182 /// <param name="query"></param> 186 /// <param name="query"></param>
183 /// <returns></returns> 187 /// <returns></returns>
184 List<UserAccount> GetUserAccounts(UUID scopeID, string query); 188 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
189 List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where);
185 190
186 /// <summary> 191 /// <summary>
187 /// Store the data given, wich replaces the stored data, therefore must be complete. 192 /// 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 02b5cc1..035980d 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -132,7 +132,8 @@ namespace OpenSim.Services.LLLoginService
132 Object[] args = new Object[] { config }; 132 Object[] args = new Object[] { config };
133 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 133 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
134 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); 134 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
135 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); 135 Object[] authArgs = new Object[] { config, m_UserAccountService };
136 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs);
136 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); 137 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
137 138
138 if (gridService != string.Empty) 139 if (gridService != string.Empty)
@@ -275,6 +276,12 @@ namespace OpenSim.Services.LLLoginService
275 return LLFailedLoginResponse.UserProblem; 276 return LLFailedLoginResponse.UserProblem;
276 } 277 }
277 278
279 if (account.UserLevel < 0)
280 {
281 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: Unverified account");
282 return LLFailedLoginResponse.UnverifiedAccountProblem;
283 }
284
278 if (account.UserLevel < m_MinLoginLevel) 285 if (account.UserLevel < m_MinLoginLevel)
279 { 286 {
280 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); 287 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 4a29690..ad06300 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -170,6 +170,10 @@ namespace OpenSim.Services.UserAccountService
170 Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); 170 Int32.TryParse(d.Data["UserLevel"], out u.UserLevel);
171 if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) 171 if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null)
172 Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); 172 Int32.TryParse(d.Data["UserFlags"], out u.UserFlags);
173 if (d.Data.ContainsKey("UserCountry") && d.Data["UserCountry"] != null)
174 u.UserCountry = d.Data["UserCountry"].ToString();
175 else
176 u.UserTitle = string.Empty;
173 177
174 if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) 178 if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null)
175 { 179 {
@@ -291,7 +295,22 @@ namespace OpenSim.Services.UserAccountService
291 295
292 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 296 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
293 { 297 {
294 UserAccountData[] d = m_Database.GetUsers(scopeID, query); 298 UserAccountData[] d = m_Database.GetUsers(scopeID, query.Trim());
299
300 if (d == null)
301 return new List<UserAccount>();
302
303 List<UserAccount> ret = new List<UserAccount>();
304
305 foreach (UserAccountData data in d)
306 ret.Add(MakeUserAccount(data));
307
308 return ret;
309 }
310
311 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where)
312 {
313 UserAccountData[] d = m_Database.GetUsersWhere(scopeID, where);
295 314
296 if (d == null) 315 if (d == null)
297 return new List<UserAccount>(); 316 return new List<UserAccount>();