diff options
Diffstat (limited to 'OpenSim/Client')
-rw-r--r-- | OpenSim/Client/Linden/LLProxyLoginModule.cs | 184 | ||||
-rw-r--r-- | OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | 13 |
3 files changed, 110 insertions, 89 deletions
diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index ccd38d4..f9cb3a9 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs | |||
@@ -148,8 +148,8 @@ namespace OpenSim.Client.Linden | |||
148 | protected void AddHttpHandlers() | 148 | protected void AddHttpHandlers() |
149 | { | 149 | { |
150 | //we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change? | 150 | //we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change? |
151 | MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser); | 151 | MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser, false); |
152 | MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser); | 152 | MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser, false); |
153 | } | 153 | } |
154 | 154 | ||
155 | protected void AddScene(Scene scene) | 155 | protected void AddScene(Scene scene) |
@@ -182,104 +182,126 @@ namespace OpenSim.Client.Linden | |||
182 | /// <returns></returns> | 182 | /// <returns></returns> |
183 | public XmlRpcResponse ExpectUser(XmlRpcRequest request, IPEndPoint remoteClient) | 183 | public XmlRpcResponse ExpectUser(XmlRpcRequest request, IPEndPoint remoteClient) |
184 | { | 184 | { |
185 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
186 | AgentCircuitData agentData = new AgentCircuitData(); | ||
187 | agentData.SessionID = new UUID((string)requestData["session_id"]); | ||
188 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); | ||
189 | agentData.firstname = (string)requestData["firstname"]; | ||
190 | agentData.lastname = (string)requestData["lastname"]; | ||
191 | agentData.AgentID = new UUID((string)requestData["agent_id"]); | ||
192 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
193 | agentData.CapsPath = (string)requestData["caps_path"]; | ||
194 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
195 | |||
196 | // Appearance | ||
197 | if (requestData["appearance"] != null) | ||
198 | agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]); | ||
199 | |||
200 | m_log.DebugFormat( | ||
201 | "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", | ||
202 | agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); | ||
203 | |||
204 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
205 | { | ||
206 | //m_log.Debug("[CLIENT]: Child agent detected"); | ||
207 | agentData.child = true; | ||
208 | } | ||
209 | else | ||
210 | { | ||
211 | //m_log.Debug("[CLIENT]: Main agent detected"); | ||
212 | agentData.startpos = | ||
213 | new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), | ||
214 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), | ||
215 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); | ||
216 | agentData.child = false; | ||
217 | } | ||
218 | |||
219 | XmlRpcResponse resp = new XmlRpcResponse(); | 185 | XmlRpcResponse resp = new XmlRpcResponse(); |
220 | 186 | ||
221 | if (!RegionLoginsEnabled) | 187 | try |
222 | { | 188 | { |
223 | m_log.InfoFormat( | 189 | ulong regionHandle = 0; |
224 | "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", | 190 | Hashtable requestData = (Hashtable)request.Params[0]; |
225 | agentData.firstname, agentData.lastname); | 191 | AgentCircuitData agentData = new AgentCircuitData(); |
192 | if (requestData.ContainsKey("session_id")) | ||
193 | agentData.SessionID = new UUID((string)requestData["session_id"]); | ||
194 | if (requestData.ContainsKey("secure_session_id")) | ||
195 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); | ||
196 | if (requestData.ContainsKey("firstname")) | ||
197 | agentData.firstname = (string)requestData["firstname"]; | ||
198 | if (requestData.ContainsKey("lastname")) | ||
199 | agentData.lastname = (string)requestData["lastname"]; | ||
200 | if (requestData.ContainsKey("agent_id")) | ||
201 | agentData.AgentID = new UUID((string)requestData["agent_id"]); | ||
202 | if (requestData.ContainsKey("circuit_code")) | ||
203 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
204 | if (requestData.ContainsKey("caps_path")) | ||
205 | agentData.CapsPath = (string)requestData["caps_path"]; | ||
206 | if (requestData.ContainsKey("regionhandle")) | ||
207 | regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
208 | else | ||
209 | m_log.Warn("[CLIENT]: request from login server did not contain regionhandle"); | ||
226 | 210 | ||
227 | Hashtable respdata = new Hashtable(); | 211 | // Appearance |
228 | respdata["success"] = "FALSE"; | 212 | if (requestData.ContainsKey("appearance")) |
229 | respdata["reason"] = "region login currently disabled"; | 213 | agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]); |
230 | resp.Value = respdata; | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | bool success = false; | ||
235 | string denyMess = ""; | ||
236 | 214 | ||
237 | Scene scene; | 215 | m_log.DebugFormat( |
238 | if (TryGetRegion(regionHandle, out scene)) | 216 | "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", |
239 | { | 217 | agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); |
240 | if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) | ||
241 | { | ||
242 | denyMess = "User is banned from this region"; | ||
243 | m_log.InfoFormat( | ||
244 | "[CLIENT]: Denying access for user {0} {1} because user is banned", | ||
245 | agentData.firstname, agentData.lastname); | ||
246 | } | ||
247 | else | ||
248 | { | ||
249 | string reason; | ||
250 | if (scene.NewUserConnection(agentData, out reason)) | ||
251 | { | ||
252 | success = true; | ||
253 | } | ||
254 | else | ||
255 | { | ||
256 | denyMess = String.Format("Login refused by region: {0}", reason); | ||
257 | m_log.InfoFormat( | ||
258 | "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", | ||
259 | agentData.firstname, agentData.lastname); | ||
260 | } | ||
261 | } | ||
262 | 218 | ||
219 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
220 | { | ||
221 | //m_log.Debug("[CLIENT]: Child agent detected"); | ||
222 | agentData.child = true; | ||
263 | } | 223 | } |
264 | else | 224 | else |
265 | { | 225 | { |
266 | denyMess = "Region not found"; | 226 | //m_log.Debug("[CLIENT]: Main agent detected"); |
227 | agentData.startpos = | ||
228 | new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), | ||
229 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), | ||
230 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); | ||
231 | agentData.child = false; | ||
267 | } | 232 | } |
268 | 233 | ||
269 | if (success) | 234 | if (!RegionLoginsEnabled) |
270 | { | 235 | { |
236 | m_log.InfoFormat( | ||
237 | "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", | ||
238 | agentData.firstname, agentData.lastname); | ||
239 | |||
271 | Hashtable respdata = new Hashtable(); | 240 | Hashtable respdata = new Hashtable(); |
272 | respdata["success"] = "TRUE"; | 241 | respdata["success"] = "FALSE"; |
242 | respdata["reason"] = "region login currently disabled"; | ||
273 | resp.Value = respdata; | 243 | resp.Value = respdata; |
274 | } | 244 | } |
275 | else | 245 | else |
276 | { | 246 | { |
277 | Hashtable respdata = new Hashtable(); | 247 | bool success = false; |
278 | respdata["success"] = "FALSE"; | 248 | string denyMess = ""; |
279 | respdata["reason"] = denyMess; | 249 | |
280 | resp.Value = respdata; | 250 | Scene scene; |
251 | if (TryGetRegion(regionHandle, out scene)) | ||
252 | { | ||
253 | if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) | ||
254 | { | ||
255 | denyMess = "User is banned from this region"; | ||
256 | m_log.InfoFormat( | ||
257 | "[CLIENT]: Denying access for user {0} {1} because user is banned", | ||
258 | agentData.firstname, agentData.lastname); | ||
259 | } | ||
260 | else | ||
261 | { | ||
262 | string reason; | ||
263 | if (scene.NewUserConnection(agentData, out reason)) | ||
264 | { | ||
265 | success = true; | ||
266 | } | ||
267 | else | ||
268 | { | ||
269 | denyMess = String.Format("Login refused by region: {0}", reason); | ||
270 | m_log.InfoFormat( | ||
271 | "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", | ||
272 | agentData.firstname, agentData.lastname); | ||
273 | } | ||
274 | } | ||
275 | |||
276 | } | ||
277 | else | ||
278 | { | ||
279 | denyMess = "Region not found"; | ||
280 | } | ||
281 | |||
282 | if (success) | ||
283 | { | ||
284 | Hashtable respdata = new Hashtable(); | ||
285 | respdata["success"] = "TRUE"; | ||
286 | resp.Value = respdata; | ||
287 | } | ||
288 | else | ||
289 | { | ||
290 | Hashtable respdata = new Hashtable(); | ||
291 | respdata["success"] = "FALSE"; | ||
292 | respdata["reason"] = denyMess; | ||
293 | resp.Value = respdata; | ||
294 | } | ||
281 | } | 295 | } |
282 | } | 296 | } |
297 | catch (Exception e) | ||
298 | { | ||
299 | m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0}", e); | ||
300 | Hashtable respdata = new Hashtable(); | ||
301 | respdata["success"] = "FALSE"; | ||
302 | respdata["reason"] = "Exception occurred"; | ||
303 | resp.Value = respdata; | ||
304 | } | ||
283 | 305 | ||
284 | return resp; | 306 | return resp; |
285 | } | 307 | } |
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index e901ff6..bc1b2e5 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs | |||
@@ -886,7 +886,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
886 | chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid; | 886 | chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid; |
887 | chatActionEvent.ActionFragment.ObservationRadius = 180.0f; | 887 | chatActionEvent.ActionFragment.ObservationRadius = 180.0f; |
888 | chatActionEvent.ActionFragment.ExtensionDialect = "TEXT"; | 888 | chatActionEvent.ActionFragment.ExtensionDialect = "TEXT"; |
889 | chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message)); | 889 | chatActionEvent.SetPayloadData(Util.UTF8.GetBytes(message)); |
890 | 890 | ||
891 | Session.Send(chatActionEvent); | 891 | Session.Send(chatActionEvent); |
892 | } | 892 | } |
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 8c9eb5f..c649c5a 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | |||
@@ -95,16 +95,15 @@ namespace OpenSim.Client.VWoHTTP.ClientStack | |||
95 | 95 | ||
96 | ManagedImage tmp; | 96 | ManagedImage tmp; |
97 | Image imgData; | 97 | Image imgData; |
98 | byte[] jpegdata; | ||
98 | 99 | ||
99 | OpenJPEG.DecodeToImage(asset.Data, out tmp, out imgData); | 100 | OpenJPEG.DecodeToImage(asset.Data, out tmp, out imgData); |
100 | |||
101 | MemoryStream ms = new MemoryStream(); | ||
102 | 101 | ||
103 | imgData.Save(ms, ImageFormat.Jpeg); | 102 | using (MemoryStream ms = new MemoryStream()) |
104 | 103 | { | |
105 | byte[] jpegdata = ms.GetBuffer(); | 104 | imgData.Save(ms, ImageFormat.Jpeg); |
106 | 105 | jpegdata = ms.GetBuffer(); | |
107 | ms.Close(); | 106 | } |
108 | 107 | ||
109 | resp.ContentType = "image/jpeg"; | 108 | resp.ContentType = "image/jpeg"; |
110 | resp.ContentLength = jpegdata.Length; | 109 | resp.ContentLength = jpegdata.Length; |