diff options
Diffstat (limited to 'OpenSim/Services')
30 files changed, 689 insertions, 140 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 08fd3f8..90c30c8 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -159,7 +159,10 @@ namespace OpenSim.Services.AssetService | |||
159 | { | 159 | { |
160 | // m_log.DebugFormat( | 160 | // m_log.DebugFormat( |
161 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); | 161 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); |
162 | m_Database.StoreAsset(asset); | 162 | if (!m_Database.StoreAsset(asset)) |
163 | { | ||
164 | return UUID.Zero.ToString(); | ||
165 | } | ||
163 | } | 166 | } |
164 | // else | 167 | // else |
165 | // { | 168 | // { |
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; | |||
30 | using log4net; | 30 | using log4net; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Server.Base; | ||
34 | using OpenSim.Services.Interfaces; | ||
33 | using OpenSim.Data; | 35 | using OpenSim.Data; |
34 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
35 | using OpenSim.Services.Base; | 37 | using OpenSim.Services.Base; |
36 | using OpenSim.Services.Interfaces; | ||
37 | 38 | ||
38 | namespace OpenSim.Services.AuthenticationService | 39 | namespace 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 5f1bde1..a069838 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,42 +64,90 @@ 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 | UUID realID; | ||
68 | return Authenticate(principalID, password, lifetime, out realID); | ||
69 | } | ||
70 | |||
71 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
72 | { | ||
73 | realID = UUID.Zero; | ||
74 | |||
75 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null); | ||
61 | AuthenticationData data = m_Database.Get(principalID); | 76 | AuthenticationData data = m_Database.Get(principalID); |
77 | UserAccount user = null; | ||
78 | if (m_UserAccountService != null) | ||
79 | user = m_UserAccountService.GetUserAccount(UUID.Zero, principalID); | ||
62 | 80 | ||
63 | if (data == null) | 81 | if (data == null || data.Data == null) |
64 | { | 82 | { |
65 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} not found", principalID); | 83 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); |
66 | return String.Empty; | 84 | return String.Empty; |
67 | } | 85 | } |
68 | else if (data.Data == null) | 86 | |
87 | if (!data.Data.ContainsKey("passwordHash") || | ||
88 | !data.Data.ContainsKey("passwordSalt")) | ||
69 | { | 89 | { |
70 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} data not found", principalID); | ||
71 | return String.Empty; | 90 | return String.Empty; |
72 | } | 91 | } |
73 | else if (!data.Data.ContainsKey("passwordHash") || !data.Data.ContainsKey("passwordSalt")) | 92 | |
93 | string hashed = Util.Md5Hash(password + ":" + | ||
94 | data.Data["passwordSalt"].ToString()); | ||
95 | |||
96 | m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); | ||
97 | |||
98 | if (data.Data["passwordHash"].ToString() == hashed) | ||
99 | { | ||
100 | return GetToken(principalID, lifetime); | ||
101 | } | ||
102 | |||
103 | if (user == null) | ||
74 | { | 104 | { |
75 | m_log.DebugFormat( | 105 | 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; | 106 | return String.Empty; |
78 | } | 107 | } |
79 | else | 108 | |
109 | int impersonateFlag = 1 << 6; | ||
110 | |||
111 | if ((user.UserFlags & impersonateFlag) == 0) | ||
112 | return String.Empty; | ||
113 | |||
114 | m_log.DebugFormat("[PASS AUTH]: Attempting impersonation"); | ||
115 | |||
116 | List<UserAccount> accounts = m_UserAccountService.GetUserAccountsWhere(UUID.Zero, "UserLevel >= 200"); | ||
117 | if (accounts == null || accounts.Count == 0) | ||
118 | return String.Empty; | ||
119 | |||
120 | foreach (UserAccount a in accounts) | ||
80 | { | 121 | { |
81 | string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); | 122 | data = m_Database.Get(a.PrincipalID); |
123 | if (data == null || data.Data == null || | ||
124 | !data.Data.ContainsKey("passwordHash") || | ||
125 | !data.Data.ContainsKey("passwordSalt")) | ||
126 | { | ||
127 | continue; | ||
128 | } | ||
129 | |||
130 | // m_log.DebugFormat("[PASS AUTH]: Trying {0}", data.PrincipalID); | ||
82 | 131 | ||
83 | m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); | 132 | hashed = Util.Md5Hash(password + ":" + |
133 | data.Data["passwordSalt"].ToString()); | ||
84 | 134 | ||
85 | if (data.Data["passwordHash"].ToString() == hashed) | 135 | if (data.Data["passwordHash"].ToString() == hashed) |
86 | { | 136 | { |
137 | m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID); | ||
138 | realID = a.PrincipalID; | ||
87 | return GetToken(principalID, lifetime); | 139 | return GetToken(principalID, lifetime); |
88 | } | 140 | } |
89 | else | 141 | // else |
90 | { | 142 | // { |
91 | m_log.DebugFormat( | 143 | // m_log.DebugFormat( |
92 | "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.", | 144 | // "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.", |
93 | hashed, data.Data["passwordHash"], principalID); | 145 | // hashed, data.Data["passwordHash"], data.PrincipalID); |
94 | return String.Empty; | 146 | // } |
95 | } | ||
96 | } | 147 | } |
148 | |||
149 | m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID); | ||
150 | return String.Empty; | ||
97 | } | 151 | } |
98 | } | 152 | } |
99 | } \ No newline at end of file | 153 | } |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index 2344c0e..1510168 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | |||
@@ -49,12 +49,23 @@ 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) |
55 | { | 60 | { |
56 | } | 61 | } |
57 | 62 | ||
63 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
64 | { | ||
65 | realID = UUID.Zero; | ||
66 | return Authenticate(principalID, password, lifetime); | ||
67 | } | ||
68 | |||
58 | public string Authenticate(UUID principalID, string password, int lifetime) | 69 | public string Authenticate(UUID principalID, string password, int lifetime) |
59 | { | 70 | { |
60 | if (new UUID(password) == UUID.Zero) | 71 | if (new UUID(password) == UUID.Zero) |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index 2c6cebd..bbc8470 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs | |||
@@ -55,14 +55,22 @@ namespace OpenSim.Services.AuthenticationService | |||
55 | 55 | ||
56 | public string Authenticate(UUID principalID, string password, int lifetime) | 56 | public string Authenticate(UUID principalID, string password, int lifetime) |
57 | { | 57 | { |
58 | UUID realID; | ||
59 | |||
60 | return Authenticate(principalID, password, lifetime, out realID); | ||
61 | } | ||
62 | |||
63 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
64 | { | ||
58 | AuthenticationData data = m_Database.Get(principalID); | 65 | AuthenticationData data = m_Database.Get(principalID); |
59 | string result = String.Empty; | 66 | string result = String.Empty; |
67 | realID = UUID.Zero; | ||
60 | if (data != null && data.Data != null) | 68 | if (data != null && data.Data != null) |
61 | { | 69 | { |
62 | if (data.Data.ContainsKey("webLoginKey")) | 70 | if (data.Data.ContainsKey("webLoginKey")) |
63 | { | 71 | { |
64 | m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); | 72 | m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); |
65 | result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime); | 73 | result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime, out realID); |
66 | if (result == String.Empty) | 74 | if (result == String.Empty) |
67 | { | 75 | { |
68 | m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); | 76 | m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); |
@@ -71,12 +79,15 @@ namespace OpenSim.Services.AuthenticationService | |||
71 | if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) | 79 | if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) |
72 | { | 80 | { |
73 | m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); | 81 | m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); |
74 | result = m_svcChecks["password"].Authenticate(principalID, password, lifetime); | 82 | result = m_svcChecks["password"].Authenticate(principalID, password, lifetime, out realID); |
75 | if (result == String.Empty) | 83 | if (result == String.Empty) |
76 | { | 84 | { |
77 | m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); | 85 | m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); |
78 | } | 86 | } |
79 | } | 87 | } |
88 | |||
89 | |||
90 | |||
80 | if (result == string.Empty) | 91 | if (result == string.Empty) |
81 | { | 92 | { |
82 | m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID); | 93 | m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID); |
@@ -86,7 +97,9 @@ namespace OpenSim.Services.AuthenticationService | |||
86 | { | 97 | { |
87 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); | 98 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); |
88 | } | 99 | } |
100 | |||
101 | |||
89 | return result; | 102 | return result; |
90 | } | 103 | } |
91 | } | 104 | } |
92 | } \ No newline at end of file | 105 | } |
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 8b04d7f..3e06cf0 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -27,9 +27,11 @@ | |||
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Threading; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.IO; | 32 | using System.IO; |
32 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Timers; | ||
33 | using Nini.Config; | 35 | using Nini.Config; |
34 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
@@ -47,13 +49,22 @@ namespace OpenSim.Services.Connectors | |||
47 | 49 | ||
48 | private string m_ServerURI = String.Empty; | 50 | private string m_ServerURI = String.Empty; |
49 | private IImprovedAssetCache m_Cache = null; | 51 | private IImprovedAssetCache m_Cache = null; |
52 | private int m_retryCounter; | ||
53 | private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>(); | ||
54 | private System.Timers.Timer m_retryTimer; | ||
50 | private int m_maxAssetRequestConcurrency = 30; | 55 | private int m_maxAssetRequestConcurrency = 30; |
51 | 56 | ||
52 | private delegate void AssetRetrievedEx(AssetBase asset); | 57 | private delegate void AssetRetrievedEx(AssetBase asset); |
53 | 58 | ||
54 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. | 59 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. |
55 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded | 60 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded |
56 | private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); | 61 | // private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); |
62 | |||
63 | private Dictionary<string, List<AssetRetrievedEx>> m_AssetHandlers = new Dictionary<string, List<AssetRetrievedEx>>(); | ||
64 | |||
65 | private Dictionary<string, string> m_UriMap = new Dictionary<string, string>(); | ||
66 | |||
67 | private Thread[] m_fetchThreads; | ||
57 | 68 | ||
58 | public int MaxAssetRequestConcurrency | 69 | public int MaxAssetRequestConcurrency |
59 | { | 70 | { |
@@ -91,13 +102,102 @@ namespace OpenSim.Services.Connectors | |||
91 | string serviceURI = assetConfig.GetString("AssetServerURI", | 102 | string serviceURI = assetConfig.GetString("AssetServerURI", |
92 | String.Empty); | 103 | String.Empty); |
93 | 104 | ||
105 | m_ServerURI = serviceURI; | ||
106 | |||
94 | if (serviceURI == String.Empty) | 107 | if (serviceURI == String.Empty) |
95 | { | 108 | { |
96 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); | 109 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); |
97 | throw new Exception("Asset connector init error"); | 110 | throw new Exception("Asset connector init error"); |
98 | } | 111 | } |
99 | 112 | ||
100 | m_ServerURI = serviceURI; | 113 | |
114 | m_retryTimer = new System.Timers.Timer(); | ||
115 | m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck); | ||
116 | m_retryTimer.Interval = 60000; | ||
117 | |||
118 | Uri serverUri = new Uri(m_ServerURI); | ||
119 | |||
120 | string groupHost = serverUri.Host; | ||
121 | |||
122 | for (int i = 0 ; i < 256 ; i++) | ||
123 | { | ||
124 | string prefix = i.ToString("x2"); | ||
125 | groupHost = assetConfig.GetString("AssetServerHost_"+prefix, groupHost); | ||
126 | |||
127 | m_UriMap[prefix] = groupHost; | ||
128 | //m_log.DebugFormat("[ASSET]: Using {0} for prefix {1}", groupHost, prefix); | ||
129 | } | ||
130 | |||
131 | m_fetchThreads = new Thread[2]; | ||
132 | |||
133 | for (int i = 0 ; i < 2 ; i++) | ||
134 | { | ||
135 | m_fetchThreads[i] = new Thread(AssetRequestProcessor); | ||
136 | m_fetchThreads[i].Start(); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | private string MapServer(string id) | ||
141 | { | ||
142 | UriBuilder serverUri = new UriBuilder(m_ServerURI); | ||
143 | |||
144 | string prefix = id.Substring(0, 2).ToLower(); | ||
145 | |||
146 | string host = m_UriMap[prefix]; | ||
147 | |||
148 | serverUri.Host = host; | ||
149 | |||
150 | // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix); | ||
151 | |||
152 | string ret = serverUri.Uri.AbsoluteUri; | ||
153 | if (ret.EndsWith("/")) | ||
154 | ret = ret.Substring(0, ret.Length - 1); | ||
155 | return ret; | ||
156 | } | ||
157 | |||
158 | protected void retryCheck(object source, ElapsedEventArgs e) | ||
159 | { | ||
160 | m_retryCounter++; | ||
161 | if (m_retryCounter > 60) m_retryCounter -= 60; | ||
162 | List<int> keys = new List<int>(); | ||
163 | foreach (int a in m_retryQueue.Keys) | ||
164 | { | ||
165 | keys.Add(a); | ||
166 | } | ||
167 | foreach (int a in keys) | ||
168 | { | ||
169 | //We exponentially fall back on frequency until we reach one attempt per hour | ||
170 | //The net result is that we end up in the queue for roughly 24 hours.. | ||
171 | //24 hours worth of assets could be a lot, so the hope is that the region admin | ||
172 | //will have gotten the asset connector back online quickly! | ||
173 | |||
174 | int timefactor = a ^ 2; | ||
175 | if (timefactor > 60) | ||
176 | { | ||
177 | timefactor = 60; | ||
178 | } | ||
179 | |||
180 | //First, find out if we care about this timefactor | ||
181 | if (timefactor % a == 0) | ||
182 | { | ||
183 | //Yes, we do! | ||
184 | List<AssetBase> retrylist = m_retryQueue[a]; | ||
185 | m_retryQueue.Remove(a); | ||
186 | |||
187 | foreach(AssetBase ass in retrylist) | ||
188 | { | ||
189 | Store(ass); //Store my ass. This function will put it back in the dictionary if it fails | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | |||
194 | if (m_retryQueue.Count == 0) | ||
195 | { | ||
196 | //It might only be one tick per minute, but I have | ||
197 | //repented and abandoned my wasteful ways | ||
198 | m_retryCounter = 0; | ||
199 | m_retryTimer.Stop(); | ||
200 | } | ||
101 | } | 201 | } |
102 | 202 | ||
103 | protected void SetCache(IImprovedAssetCache cache) | 203 | protected void SetCache(IImprovedAssetCache cache) |
@@ -107,15 +207,13 @@ namespace OpenSim.Services.Connectors | |||
107 | 207 | ||
108 | public AssetBase Get(string id) | 208 | public AssetBase Get(string id) |
109 | { | 209 | { |
110 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id); | 210 | string uri = MapServer(id) + "/assets/" + id; |
111 | |||
112 | string uri = m_ServerURI + "/assets/" + id; | ||
113 | 211 | ||
114 | AssetBase asset = null; | 212 | AssetBase asset = null; |
115 | if (m_Cache != null) | 213 | if (m_Cache != null) |
116 | asset = m_Cache.Get(id); | 214 | asset = m_Cache.Get(id); |
117 | 215 | ||
118 | if (asset == null) | 216 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
119 | { | 217 | { |
120 | asset = SynchronousRestObjectRequester. | 218 | asset = SynchronousRestObjectRequester. |
121 | MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); | 219 | MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); |
@@ -146,7 +244,7 @@ namespace OpenSim.Services.Connectors | |||
146 | return fullAsset.Metadata; | 244 | return fullAsset.Metadata; |
147 | } | 245 | } |
148 | 246 | ||
149 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 247 | string uri = MapServer(id) + "/assets/" + id + "/metadata"; |
150 | 248 | ||
151 | AssetMetadata asset = SynchronousRestObjectRequester. | 249 | AssetMetadata asset = SynchronousRestObjectRequester. |
152 | MakeRequest<int, AssetMetadata>("GET", uri, 0); | 250 | MakeRequest<int, AssetMetadata>("GET", uri, 0); |
@@ -163,7 +261,7 @@ namespace OpenSim.Services.Connectors | |||
163 | return fullAsset.Data; | 261 | return fullAsset.Data; |
164 | } | 262 | } |
165 | 263 | ||
166 | RestClient rc = new RestClient(m_ServerURI); | 264 | RestClient rc = new RestClient(MapServer(id)); |
167 | rc.AddResourcePath("assets"); | 265 | rc.AddResourcePath("assets"); |
168 | rc.AddResourcePath(id); | 266 | rc.AddResourcePath(id); |
169 | rc.AddResourcePath("data"); | 267 | rc.AddResourcePath("data"); |
@@ -186,66 +284,109 @@ namespace OpenSim.Services.Connectors | |||
186 | return null; | 284 | return null; |
187 | } | 285 | } |
188 | 286 | ||
189 | public bool Get(string id, Object sender, AssetRetrieved handler) | 287 | private class QueuedAssetRequest |
190 | { | 288 | { |
191 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); | 289 | public string uri; |
290 | public string id; | ||
291 | } | ||
192 | 292 | ||
193 | string uri = m_ServerURI + "/assets/" + id; | 293 | private OpenMetaverse.BlockingQueue<QueuedAssetRequest> m_requestQueue = |
294 | new OpenMetaverse.BlockingQueue<QueuedAssetRequest>(); | ||
194 | 295 | ||
195 | AssetBase asset = null; | 296 | private void AssetRequestProcessor() |
196 | if (m_Cache != null) | 297 | { |
197 | asset = m_Cache.Get(id); | 298 | QueuedAssetRequest r; |
198 | 299 | ||
199 | if (asset == null) | 300 | while (true) |
200 | { | 301 | { |
201 | lock (m_AssetHandlers) | 302 | r = m_requestQueue.Dequeue(); |
202 | { | ||
203 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | ||
204 | |||
205 | AssetRetrievedEx handlers; | ||
206 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | ||
207 | { | ||
208 | // Someone else is already loading this asset. It will notify our handler when done. | ||
209 | handlers += handlerEx; | ||
210 | return true; | ||
211 | } | ||
212 | 303 | ||
213 | // Load the asset ourselves | 304 | string uri = r.uri; |
214 | handlers += handlerEx; | 305 | string id = r.id; |
215 | m_AssetHandlers.Add(id, handlers); | ||
216 | } | ||
217 | 306 | ||
218 | bool success = false; | 307 | bool success = false; |
219 | try | 308 | try |
220 | { | 309 | { |
221 | AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, | 310 | AssetBase a = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, 30); |
222 | delegate(AssetBase a) | 311 | if (a != null) |
223 | { | 312 | { |
224 | if (m_Cache != null) | 313 | if (m_Cache != null) |
225 | m_Cache.Cache(a); | 314 | m_Cache.Cache(a); |
226 | 315 | ||
227 | AssetRetrievedEx handlers; | 316 | List<AssetRetrievedEx> handlers; |
228 | lock (m_AssetHandlers) | 317 | lock (m_AssetHandlers) |
318 | { | ||
319 | handlers = m_AssetHandlers[id]; | ||
320 | m_AssetHandlers.Remove(id); | ||
321 | } | ||
322 | foreach (AssetRetrievedEx h in handlers) | ||
323 | { | ||
324 | Util.FireAndForget(x => | ||
229 | { | 325 | { |
230 | handlers = m_AssetHandlers[id]; | 326 | h.Invoke(a); |
231 | m_AssetHandlers.Remove(id); | 327 | }); |
232 | } | 328 | } |
233 | handlers.Invoke(a); | 329 | if (handlers != null) |
234 | }, m_maxAssetRequestConcurrency); | 330 | handlers.Clear(); |
235 | 331 | ||
236 | success = true; | 332 | success = true; |
333 | } | ||
237 | } | 334 | } |
238 | finally | 335 | finally |
239 | { | 336 | { |
240 | if (!success) | 337 | if (!success) |
241 | { | 338 | { |
339 | List<AssetRetrievedEx> handlers; | ||
242 | lock (m_AssetHandlers) | 340 | lock (m_AssetHandlers) |
243 | { | 341 | { |
342 | handlers = m_AssetHandlers[id]; | ||
244 | m_AssetHandlers.Remove(id); | 343 | m_AssetHandlers.Remove(id); |
245 | } | 344 | } |
345 | if (handlers != null) | ||
346 | handlers.Clear(); | ||
246 | } | 347 | } |
247 | } | 348 | } |
248 | } | 349 | } |
350 | } | ||
351 | |||
352 | public bool Get(string id, Object sender, AssetRetrieved handler) | ||
353 | { | ||
354 | string uri = MapServer(id) + "/assets/" + id; | ||
355 | |||
356 | AssetBase asset = null; | ||
357 | if (m_Cache != null) | ||
358 | asset = m_Cache.Get(id); | ||
359 | |||
360 | if (asset == null || asset.Data == null || asset.Data.Length == 0) | ||
361 | { | ||
362 | lock (m_AssetHandlers) | ||
363 | { | ||
364 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | ||
365 | |||
366 | // AssetRetrievedEx handlers; | ||
367 | List<AssetRetrievedEx> handlers; | ||
368 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | ||
369 | { | ||
370 | // Someone else is already loading this asset. It will notify our handler when done. | ||
371 | // handlers += handlerEx; | ||
372 | handlers.Add(handlerEx); | ||
373 | return true; | ||
374 | } | ||
375 | |||
376 | // Load the asset ourselves | ||
377 | // handlers += handlerEx; | ||
378 | handlers = new List<AssetRetrievedEx>(); | ||
379 | handlers.Add(handlerEx); | ||
380 | |||
381 | m_AssetHandlers.Add(id, handlers); | ||
382 | } | ||
383 | |||
384 | QueuedAssetRequest request = new QueuedAssetRequest(); | ||
385 | request.id = id; | ||
386 | request.uri = uri; | ||
387 | |||
388 | m_requestQueue.Enqueue(request); | ||
389 | } | ||
249 | else | 390 | else |
250 | { | 391 | { |
251 | handler(id, sender, asset); | 392 | handler(id, sender, asset); |
@@ -256,38 +397,95 @@ namespace OpenSim.Services.Connectors | |||
256 | 397 | ||
257 | public string Store(AssetBase asset) | 398 | public string Store(AssetBase asset) |
258 | { | 399 | { |
259 | if (asset.Local) | 400 | // Have to assign the asset ID here. This isn't likely to |
401 | // trigger since current callers don't pass emtpy IDs | ||
402 | // We need the asset ID to route the request to the proper | ||
403 | // cluster member, so we can't have the server assign one. | ||
404 | if (asset.ID == string.Empty) | ||
260 | { | 405 | { |
261 | if (m_Cache != null) | 406 | if (asset.FullID == UUID.Zero) |
262 | m_Cache.Cache(asset); | 407 | { |
408 | asset.FullID = UUID.Random(); | ||
409 | } | ||
410 | asset.ID = asset.FullID.ToString(); | ||
411 | } | ||
412 | else if (asset.FullID == UUID.Zero) | ||
413 | { | ||
414 | UUID uuid = UUID.Zero; | ||
415 | if (UUID.TryParse(asset.ID, out uuid)) | ||
416 | { | ||
417 | asset.FullID = uuid; | ||
418 | } | ||
419 | else | ||
420 | { | ||
421 | asset.FullID = UUID.Random(); | ||
422 | } | ||
423 | } | ||
263 | 424 | ||
425 | if (m_Cache != null) | ||
426 | m_Cache.Cache(asset); | ||
427 | if (asset.Temporary || asset.Local) | ||
428 | { | ||
264 | return asset.ID; | 429 | return asset.ID; |
265 | } | 430 | } |
266 | 431 | ||
267 | string uri = m_ServerURI + "/assets/"; | 432 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; |
268 | 433 | ||
269 | string newID = string.Empty; | 434 | string newID = string.Empty; |
270 | try | 435 | try |
271 | { | 436 | { |
272 | newID = SynchronousRestObjectRequester. | 437 | newID = SynchronousRestObjectRequester. |
273 | MakeRequest<AssetBase, string>("POST", uri, asset); | 438 | MakeRequest<AssetBase, string>("POST", uri, asset, 25); |
439 | if (newID == null || newID == "") | ||
440 | { | ||
441 | newID = UUID.Zero.ToString(); | ||
442 | } | ||
274 | } | 443 | } |
275 | catch (Exception e) | 444 | catch (Exception e) |
276 | { | 445 | { |
277 | m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); | 446 | newID = UUID.Zero.ToString(); |
278 | } | 447 | } |
279 | 448 | ||
280 | if (newID != String.Empty) | 449 | if (newID == UUID.Zero.ToString()) |
450 | { | ||
451 | //The asset upload failed, put it in a queue for later | ||
452 | asset.UploadAttempts++; | ||
453 | if (asset.UploadAttempts > 30) | ||
454 | { | ||
455 | //By this stage we've been in the queue for a good few hours; | ||
456 | //We're going to drop the asset. | ||
457 | m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString()); | ||
458 | } | ||
459 | else | ||
460 | { | ||
461 | if (!m_retryQueue.ContainsKey(asset.UploadAttempts)) | ||
462 | { | ||
463 | m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>()); | ||
464 | } | ||
465 | List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts]; | ||
466 | m_queue.Add(asset); | ||
467 | m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString()); | ||
468 | m_retryTimer.Start(); | ||
469 | } | ||
470 | } | ||
471 | else | ||
281 | { | 472 | { |
282 | // Placing this here, so that this work with old asset servers that don't send any reply back | 473 | if (asset.UploadAttempts > 0) |
283 | // SynchronousRestObjectRequester returns somethins that is not an empty string | 474 | { |
284 | if (newID != null) | 475 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString()); |
285 | asset.ID = newID; | 476 | } |
477 | if (newID != String.Empty) | ||
478 | { | ||
479 | // Placing this here, so that this work with old asset servers that don't send any reply back | ||
480 | // SynchronousRestObjectRequester returns somethins that is not an empty string | ||
481 | if (newID != null) | ||
482 | asset.ID = newID; | ||
286 | 483 | ||
287 | if (m_Cache != null) | 484 | if (m_Cache != null) |
288 | m_Cache.Cache(asset); | 485 | m_Cache.Cache(asset); |
486 | } | ||
289 | } | 487 | } |
290 | return newID; | 488 | return asset.ID; |
291 | } | 489 | } |
292 | 490 | ||
293 | public bool UpdateContent(string id, byte[] data) | 491 | public bool UpdateContent(string id, byte[] data) |
@@ -308,7 +506,7 @@ namespace OpenSim.Services.Connectors | |||
308 | } | 506 | } |
309 | asset.Data = data; | 507 | asset.Data = data; |
310 | 508 | ||
311 | string uri = m_ServerURI + "/assets/" + id; | 509 | string uri = MapServer(id) + "/assets/" + id; |
312 | 510 | ||
313 | if (SynchronousRestObjectRequester. | 511 | if (SynchronousRestObjectRequester. |
314 | MakeRequest<AssetBase, bool>("POST", uri, asset)) | 512 | MakeRequest<AssetBase, bool>("POST", uri, asset)) |
@@ -323,7 +521,7 @@ namespace OpenSim.Services.Connectors | |||
323 | 521 | ||
324 | public bool Delete(string id) | 522 | public bool Delete(string id) |
325 | { | 523 | { |
326 | string uri = m_ServerURI + "/assets/" + id; | 524 | string uri = MapServer(id) + "/assets/" + id; |
327 | 525 | ||
328 | if (SynchronousRestObjectRequester. | 526 | if (SynchronousRestObjectRequester. |
329 | MakeRequest<int, bool>("DELETE", uri, 0)) | 527 | MakeRequest<int, bool>("DELETE", uri, 0)) |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index 2b77154..f996aca 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
@@ -81,6 +81,13 @@ namespace OpenSim.Services.Connectors | |||
81 | m_ServerURI = serviceURI; | 81 | m_ServerURI = serviceURI; |
82 | } | 82 | } |
83 | 83 | ||
84 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
85 | { | ||
86 | realID = UUID.Zero; | ||
87 | |||
88 | return Authenticate(principalID, password, lifetime); | ||
89 | } | ||
90 | |||
84 | public string Authenticate(UUID principalID, string password, int lifetime) | 91 | public string Authenticate(UUID principalID, string password, int lifetime) |
85 | { | 92 | { |
86 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 93 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index 6d5ce4b..45f4514 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs | |||
@@ -144,44 +144,48 @@ namespace OpenSim.Services.Connectors.Friends | |||
144 | 144 | ||
145 | private bool Call(GridRegion region, Dictionary<string, object> sendData) | 145 | private bool Call(GridRegion region, Dictionary<string, object> sendData) |
146 | { | 146 | { |
147 | string reqString = ServerUtils.BuildQueryString(sendData); | 147 | Util.FireAndForget(x => { |
148 | //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); | 148 | string reqString = ServerUtils.BuildQueryString(sendData); |
149 | if (region == null) | 149 | //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); |
150 | return false; | 150 | if (region == null) |
151 | 151 | return; | |
152 | string path = ServicePath(); | 152 | |
153 | if (!region.ServerURI.EndsWith("/")) | 153 | string path = ServicePath(); |
154 | path = "/" + path; | 154 | if (!region.ServerURI.EndsWith("/")) |
155 | string uri = region.ServerURI + path; | 155 | path = "/" + path; |
156 | // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); | 156 | string uri = region.ServerURI + path; |
157 | 157 | // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); | |
158 | try | 158 | |
159 | { | 159 | try |
160 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | ||
161 | if (reply != string.Empty) | ||
162 | { | 160 | { |
163 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 161 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); |
164 | 162 | if (reply != string.Empty) | |
165 | if (replyData.ContainsKey("RESULT")) | ||
166 | { | 163 | { |
167 | if (replyData["RESULT"].ToString().ToLower() == "true") | 164 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
168 | return true; | 165 | |
166 | if (replyData.ContainsKey("RESULT")) | ||
167 | { | ||
168 | // if (replyData["RESULT"].ToString().ToLower() == "true") | ||
169 | // return; | ||
170 | // else | ||
171 | return; | ||
172 | } | ||
169 | else | 173 | else |
170 | return false; | 174 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); |
175 | |||
171 | } | 176 | } |
172 | else | 177 | else |
173 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); | 178 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); |
174 | 179 | } | |
180 | catch (Exception e) | ||
181 | { | ||
182 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); | ||
175 | } | 183 | } |
176 | else | 184 | |
177 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); | 185 | return; |
178 | } | 186 | }); |
179 | catch (Exception e) | 187 | |
180 | { | 188 | return true; |
181 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); | ||
182 | } | ||
183 | |||
184 | return false; | ||
185 | } | 189 | } |
186 | } | 190 | } |
187 | } | 191 | } |
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 34ed0d7..f982cc1 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -48,6 +48,9 @@ namespace OpenSim.Services.Connectors | |||
48 | 48 | ||
49 | private string m_ServerURI = String.Empty; | 49 | private string m_ServerURI = String.Empty; |
50 | 50 | ||
51 | private ExpiringCache<ulong, GridRegion> m_regionCache = | ||
52 | new ExpiringCache<ulong, GridRegion>(); | ||
53 | |||
51 | public GridServicesConnector() | 54 | public GridServicesConnector() |
52 | { | 55 | { |
53 | } | 56 | } |
@@ -272,6 +275,11 @@ namespace OpenSim.Services.Connectors | |||
272 | 275 | ||
273 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 276 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
274 | { | 277 | { |
278 | ulong regionHandle = Util.UIntsToLong((uint)x, (uint)y); | ||
279 | |||
280 | if (m_regionCache.Contains(regionHandle)) | ||
281 | return (GridRegion)m_regionCache[regionHandle]; | ||
282 | |||
275 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 283 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
276 | 284 | ||
277 | sendData["SCOPEID"] = scopeID.ToString(); | 285 | sendData["SCOPEID"] = scopeID.ToString(); |
@@ -313,6 +321,8 @@ namespace OpenSim.Services.Connectors | |||
313 | else | 321 | else |
314 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); | 322 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
315 | 323 | ||
324 | m_regionCache.Add(regionHandle, rinfo, TimeSpan.FromSeconds(600)); | ||
325 | |||
316 | return rinfo; | 326 | return rinfo; |
317 | } | 327 | } |
318 | 328 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index c9c6c31..803cd1b 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
161 | try | 161 | try |
162 | { | 162 | { |
163 | WebClient c = new WebClient(); | 163 | WebClient c = new WebClient(); |
164 | //m_log.Debug("JPEG: " + imageURL); | ||
164 | string name = regionID.ToString(); | 165 | string name = regionID.ToString(); |
165 | filename = Path.Combine(storagePath, name + ".jpg"); | 166 | filename = Path.Combine(storagePath, name + ".jpg"); |
166 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); | 167 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); |
@@ -189,11 +190,10 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
189 | 190 | ||
190 | ass.Data = imageData; | 191 | ass.Data = imageData; |
191 | 192 | ||
192 | mapTile = ass.FullID; | ||
193 | |||
194 | // finally | ||
195 | m_AssetService.Store(ass); | 193 | m_AssetService.Store(ass); |
196 | 194 | ||
195 | // finally | ||
196 | mapTile = ass.FullID; | ||
197 | } | 197 | } |
198 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke | 198 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke |
199 | { | 199 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index d8a3184..5f5b7a7 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -99,8 +99,6 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
99 | throw new Exception("UserAgent connector init error"); | 99 | throw new Exception("UserAgent connector init error"); |
100 | } | 100 | } |
101 | m_ServerURL = serviceURI; | 101 | m_ServerURL = serviceURI; |
102 | if (!m_ServerURL.EndsWith("/")) | ||
103 | m_ServerURL += "/"; | ||
104 | 102 | ||
105 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); | 103 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); |
106 | } | 104 | } |
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 30a73a4..833e22a 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.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/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 5948380..b36fa23 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -153,9 +153,9 @@ namespace OpenSim.Services.Connectors | |||
153 | } | 153 | } |
154 | catch (Exception e) | 154 | catch (Exception e) |
155 | { | 155 | { |
156 | m_log.WarnFormat( | 156 | // m_log.WarnFormat( |
157 | "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", | 157 | // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", |
158 | thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | 158 | // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); |
159 | 159 | ||
160 | return false; | 160 | return false; |
161 | } | 161 | } |
@@ -202,4 +202,4 @@ namespace OpenSim.Services.Connectors | |||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } \ No newline at end of file | 205 | } |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index f7d8c53..378aab6 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -304,6 +304,17 @@ namespace OpenSim.Services.Connectors | |||
304 | { | 304 | { |
305 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); | 305 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); |
306 | } | 306 | } |
307 | else | ||
308 | { | ||
309 | if (replyData["result"].ToString() == "null") | ||
310 | return null; | ||
311 | |||
312 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString()); | ||
313 | } | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for sessionID {0}", sessionID.ToString()); | ||
307 | } | 318 | } |
308 | 319 | ||
309 | return pinfo; | 320 | return pinfo; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 6603f6e..03b19ae 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs | |||
@@ -102,6 +102,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
102 | m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); | 102 | m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); |
103 | } | 103 | } |
104 | 104 | ||
105 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
106 | { | ||
107 | realID = UUID.Zero; | ||
108 | return Authenticate(principalID, password, lifetime); | ||
109 | } | ||
110 | |||
105 | public string Authenticate(UUID principalID, string password, int lifetime) | 111 | public string Authenticate(UUID principalID, string password, int lifetime) |
106 | { | 112 | { |
107 | NameValueCollection requestArgs = new NameValueCollection | 113 | NameValueCollection requestArgs = new NameValueCollection |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 038a4bf..20eaa3a 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, Constants.RegionHeight); | 115 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); |
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 6e32b3a..fcb5115 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/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index 504fcaf..96c02d9 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs | |||
@@ -164,6 +164,11 @@ namespace OpenSim.Services.Connectors | |||
164 | m_database.RemoveRegionEnvironmentSettings(regionUUID); | 164 | m_database.RemoveRegionEnvironmentSettings(regionUUID); |
165 | } | 165 | } |
166 | 166 | ||
167 | public UUID[] GetObjectIDs(UUID regionID) | ||
168 | { | ||
169 | return m_database.GetObjectIDs(regionID); | ||
170 | } | ||
171 | |||
167 | public void SaveExtra(UUID regionID, string name, string val) | 172 | public void SaveExtra(UUID regionID, string name, string val) |
168 | { | 173 | { |
169 | m_database.SaveExtra(regionID, name, val); | 174 | m_database.SaveExtra(regionID, name, val); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index aca414b..0e74073 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -102,6 +102,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
102 | 102 | ||
103 | if (destination == null) | 103 | if (destination == null) |
104 | { | 104 | { |
105 | reason = "Destination not found"; | ||
105 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); | 106 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); |
106 | return false; | 107 | return false; |
107 | } | 108 | } |
@@ -337,6 +338,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
337 | return false; | 338 | return false; |
338 | } | 339 | } |
339 | 340 | ||
341 | OSDMap resp = (OSDMap)result["_Result"]; | ||
342 | success = resp["success"].AsBoolean(); | ||
343 | reason = resp["reason"].AsString(); | ||
344 | |||
340 | return success; | 345 | return success; |
341 | } | 346 | } |
342 | catch (Exception e) | 347 | catch (Exception e) |
@@ -421,11 +426,14 @@ namespace OpenSim.Services.Connectors.Simulation | |||
421 | args["destination_name"] = OSD.FromString(destination.RegionName); | 426 | args["destination_name"] = OSD.FromString(destination.RegionName); |
422 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 427 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
423 | 428 | ||
424 | WebUtil.PostToService(uri, args, 40000); | 429 | OSDMap response = WebUtil.PostToService(uri, args, 40000); |
430 | if (response["Success"] == "False") | ||
431 | return false; | ||
425 | } | 432 | } |
426 | catch (Exception e) | 433 | catch (Exception e) |
427 | { | 434 | { |
428 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString()); | 435 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString()); |
436 | return false; | ||
429 | } | 437 | } |
430 | 438 | ||
431 | return true; | 439 | return true; |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 97d9458..6b2d710 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -187,6 +187,11 @@ namespace OpenSim.Services.Connectors | |||
187 | return accounts; | 187 | return accounts; |
188 | } | 188 | } |
189 | 189 | ||
190 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
191 | { | ||
192 | return null; // Not implemented for regions | ||
193 | } | ||
194 | |||
190 | public virtual bool StoreUserAccount(UserAccount data) | 195 | public virtual bool StoreUserAccount(UserAccount data) |
191 | { | 196 | { |
192 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 197 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
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/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/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs index cee8bc0..cdcfad9 100644 --- a/OpenSim/Services/Interfaces/IAuthenticationService.cs +++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Services.Interfaces | |||
67 | // various services. | 67 | // various services. |
68 | // | 68 | // |
69 | string Authenticate(UUID principalID, string password, int lifetime); | 69 | string Authenticate(UUID principalID, string password, int lifetime); |
70 | string Authenticate(UUID principalID, string password, int lifetime, out UUID realID); | ||
70 | 71 | ||
71 | ////////////////////////////////////////////////////// | 72 | ////////////////////////////////////////////////////// |
72 | // Verification | 73 | // Verification |
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index 6ca0b15..3663a7a 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs | |||
@@ -162,10 +162,16 @@ namespace OpenSim.Services.Interfaces | |||
162 | } | 162 | } |
163 | 163 | ||
164 | // Visual Params | 164 | // Visual Params |
165 | string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; | 165 | // string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; |
166 | // byte[] binary = appearance.VisualParams; | ||
167 | |||
168 | // for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) | ||
169 | |||
170 | |||
166 | byte[] binary = appearance.VisualParams; | 171 | byte[] binary = appearance.VisualParams; |
172 | string[] vps = new string[binary.Length]; | ||
167 | 173 | ||
168 | for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) | 174 | for (int i = 0; i < binary.Length; i++) |
169 | { | 175 | { |
170 | vps[i] = binary[i].ToString(); | 176 | vps[i] = binary[i].ToString(); |
171 | } | 177 | } |
@@ -202,7 +208,13 @@ namespace OpenSim.Services.Interfaces | |||
202 | appearance.Serial = Int32.Parse(Data["Serial"]); | 208 | appearance.Serial = Int32.Parse(Data["Serial"]); |
203 | 209 | ||
204 | if (Data.ContainsKey("AvatarHeight")) | 210 | if (Data.ContainsKey("AvatarHeight")) |
205 | appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); | 211 | { |
212 | float h = float.Parse(Data["AvatarHeight"]); | ||
213 | if( h == 0f) | ||
214 | h = 1.9f; | ||
215 | appearance.SetSize(new Vector3(0.45f, 0.6f, h )); | ||
216 | // appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); | ||
217 | } | ||
206 | 218 | ||
207 | // Legacy Wearables | 219 | // Legacy Wearables |
208 | if (Data.ContainsKey("BodyItem")) | 220 | if (Data.ContainsKey("BodyItem")) |
@@ -273,10 +285,14 @@ namespace OpenSim.Services.Interfaces | |||
273 | if (Data.ContainsKey("VisualParams")) | 285 | if (Data.ContainsKey("VisualParams")) |
274 | { | 286 | { |
275 | string[] vps = Data["VisualParams"].Split(new char[] {','}); | 287 | string[] vps = Data["VisualParams"].Split(new char[] {','}); |
276 | byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; | 288 | // byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; |
289 | |||
290 | // for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) | ||
291 | byte[] binary = new byte[vps.Length]; | ||
277 | 292 | ||
278 | for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) | 293 | for (int i = 0; i < vps.Length; i++) |
279 | binary[i] = (byte)Convert.ToInt32(vps[i]); | 294 | |
295 | binary[i] = (byte)Convert.ToInt32(vps[i]); | ||
280 | 296 | ||
281 | appearance.VisualParams = binary; | 297 | appearance.VisualParams = binary; |
282 | } | 298 | } |
@@ -342,6 +358,7 @@ namespace OpenSim.Services.Interfaces | |||
342 | appearance.Wearables[AvatarWearable.EYES].Wear( | 358 | appearance.Wearables[AvatarWearable.EYES].Wear( |
343 | AvatarWearable.DefaultWearables[ | 359 | AvatarWearable.DefaultWearables[ |
344 | AvatarWearable.EYES][0]); | 360 | AvatarWearable.EYES][0]); |
361 | |||
345 | } | 362 | } |
346 | catch | 363 | catch |
347 | { | 364 | { |
diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs new file mode 100644 index 0000000..8206ecd --- /dev/null +++ b/OpenSim/Services/Interfaces/IBakedTextureService.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 IBakedTextureService | ||
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 d7da056..3f4c958 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -337,9 +337,13 @@ namespace OpenSim.Services.Interfaces | |||
337 | } | 337 | } |
338 | catch (SocketException e) | 338 | catch (SocketException e) |
339 | { | 339 | { |
340 | throw new Exception( | 340 | /*throw new Exception( |
341 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | 341 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + |
342 | e + "' attached to this exception", e); | 342 | e + "' attached to this exception", e);*/ |
343 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | ||
344 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
345 | // resolving and thus make surrounding regions crash out with this exception. | ||
346 | return null; | ||
343 | } | 347 | } |
344 | 348 | ||
345 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 349 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
@@ -398,6 +402,12 @@ namespace OpenSim.Services.Interfaces | |||
398 | if (kvp.ContainsKey("regionName")) | 402 | if (kvp.ContainsKey("regionName")) |
399 | RegionName = (string)kvp["regionName"]; | 403 | RegionName = (string)kvp["regionName"]; |
400 | 404 | ||
405 | if (kvp.ContainsKey("access")) | ||
406 | { | ||
407 | byte access = Convert.ToByte((string)kvp["access"]); | ||
408 | Maturity = (int)Util.ConvertAccessLevelToMaturity(access); | ||
409 | } | ||
410 | |||
401 | if (kvp.ContainsKey("serverIP")) | 411 | if (kvp.ContainsKey("serverIP")) |
402 | { | 412 | { |
403 | //int port = 0; | 413 | //int port = 0; |
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 6ab5258..057c492 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. " + |
@@ -145,6 +150,7 @@ namespace OpenSim.Services.LLLoginService | |||
145 | private UUID agentID; | 150 | private UUID agentID; |
146 | private UUID sessionID; | 151 | private UUID sessionID; |
147 | private UUID secureSessionID; | 152 | private UUID secureSessionID; |
153 | private UUID realID; | ||
148 | 154 | ||
149 | // Login Flags | 155 | // Login Flags |
150 | private string dst; | 156 | private string dst; |
@@ -228,7 +234,7 @@ namespace OpenSim.Services.LLLoginService | |||
228 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, | 234 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, |
229 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, | 235 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, |
230 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, | 236 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, |
231 | string DSTZone, string destinationsURL, string avatarsURL, string classifiedFee) | 237 | string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee) |
232 | : this() | 238 | : this() |
233 | { | 239 | { |
234 | FillOutInventoryData(invSkel, libService); | 240 | FillOutInventoryData(invSkel, libService); |
@@ -241,6 +247,7 @@ namespace OpenSim.Services.LLLoginService | |||
241 | AgentID = account.PrincipalID; | 247 | AgentID = account.PrincipalID; |
242 | SessionID = aCircuit.SessionID; | 248 | SessionID = aCircuit.SessionID; |
243 | SecureSessionID = aCircuit.SecureSessionID; | 249 | SecureSessionID = aCircuit.SecureSessionID; |
250 | RealID = realID; | ||
244 | Message = message; | 251 | Message = message; |
245 | BuddList = ConvertFriendListItem(friendsList); | 252 | BuddList = ConvertFriendListItem(friendsList); |
246 | StartLocation = where; | 253 | StartLocation = where; |
@@ -380,6 +387,7 @@ namespace OpenSim.Services.LLLoginService | |||
380 | private void FillOutRegionData(GridRegion destination) | 387 | private void FillOutRegionData(GridRegion destination) |
381 | { | 388 | { |
382 | IPEndPoint endPoint = destination.ExternalEndPoint; | 389 | IPEndPoint endPoint = destination.ExternalEndPoint; |
390 | if (endPoint == null) return; | ||
383 | SimAddress = endPoint.Address.ToString(); | 391 | SimAddress = endPoint.Address.ToString(); |
384 | SimPort = (uint)endPoint.Port; | 392 | SimPort = (uint)endPoint.Port; |
385 | RegionX = (uint)destination.RegionLocX; | 393 | RegionX = (uint)destination.RegionLocX; |
@@ -455,6 +463,7 @@ namespace OpenSim.Services.LLLoginService | |||
455 | SessionID = UUID.Random(); | 463 | SessionID = UUID.Random(); |
456 | SecureSessionID = UUID.Random(); | 464 | SecureSessionID = UUID.Random(); |
457 | AgentID = UUID.Random(); | 465 | AgentID = UUID.Random(); |
466 | RealID = UUID.Zero; | ||
458 | 467 | ||
459 | Hashtable InitialOutfitHash = new Hashtable(); | 468 | Hashtable InitialOutfitHash = new Hashtable(); |
460 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | 469 | InitialOutfitHash["folder_name"] = "Nightclub Female"; |
@@ -499,6 +508,7 @@ namespace OpenSim.Services.LLLoginService | |||
499 | responseData["http_port"] = (Int32)SimHttpPort; | 508 | responseData["http_port"] = (Int32)SimHttpPort; |
500 | 509 | ||
501 | responseData["agent_id"] = AgentID.ToString(); | 510 | responseData["agent_id"] = AgentID.ToString(); |
511 | responseData["real_id"] = RealID.ToString(); | ||
502 | responseData["session_id"] = SessionID.ToString(); | 512 | responseData["session_id"] = SessionID.ToString(); |
503 | responseData["secure_session_id"] = SecureSessionID.ToString(); | 513 | responseData["secure_session_id"] = SecureSessionID.ToString(); |
504 | responseData["circuit_code"] = CircuitCode; | 514 | responseData["circuit_code"] = CircuitCode; |
@@ -590,6 +600,7 @@ namespace OpenSim.Services.LLLoginService | |||
590 | map["sim_ip"] = OSD.FromString(SimAddress); | 600 | map["sim_ip"] = OSD.FromString(SimAddress); |
591 | 601 | ||
592 | map["agent_id"] = OSD.FromUUID(AgentID); | 602 | map["agent_id"] = OSD.FromUUID(AgentID); |
603 | map["real_id"] = OSD.FromUUID(RealID); | ||
593 | map["session_id"] = OSD.FromUUID(SessionID); | 604 | map["session_id"] = OSD.FromUUID(SessionID); |
594 | map["secure_session_id"] = OSD.FromUUID(SecureSessionID); | 605 | map["secure_session_id"] = OSD.FromUUID(SecureSessionID); |
595 | map["circuit_code"] = OSD.FromInteger(CircuitCode); | 606 | map["circuit_code"] = OSD.FromInteger(CircuitCode); |
@@ -900,6 +911,12 @@ namespace OpenSim.Services.LLLoginService | |||
900 | set { secureSessionID = value; } | 911 | set { secureSessionID = value; } |
901 | } | 912 | } |
902 | 913 | ||
914 | public UUID RealID | ||
915 | { | ||
916 | get { return realID; } | ||
917 | set { realID = value; } | ||
918 | } | ||
919 | |||
903 | public Int32 CircuitCode | 920 | public Int32 CircuitCode |
904 | { | 921 | { |
905 | get { return circuitCode; } | 922 | get { return circuitCode; } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index fe43582..faf7f71 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -147,7 +147,8 @@ namespace OpenSim.Services.LLLoginService | |||
147 | Object[] args = new Object[] { config }; | 147 | Object[] args = new Object[] { config }; |
148 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 148 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
149 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | 149 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); |
150 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); | 150 | Object[] authArgs = new Object[] { config, m_UserAccountService }; |
151 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs); | ||
151 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); | 152 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); |
152 | 153 | ||
153 | if (gridService != string.Empty) | 154 | if (gridService != string.Empty) |
@@ -296,6 +297,12 @@ namespace OpenSim.Services.LLLoginService | |||
296 | return LLFailedLoginResponse.UserProblem; | 297 | return LLFailedLoginResponse.UserProblem; |
297 | } | 298 | } |
298 | 299 | ||
300 | if (account.UserLevel < 0) | ||
301 | { | ||
302 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: Unverified account"); | ||
303 | return LLFailedLoginResponse.UnverifiedAccountProblem; | ||
304 | } | ||
305 | |||
299 | if (account.UserLevel < m_MinLoginLevel) | 306 | if (account.UserLevel < m_MinLoginLevel) |
300 | { | 307 | { |
301 | m_log.InfoFormat( | 308 | m_log.InfoFormat( |
@@ -327,7 +334,8 @@ namespace OpenSim.Services.LLLoginService | |||
327 | if (!passwd.StartsWith("$1$")) | 334 | if (!passwd.StartsWith("$1$")) |
328 | passwd = "$1$" + Util.Md5Hash(passwd); | 335 | passwd = "$1$" + Util.Md5Hash(passwd); |
329 | passwd = passwd.Remove(0, 3); //remove $1$ | 336 | passwd = passwd.Remove(0, 3); //remove $1$ |
330 | string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30); | 337 | UUID realID; |
338 | string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out realID); | ||
331 | UUID secureSession = UUID.Zero; | 339 | UUID secureSession = UUID.Zero; |
332 | if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) | 340 | if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) |
333 | { | 341 | { |
@@ -460,7 +468,7 @@ namespace OpenSim.Services.LLLoginService | |||
460 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | 468 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, |
461 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, | 469 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, |
462 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, | 470 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, |
463 | m_DestinationGuide, m_AvatarPicker, m_ClassifiedFee); | 471 | m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee); |
464 | 472 | ||
465 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); | 473 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); |
466 | 474 | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 1852e4f..772ab97 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -171,6 +171,10 @@ namespace OpenSim.Services.UserAccountService | |||
171 | Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); | 171 | Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); |
172 | if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) | 172 | if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) |
173 | Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); | 173 | Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); |
174 | if (d.Data.ContainsKey("UserCountry") && d.Data["UserCountry"] != null) | ||
175 | u.UserCountry = d.Data["UserCountry"].ToString(); | ||
176 | else | ||
177 | u.UserTitle = string.Empty; | ||
174 | 178 | ||
175 | if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) | 179 | if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) |
176 | { | 180 | { |
@@ -292,7 +296,22 @@ namespace OpenSim.Services.UserAccountService | |||
292 | 296 | ||
293 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 297 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
294 | { | 298 | { |
295 | UserAccountData[] d = m_Database.GetUsers(scopeID, query); | 299 | UserAccountData[] d = m_Database.GetUsers(scopeID, query.Trim()); |
300 | |||
301 | if (d == null) | ||
302 | return new List<UserAccount>(); | ||
303 | |||
304 | List<UserAccount> ret = new List<UserAccount>(); | ||
305 | |||
306 | foreach (UserAccountData data in d) | ||
307 | ret.Add(MakeUserAccount(data)); | ||
308 | |||
309 | return ret; | ||
310 | } | ||
311 | |||
312 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
313 | { | ||
314 | UserAccountData[] d = m_Database.GetUsersWhere(scopeID, where); | ||
296 | 315 | ||
297 | if (d == null) | 316 | if (d == null) |
298 | return new List<UserAccount>(); | 317 | return new List<UserAccount>(); |