diff options
Diffstat (limited to 'OpenSim/Services')
23 files changed, 404 insertions, 110 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 851b7b4..005051a 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -165,10 +165,11 @@ namespace OpenSim.Services.AssetService | |||
165 | 165 | ||
166 | public virtual string Store(AssetBase asset) | 166 | public virtual string Store(AssetBase asset) |
167 | { | 167 | { |
168 | // m_log.DebugFormat( | 168 | //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); |
169 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); | 169 | if (!m_Database.StoreAsset(asset)) |
170 | 170 | { | |
171 | m_Database.StoreAsset(asset); | 171 | return UUID.Zero.ToString(); |
172 | } | ||
172 | 173 | ||
173 | return asset.ID; | 174 | return asset.ID; |
174 | } | 175 | } |
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; | |||
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Services.Base; | 33 | using OpenSim.Services.Base; |
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Data; | 36 | using OpenSim.Data; |
35 | using OpenSim.Framework; | 37 | using 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 f1da4fa..565e4f2 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | |||
@@ -30,6 +30,7 @@ using System; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Timers; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 36 | using 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 | public AssetServicesConnector() | 54 | public AssetServicesConnector() |
52 | { | 55 | { |
53 | } | 56 | } |
@@ -84,6 +87,55 @@ namespace OpenSim.Services.Connectors | |||
84 | MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", | 87 | MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", |
85 | "dump asset <id> <file>", | 88 | "dump asset <id> <file>", |
86 | "dump one cached asset", HandleDumpAsset); | 89 | "dump one cached asset", HandleDumpAsset); |
90 | |||
91 | m_retryTimer = new Timer(); | ||
92 | m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck); | ||
93 | m_retryTimer.Interval = 60000; | ||
94 | } | ||
95 | |||
96 | protected void retryCheck(object source, ElapsedEventArgs e) | ||
97 | { | ||
98 | m_retryCounter++; | ||
99 | if (m_retryCounter > 60) m_retryCounter -= 60; | ||
100 | List<int> keys = new List<int>(); | ||
101 | foreach (int a in m_retryQueue.Keys) | ||
102 | { | ||
103 | keys.Add(a); | ||
104 | } | ||
105 | foreach (int a in keys) | ||
106 | { | ||
107 | //We exponentially fall back on frequency until we reach one attempt per hour | ||
108 | //The net result is that we end up in the queue for roughly 24 hours.. | ||
109 | //24 hours worth of assets could be a lot, so the hope is that the region admin | ||
110 | //will have gotten the asset connector back online quickly! | ||
111 | |||
112 | int timefactor = a ^ 2; | ||
113 | if (timefactor > 60) | ||
114 | { | ||
115 | timefactor = 60; | ||
116 | } | ||
117 | |||
118 | //First, find out if we care about this timefactor | ||
119 | if (timefactor % a == 0) | ||
120 | { | ||
121 | //Yes, we do! | ||
122 | List<AssetBase> retrylist = m_retryQueue[a]; | ||
123 | m_retryQueue.Remove(a); | ||
124 | |||
125 | foreach(AssetBase ass in retrylist) | ||
126 | { | ||
127 | Store(ass); //Store my ass. This function will put it back in the dictionary if it fails | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | |||
132 | if (m_retryQueue.Count == 0) | ||
133 | { | ||
134 | //It might only be one tick per minute, but I have | ||
135 | //repented and abandoned my wasteful ways | ||
136 | m_retryCounter = 0; | ||
137 | m_retryTimer.Stop(); | ||
138 | } | ||
87 | } | 139 | } |
88 | 140 | ||
89 | protected void SetCache(IImprovedAssetCache cache) | 141 | protected void SetCache(IImprovedAssetCache cache) |
@@ -98,8 +150,8 @@ namespace OpenSim.Services.Connectors | |||
98 | AssetBase asset = null; | 150 | AssetBase asset = null; |
99 | if (m_Cache != null) | 151 | if (m_Cache != null) |
100 | asset = m_Cache.Get(id); | 152 | asset = m_Cache.Get(id); |
101 | 153 | ||
102 | if (asset == null) | 154 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
103 | { | 155 | { |
104 | asset = SynchronousRestObjectRequester. | 156 | asset = SynchronousRestObjectRequester. |
105 | MakeRequest<int, AssetBase>("GET", uri, 0); | 157 | MakeRequest<int, AssetBase>("GET", uri, 0); |
@@ -176,7 +228,7 @@ namespace OpenSim.Services.Connectors | |||
176 | if (m_Cache != null) | 228 | if (m_Cache != null) |
177 | asset = m_Cache.Get(id); | 229 | asset = m_Cache.Get(id); |
178 | 230 | ||
179 | if (asset == null) | 231 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
180 | { | 232 | { |
181 | bool result = false; | 233 | bool result = false; |
182 | 234 | ||
@@ -203,11 +255,10 @@ namespace OpenSim.Services.Connectors | |||
203 | 255 | ||
204 | public string Store(AssetBase asset) | 256 | public string Store(AssetBase asset) |
205 | { | 257 | { |
258 | if (m_Cache != null) | ||
259 | m_Cache.Cache(asset); | ||
206 | if (asset.Temporary || asset.Local) | 260 | if (asset.Temporary || asset.Local) |
207 | { | 261 | { |
208 | if (m_Cache != null) | ||
209 | m_Cache.Cache(asset); | ||
210 | |||
211 | return asset.ID; | 262 | return asset.ID; |
212 | } | 263 | } |
213 | 264 | ||
@@ -217,24 +268,57 @@ namespace OpenSim.Services.Connectors | |||
217 | try | 268 | try |
218 | { | 269 | { |
219 | newID = SynchronousRestObjectRequester. | 270 | newID = SynchronousRestObjectRequester. |
220 | MakeRequest<AssetBase, string>("POST", uri, asset); | 271 | MakeRequest<AssetBase, string>("POST", uri, asset, 25); |
272 | if (newID == null || newID == "") | ||
273 | { | ||
274 | newID = UUID.Zero.ToString(); | ||
275 | } | ||
221 | } | 276 | } |
222 | catch (Exception e) | 277 | catch (Exception e) |
223 | { | 278 | { |
224 | m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); | 279 | newID = UUID.Zero.ToString(); |
225 | } | 280 | } |
226 | 281 | ||
227 | if (newID != String.Empty) | 282 | if (newID == UUID.Zero.ToString()) |
228 | { | 283 | { |
229 | // Placing this here, so that this work with old asset servers that don't send any reply back | 284 | //The asset upload failed, put it in a queue for later |
230 | // SynchronousRestObjectRequester returns somethins that is not an empty string | 285 | asset.UploadAttempts++; |
231 | if (newID != null) | 286 | if (asset.UploadAttempts > 30) |
232 | asset.ID = newID; | 287 | { |
233 | 288 | //By this stage we've been in the queue for a good few hours; | |
234 | if (m_Cache != null) | 289 | //We're going to drop the asset. |
235 | m_Cache.Cache(asset); | 290 | m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString()); |
291 | } | ||
292 | else | ||
293 | { | ||
294 | if (!m_retryQueue.ContainsKey(asset.UploadAttempts)) | ||
295 | { | ||
296 | m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>()); | ||
297 | } | ||
298 | List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts]; | ||
299 | m_queue.Add(asset); | ||
300 | m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString()); | ||
301 | m_retryTimer.Start(); | ||
302 | } | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | if (asset.UploadAttempts > 0) | ||
307 | { | ||
308 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString()); | ||
309 | } | ||
310 | if (newID != String.Empty) | ||
311 | { | ||
312 | // Placing this here, so that this work with old asset servers that don't send any reply back | ||
313 | // SynchronousRestObjectRequester returns somethins that is not an empty string | ||
314 | if (newID != null) | ||
315 | asset.ID = newID; | ||
316 | |||
317 | if (m_Cache != null) | ||
318 | m_Cache.Cache(asset); | ||
319 | } | ||
236 | } | 320 | } |
237 | return newID; | 321 | return asset.ID; |
238 | } | 322 | } |
239 | 323 | ||
240 | public bool UpdateContent(string id, byte[] data) | 324 | 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 c40a347..7ddcfa6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -60,9 +60,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
60 | { | 60 | { |
61 | Uri m_Uri = new Uri(m_ServerURL); | 61 | Uri m_Uri = new Uri(m_ServerURL); |
62 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); | 62 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); |
63 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); | 63 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ; |
64 | if (!m_ServerURL.EndsWith("/")) | ||
65 | m_ServerURL += "/"; | ||
66 | } | 64 | } |
67 | catch (Exception e) | 65 | catch (Exception e) |
68 | { | 66 | { |
@@ -89,8 +87,6 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
89 | throw new Exception("UserAgent connector init error"); | 87 | throw new Exception("UserAgent connector init error"); |
90 | } | 88 | } |
91 | m_ServerURL = serviceURI; | 89 | m_ServerURL = serviceURI; |
92 | if (!m_ServerURL.EndsWith("/")) | ||
93 | m_ServerURL += "/"; | ||
94 | 90 | ||
95 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); | 91 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); |
96 | } | 92 | } |
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 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
31 | using System.IO; | 33 | using System.IO; |
32 | using System.Net; | 34 | using System.Net; |
33 | using System.Reflection; | 35 | using 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 f380873..725c6df 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -322,6 +322,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
322 | return false; | 322 | return false; |
323 | } | 323 | } |
324 | 324 | ||
325 | OSDMap resp = (OSDMap)result["_Result"]; | ||
326 | success = resp["success"].AsBoolean(); | ||
327 | reason = resp["reason"].AsString(); | ||
328 | |||
325 | return success; | 329 | return success; |
326 | } | 330 | } |
327 | catch (Exception e) | 331 | catch (Exception e) |
@@ -350,9 +354,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
350 | return true; | 354 | return true; |
351 | } | 355 | } |
352 | 356 | ||
353 | /// <summary> | 357 | private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) |
354 | /// </summary> | ||
355 | public bool CloseAgent(GridRegion destination, UUID id) | ||
356 | { | 358 | { |
357 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); | 359 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); |
358 | 360 | ||
@@ -370,6 +372,16 @@ namespace OpenSim.Services.Connectors.Simulation | |||
370 | return true; | 372 | return true; |
371 | } | 373 | } |
372 | 374 | ||
375 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
376 | { | ||
377 | return CloseAgent(destination, id, true); | ||
378 | } | ||
379 | |||
380 | public bool CloseAgent(GridRegion destination, UUID id) | ||
381 | { | ||
382 | return CloseAgent(destination, id, false); | ||
383 | } | ||
384 | |||
373 | #endregion Agents | 385 | #endregion Agents |
374 | 386 | ||
375 | #region Objects | 387 | #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 c539047..b226971 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 | ||
@@ -369,7 +333,7 @@ namespace OpenSim.Services.GridService | |||
369 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); | 333 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); |
370 | 334 | ||
371 | AddHyperlinkRegion(regInfo, handle); | 335 | AddHyperlinkRegion(regInfo, handle); |
372 | m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); | 336 | m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); |
373 | return true; | 337 | return true; |
374 | } | 338 | } |
375 | 339 | ||
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 445d45e..09e785f 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -155,7 +155,7 @@ namespace OpenSim.Services.HypergridService | |||
155 | string myExternalIP = string.Empty; | 155 | string myExternalIP = string.Empty; |
156 | string gridName = gatekeeper.ServerURI; | 156 | string gridName = gatekeeper.ServerURI; |
157 | 157 | ||
158 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); | 158 | m_log.DebugFormat("[USER AGENT SERVICE]: m_grid - {0}, gn - {1}", m_GridName, gridName); |
159 | 159 | ||
160 | if (m_GridName == gridName) | 160 | if (m_GridName == gridName) |
161 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); | 161 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); |
@@ -266,13 +266,11 @@ namespace OpenSim.Services.HypergridService | |||
266 | 266 | ||
267 | if (m_TravelingAgents.ContainsKey(sessionID)) | 267 | if (m_TravelingAgents.ContainsKey(sessionID)) |
268 | { | 268 | { |
269 | bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || | 269 | m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}", |
270 | m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed | 270 | m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress); |
271 | |||
272 | m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}", | ||
273 | reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result); | ||
274 | 271 | ||
275 | return result; | 272 | return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || |
273 | m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed | ||
276 | } | 274 | } |
277 | 275 | ||
278 | return false; | 276 | 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 | // | ||
7 | using System; | ||
8 | using Nini.Config; | ||
9 | |||
10 | namespace 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 a34f0be..f569fc8 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -300,9 +300,13 @@ namespace OpenSim.Services.Interfaces | |||
300 | } | 300 | } |
301 | catch (SocketException e) | 301 | catch (SocketException e) |
302 | { | 302 | { |
303 | throw new Exception( | 303 | /*throw new Exception( |
304 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | 304 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + |
305 | e + "' attached to this exception", e); | 305 | e + "' attached to this exception", e);*/ |
306 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | ||
307 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
308 | // resolving and thus make surrounding regions crash out with this exception. | ||
309 | return null; | ||
306 | } | 310 | } |
307 | 311 | ||
308 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 312 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
@@ -360,6 +364,12 @@ namespace OpenSim.Services.Interfaces | |||
360 | if (kvp.ContainsKey("regionName")) | 364 | if (kvp.ContainsKey("regionName")) |
361 | RegionName = (string)kvp["regionName"]; | 365 | RegionName = (string)kvp["regionName"]; |
362 | 366 | ||
367 | if (kvp.ContainsKey("access")) | ||
368 | { | ||
369 | byte access = Convert.ToByte((string)kvp["access"]); | ||
370 | Maturity = (int)Util.ConvertAccessLevelToMaturity(access); | ||
371 | } | ||
372 | |||
363 | if (kvp.ContainsKey("serverIP")) | 373 | if (kvp.ContainsKey("serverIP")) |
364 | { | 374 | { |
365 | //int port = 0; | 375 | //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 ddc8855..f8868f5 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. " + |
@@ -324,6 +329,7 @@ namespace OpenSim.Services.LLLoginService | |||
324 | private void FillOutRegionData(GridRegion destination) | 329 | private void FillOutRegionData(GridRegion destination) |
325 | { | 330 | { |
326 | IPEndPoint endPoint = destination.ExternalEndPoint; | 331 | IPEndPoint endPoint = destination.ExternalEndPoint; |
332 | if (endPoint == null) return; | ||
327 | SimAddress = endPoint.Address.ToString(); | 333 | SimAddress = endPoint.Address.ToString(); |
328 | SimPort = (uint)endPoint.Port; | 334 | SimPort = (uint)endPoint.Port; |
329 | RegionX = (uint)destination.RegionLocX; | 335 | RegionX = (uint)destination.RegionLocX; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 2ca2d15..ffed15e 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -119,7 +119,8 @@ namespace OpenSim.Services.LLLoginService | |||
119 | Object[] args = new Object[] { config }; | 119 | Object[] args = new Object[] { config }; |
120 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 120 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
121 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | 121 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); |
122 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); | 122 | Object[] authArgs = new Object[] { config, m_UserAccountService }; |
123 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs); | ||
123 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); | 124 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); |
124 | 125 | ||
125 | if (gridService != string.Empty) | 126 | if (gridService != string.Empty) |
@@ -262,6 +263,12 @@ namespace OpenSim.Services.LLLoginService | |||
262 | return LLFailedLoginResponse.UserProblem; | 263 | return LLFailedLoginResponse.UserProblem; |
263 | } | 264 | } |
264 | 265 | ||
266 | if (account.UserLevel < 0) | ||
267 | { | ||
268 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: Unverified account"); | ||
269 | return LLFailedLoginResponse.UnverifiedAccountProblem; | ||
270 | } | ||
271 | |||
265 | if (account.UserLevel < m_MinLoginLevel) | 272 | if (account.UserLevel < m_MinLoginLevel) |
266 | { | 273 | { |
267 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); | 274 | 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 f376cf8..cbd6f35 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -148,6 +148,10 @@ namespace OpenSim.Services.UserAccountService | |||
148 | Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); | 148 | Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); |
149 | if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) | 149 | if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) |
150 | Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); | 150 | Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); |
151 | if (d.Data.ContainsKey("UserCountry") && d.Data["UserCountry"] != null) | ||
152 | u.UserCountry = d.Data["UserCountry"].ToString(); | ||
153 | else | ||
154 | u.UserTitle = string.Empty; | ||
151 | 155 | ||
152 | if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) | 156 | if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) |
153 | { | 157 | { |
@@ -282,6 +286,21 @@ namespace OpenSim.Services.UserAccountService | |||
282 | return ret; | 286 | return ret; |
283 | } | 287 | } |
284 | 288 | ||
289 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
290 | { | ||
291 | UserAccountData[] d = m_Database.GetUsersWhere(scopeID, where); | ||
292 | |||
293 | if (d == null) | ||
294 | return new List<UserAccount>(); | ||
295 | |||
296 | List<UserAccount> ret = new List<UserAccount>(); | ||
297 | |||
298 | foreach (UserAccountData data in d) | ||
299 | ret.Add(MakeUserAccount(data)); | ||
300 | |||
301 | return ret; | ||
302 | } | ||
303 | |||
285 | #endregion | 304 | #endregion |
286 | 305 | ||
287 | #region Console commands | 306 | #region Console commands |