diff options
Diffstat (limited to '')
10 files changed, 250 insertions, 72 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index a6f4e47..36c48e6 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -236,16 +236,16 @@ namespace OpenSim.Server.Base | |||
236 | 236 | ||
237 | // Register the quit command | 237 | // Register the quit command |
238 | // | 238 | // |
239 | MainConsole.Instance.Commands.AddCommand("base", false, "quit", | 239 | MainConsole.Instance.Commands.AddCommand("General", false, "quit", |
240 | "quit", | 240 | "quit", |
241 | "Quit the application", HandleQuit); | 241 | "Quit the application", HandleQuit); |
242 | 242 | ||
243 | MainConsole.Instance.Commands.AddCommand("base", false, "shutdown", | 243 | MainConsole.Instance.Commands.AddCommand("General", false, "shutdown", |
244 | "shutdown", | 244 | "shutdown", |
245 | "Quit the application", HandleQuit); | 245 | "Quit the application", HandleQuit); |
246 | 246 | ||
247 | // Register a command to read other commands from a file | 247 | // Register a command to read other commands from a file |
248 | MainConsole.Instance.Commands.AddCommand("base", false, "command-script", | 248 | MainConsole.Instance.Commands.AddCommand("General", false, "command-script", |
249 | "command-script <script>", | 249 | "command-script <script>", |
250 | "Run a command script from file", HandleScript); | 250 | "Run a command script from file", HandleScript); |
251 | 251 | ||
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 9b80245..46b0c67 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
59 | if (assetService == String.Empty) | 59 | if (assetService == String.Empty) |
60 | throw new Exception("No LocalServiceModule in config file"); | 60 | throw new Exception("No LocalServiceModule in config file"); |
61 | 61 | ||
62 | Object[] args = new Object[] { config }; | 62 | Object[] args = new Object[] { config, m_ConfigName }; |
63 | m_AssetService = | 63 | m_AssetService = |
64 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | 64 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); |
65 | 65 | ||
@@ -72,19 +72,19 @@ namespace OpenSim.Server.Handlers.Asset | |||
72 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 72 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); |
73 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete)); | 73 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete)); |
74 | 74 | ||
75 | MainConsole.Instance.Commands.AddCommand("kfs", false, | 75 | MainConsole.Instance.Commands.AddCommand("Assets", false, |
76 | "show asset", | 76 | "show asset", |
77 | "show asset <ID>", | 77 | "show asset <ID>", |
78 | "Show asset information", | 78 | "Show asset information", |
79 | HandleShowAsset); | 79 | HandleShowAsset); |
80 | 80 | ||
81 | MainConsole.Instance.Commands.AddCommand("kfs", false, | 81 | MainConsole.Instance.Commands.AddCommand("Assets", false, |
82 | "delete asset", | 82 | "delete asset", |
83 | "delete asset <ID>", | 83 | "delete asset <ID>", |
84 | "Delete asset from database", | 84 | "Delete asset from database", |
85 | HandleDeleteAsset); | 85 | HandleDeleteAsset); |
86 | 86 | ||
87 | MainConsole.Instance.Commands.AddCommand("kfs", false, | 87 | MainConsole.Instance.Commands.AddCommand("Assets", false, |
88 | "dump asset", | 88 | "dump asset", |
89 | "dump asset <ID>", | 89 | "dump asset <ID>", |
90 | "Dump asset to a file", | 90 | "Dump asset to a file", |
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index 440b898..dfed761 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | |||
@@ -248,7 +248,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>. | |||
248 | if (passwordValues != null && passwordValues.Length == 1) | 248 | if (passwordValues != null && passwordValues.Length == 1) |
249 | { | 249 | { |
250 | if (account != null && | 250 | if (account != null && |
251 | (m_authenticationService.Authenticate(account.PrincipalID, passwordValues[0], 30) != string.Empty)) | 251 | (m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty)) |
252 | authRequest.IsAuthenticated = true; | 252 | authRequest.IsAuthenticated = true; |
253 | else | 253 | else |
254 | authRequest.IsAuthenticated = false; | 254 | authRequest.IsAuthenticated = false; |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs index 82a7220..6c79c60 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs | |||
@@ -36,36 +36,42 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
36 | { | 36 | { |
37 | public class HGFriendsServerConnector : ServiceConnector | 37 | public class HGFriendsServerConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IFriendsService m_FriendsService; | ||
40 | private IUserAgentService m_UserAgentService; | 39 | private IUserAgentService m_UserAgentService; |
40 | private IHGFriendsService m_TheService; | ||
41 | private string m_ConfigName = "HGFriendsService"; | 41 | private string m_ConfigName = "HGFriendsService"; |
42 | 42 | ||
43 | // Called from Robust | ||
43 | public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName) : | 44 | public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName) : |
44 | base(config, server, configName) | 45 | this(config, server, configName, null) |
45 | { | 46 | { |
46 | if (configName != string.Empty) | 47 | |
48 | } | ||
49 | |||
50 | // Called from standalone configurations | ||
51 | public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) | ||
52 | : base(config, server, configName) | ||
53 | { | ||
54 | if (configName != string.Empty) | ||
47 | m_ConfigName = configName; | 55 | m_ConfigName = configName; |
48 | 56 | ||
57 | Object[] args = new Object[] { config, m_ConfigName, localConn }; | ||
58 | |||
49 | IConfig serverConfig = config.Configs[m_ConfigName]; | 59 | IConfig serverConfig = config.Configs[m_ConfigName]; |
50 | if (serverConfig == null) | 60 | if (serverConfig == null) |
51 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); | 61 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); |
52 | 62 | ||
53 | string theService = serverConfig.GetString("LocalServiceModule", | 63 | string theService = serverConfig.GetString("LocalServiceModule", |
54 | String.Empty); | 64 | String.Empty); |
55 | |||
56 | if (theService == String.Empty) | 65 | if (theService == String.Empty) |
57 | throw new Exception("No LocalServiceModule in config file"); | 66 | throw new Exception("No LocalServiceModule in config file"); |
58 | 67 | m_TheService = ServerUtils.LoadPlugin<IHGFriendsService>(theService, args); | |
59 | Object[] args = new Object[] { config }; | ||
60 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); | ||
61 | 68 | ||
62 | theService = serverConfig.GetString("UserAgentService", string.Empty); | 69 | theService = serverConfig.GetString("UserAgentService", string.Empty); |
63 | if (theService == String.Empty) | 70 | if (theService == String.Empty) |
64 | throw new Exception("No UserAgentService in " + m_ConfigName); | 71 | throw new Exception("No UserAgentService in " + m_ConfigName); |
72 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(theService, new Object[] { config, localConn }); | ||
65 | 73 | ||
66 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(theService, args); | 74 | server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn)); |
67 | |||
68 | server.AddStreamHandler(new HGFriendsServerPostHandler(m_FriendsService, m_UserAgentService)); | ||
69 | } | 75 | } |
70 | } | 76 | } |
71 | } | 77 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 661507e..8ef03e7 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
42 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
42 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
@@ -49,15 +50,22 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
49 | { | 50 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 52 | ||
52 | private IFriendsService m_FriendsService; | ||
53 | private IUserAgentService m_UserAgentService; | 53 | private IUserAgentService m_UserAgentService; |
54 | private IFriendsSimConnector m_FriendsLocalSimConnector; | ||
55 | private IHGFriendsService m_TheService; | ||
54 | 56 | ||
55 | public HGFriendsServerPostHandler(IFriendsService service, IUserAgentService uservice) : | 57 | public HGFriendsServerPostHandler(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) : |
56 | base("POST", "/hgfriends") | 58 | base("POST", "/hgfriends") |
57 | { | 59 | { |
58 | m_FriendsService = service; | 60 | m_TheService = service; |
59 | m_UserAgentService = uservice; | 61 | m_UserAgentService = uas; |
60 | m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On"); | 62 | m_FriendsLocalSimConnector = friendsConn; |
63 | |||
64 | m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", | ||
65 | (m_FriendsLocalSimConnector == null ? "robust" : "standalone")); | ||
66 | |||
67 | if (m_TheService == null) | ||
68 | m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!"); | ||
61 | } | 69 | } |
62 | 70 | ||
63 | public override byte[] Handle(string path, Stream requestData, | 71 | public override byte[] Handle(string path, Stream requestData, |
@@ -90,6 +98,29 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
90 | 98 | ||
91 | case "deletefriendship": | 99 | case "deletefriendship": |
92 | return DeleteFriendship(request); | 100 | return DeleteFriendship(request); |
101 | |||
102 | /* Same as inter-sim */ | ||
103 | case "friendship_offered": | ||
104 | return FriendshipOffered(request); | ||
105 | |||
106 | case "validate_friendship_offered": | ||
107 | return ValidateFriendshipOffered(request); | ||
108 | |||
109 | case "statusnotification": | ||
110 | return StatusNotification(request); | ||
111 | /* | ||
112 | case "friendship_approved": | ||
113 | return FriendshipApproved(request); | ||
114 | |||
115 | case "friendship_denied": | ||
116 | return FriendshipDenied(request); | ||
117 | |||
118 | case "friendship_terminated": | ||
119 | return FriendshipTerminated(request); | ||
120 | |||
121 | case "grant_rights": | ||
122 | return GrantRights(request); | ||
123 | */ | ||
93 | } | 124 | } |
94 | m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); | 125 | m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); |
95 | } | 126 | } |
@@ -126,39 +157,20 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
126 | return FailureResult(); | 157 | return FailureResult(); |
127 | } | 158 | } |
128 | 159 | ||
129 | FriendInfo[] friendsInfo = m_FriendsService.GetFriends(principalID); | 160 | int perms = m_TheService.GetFriendPerms(principalID, friendID); |
130 | foreach (FriendInfo finfo in friendsInfo) | 161 | if (perms < 0) |
131 | { | 162 | return FailureResult("Friend not found"); |
132 | if (finfo.Friend.StartsWith(friendID.ToString())) | ||
133 | return SuccessResult(finfo.TheirFlags.ToString()); | ||
134 | } | ||
135 | 163 | ||
136 | return FailureResult("Friend not found"); | 164 | return SuccessResult(perms.ToString()); |
137 | } | 165 | } |
138 | 166 | ||
139 | byte[] NewFriendship(Dictionary<string, object> request) | 167 | byte[] NewFriendship(Dictionary<string, object> request) |
140 | { | 168 | { |
141 | if (!VerifyServiceKey(request)) | 169 | bool verified = VerifyServiceKey(request); |
142 | return FailureResult(); | ||
143 | 170 | ||
144 | // OK, can proceed | ||
145 | FriendInfo friend = new FriendInfo(request); | 171 | FriendInfo friend = new FriendInfo(request); |
146 | UUID friendID; | ||
147 | string tmp = string.Empty; | ||
148 | if (!Util.ParseUniversalUserIdentifier(friend.Friend, out friendID, out tmp, out tmp, out tmp, out tmp)) | ||
149 | return FailureResult(); | ||
150 | |||
151 | |||
152 | m_log.DebugFormat("[HGFRIENDS HANDLER]: New friendship {0} {1}", friend.PrincipalID, friend.Friend); | ||
153 | 172 | ||
154 | // If the friendship already exists, return fail | 173 | bool success = m_TheService.NewFriendship(friend, verified); |
155 | FriendInfo[] finfos = m_FriendsService.GetFriends(friend.PrincipalID); | ||
156 | foreach (FriendInfo finfo in finfos) | ||
157 | if (finfo.Friend.StartsWith(friendID.ToString())) | ||
158 | return FailureResult(); | ||
159 | |||
160 | // the user needs to confirm when he gets home | ||
161 | bool success = m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, 0); | ||
162 | 174 | ||
163 | if (success) | 175 | if (success) |
164 | return SuccessResult(); | 176 | return SuccessResult(); |
@@ -174,25 +186,105 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
174 | secret = request["SECRET"].ToString(); | 186 | secret = request["SECRET"].ToString(); |
175 | 187 | ||
176 | if (secret == string.Empty) | 188 | if (secret == string.Empty) |
189 | return BoolResult(false); | ||
190 | |||
191 | bool success = m_TheService.DeleteFriendship(friend, secret); | ||
192 | |||
193 | return BoolResult(success); | ||
194 | } | ||
195 | |||
196 | byte[] FriendshipOffered(Dictionary<string, object> request) | ||
197 | { | ||
198 | UUID fromID = UUID.Zero; | ||
199 | UUID toID = UUID.Zero; | ||
200 | string message = string.Empty; | ||
201 | string name = string.Empty; | ||
202 | |||
203 | if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID")) | ||
204 | return BoolResult(false); | ||
205 | |||
206 | if (!UUID.TryParse(request["ToID"].ToString(), out toID)) | ||
207 | return BoolResult(false); | ||
208 | |||
209 | message = request["Message"].ToString(); | ||
210 | |||
211 | if (!UUID.TryParse(request["FromID"].ToString(), out fromID)) | ||
212 | return BoolResult(false); | ||
213 | |||
214 | if (request.ContainsKey("FromName")) | ||
215 | name = request["FromName"].ToString(); | ||
216 | |||
217 | bool success = m_TheService.FriendshipOffered(fromID, name, toID, message); | ||
218 | |||
219 | return BoolResult(success); | ||
220 | } | ||
221 | |||
222 | byte[] ValidateFriendshipOffered(Dictionary<string, object> request) | ||
223 | { | ||
224 | FriendInfo friend = new FriendInfo(request); | ||
225 | UUID friendID = UUID.Zero; | ||
226 | if (!UUID.TryParse(friend.Friend, out friendID)) | ||
227 | return BoolResult(false); | ||
228 | |||
229 | bool success = m_TheService.ValidateFriendshipOffered(friend.PrincipalID, friendID); | ||
230 | |||
231 | return BoolResult(success); | ||
232 | } | ||
233 | |||
234 | byte[] StatusNotification(Dictionary<string, object> request) | ||
235 | { | ||
236 | UUID principalID = UUID.Zero; | ||
237 | if (request.ContainsKey("userID")) | ||
238 | UUID.TryParse(request["userID"].ToString(), out principalID); | ||
239 | else | ||
240 | { | ||
241 | m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify"); | ||
242 | return FailureResult(); | ||
243 | } | ||
244 | |||
245 | bool online = true; | ||
246 | if (request.ContainsKey("online")) | ||
247 | Boolean.TryParse(request["online"].ToString(), out online); | ||
248 | else | ||
249 | { | ||
250 | m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify"); | ||
177 | return FailureResult(); | 251 | return FailureResult(); |
252 | } | ||
178 | 253 | ||
179 | FriendInfo[] finfos = m_FriendsService.GetFriends(friend.PrincipalID); | 254 | List<string> friends = new List<string>(); |
180 | foreach (FriendInfo finfo in finfos) | 255 | int i = 0; |
256 | foreach (KeyValuePair<string, object> kvp in request) | ||
181 | { | 257 | { |
182 | // We check the secret here | 258 | if (kvp.Key.Equals("friend_" + i.ToString())) |
183 | if (finfo.Friend.StartsWith(friend.Friend) && finfo.Friend.EndsWith(secret)) | ||
184 | { | 259 | { |
185 | m_log.DebugFormat("[HGFRIENDS HANDLER]: Delete friendship {0} {1}", friend.PrincipalID, friend.Friend); | 260 | friends.Add(kvp.Value.ToString()); |
186 | m_FriendsService.Delete(friend.PrincipalID, finfo.Friend); | 261 | i++; |
187 | m_FriendsService.Delete(finfo.Friend, friend.PrincipalID.ToString()); | 262 | } |
263 | } | ||
264 | |||
265 | List<UUID> onlineFriends = m_TheService.StatusNotification(friends, principalID, online); | ||
188 | 266 | ||
189 | return SuccessResult(); | 267 | Dictionary<string, object> result = new Dictionary<string, object>(); |
268 | if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0))) | ||
269 | result["RESULT"] = "NULL"; | ||
270 | else | ||
271 | { | ||
272 | i = 0; | ||
273 | foreach (UUID f in onlineFriends) | ||
274 | { | ||
275 | result["friend_" + i] = f.ToString(); | ||
276 | i++; | ||
190 | } | 277 | } |
191 | } | 278 | } |
192 | 279 | ||
193 | return FailureResult(); | 280 | string xmlString = ServerUtils.BuildXmlResponse(result); |
281 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
282 | UTF8Encoding encoding = new UTF8Encoding(); | ||
283 | return encoding.GetBytes(xmlString); | ||
284 | |||
194 | } | 285 | } |
195 | 286 | ||
287 | |||
196 | #endregion | 288 | #endregion |
197 | 289 | ||
198 | #region Misc | 290 | #region Misc |
@@ -205,10 +297,15 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
205 | return false; | 297 | return false; |
206 | } | 298 | } |
207 | 299 | ||
300 | if (request["KEY"] == null || request["SESSIONID"] == null) | ||
301 | return false; | ||
302 | |||
208 | string serviceKey = request["KEY"].ToString(); | 303 | string serviceKey = request["KEY"].ToString(); |
209 | string sessionStr = request["SESSIONID"].ToString(); | 304 | string sessionStr = request["SESSIONID"].ToString(); |
305 | |||
210 | UUID sessionID; | 306 | UUID sessionID; |
211 | UUID.TryParse(sessionStr, out sessionID); | 307 | if (!UUID.TryParse(sessionStr, out sessionID) || serviceKey == string.Empty) |
308 | return false; | ||
212 | 309 | ||
213 | if (!m_UserAgentService.VerifyAgent(sessionID, serviceKey)) | 310 | if (!m_UserAgentService.VerifyAgent(sessionID, serviceKey)) |
214 | { | 311 | { |
@@ -256,7 +353,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
256 | 353 | ||
257 | doc.AppendChild(rootElement); | 354 | doc.AppendChild(rootElement); |
258 | 355 | ||
259 | XmlElement result = doc.CreateElement("", "Result", ""); | 356 | XmlElement result = doc.CreateElement("", "RESULT", ""); |
260 | result.AppendChild(doc.CreateTextNode("Success")); | 357 | result.AppendChild(doc.CreateTextNode("Success")); |
261 | 358 | ||
262 | rootElement.AppendChild(result); | 359 | rootElement.AppendChild(result); |
@@ -289,7 +386,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
289 | 386 | ||
290 | doc.AppendChild(rootElement); | 387 | doc.AppendChild(rootElement); |
291 | 388 | ||
292 | XmlElement result = doc.CreateElement("", "Result", ""); | 389 | XmlElement result = doc.CreateElement("", "RESULT", ""); |
293 | result.AppendChild(doc.CreateTextNode("Failure")); | 390 | result.AppendChild(doc.CreateTextNode("Failure")); |
294 | 391 | ||
295 | rootElement.AppendChild(result); | 392 | rootElement.AppendChild(result); |
@@ -302,6 +399,28 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
302 | return DocToBytes(doc); | 399 | return DocToBytes(doc); |
303 | } | 400 | } |
304 | 401 | ||
402 | private byte[] BoolResult(bool value) | ||
403 | { | ||
404 | XmlDocument doc = new XmlDocument(); | ||
405 | |||
406 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
407 | "", ""); | ||
408 | |||
409 | doc.AppendChild(xmlnode); | ||
410 | |||
411 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
412 | ""); | ||
413 | |||
414 | doc.AppendChild(rootElement); | ||
415 | |||
416 | XmlElement result = doc.CreateElement("", "RESULT", ""); | ||
417 | result.AppendChild(doc.CreateTextNode(value.ToString())); | ||
418 | |||
419 | rootElement.AppendChild(result); | ||
420 | |||
421 | return DocToBytes(doc); | ||
422 | } | ||
423 | |||
305 | private byte[] DocToBytes(XmlDocument doc) | 424 | private byte[] DocToBytes(XmlDocument doc) |
306 | { | 425 | { |
307 | MemoryStream ms = new MemoryStream(); | 426 | MemoryStream ms = new MemoryStream(); |
@@ -313,6 +432,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
313 | return ms.ToArray(); | 432 | return ms.ToArray(); |
314 | } | 433 | } |
315 | 434 | ||
435 | |||
316 | #endregion | 436 | #endregion |
317 | } | 437 | } |
318 | } | 438 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 1bd3706..db62aaa 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | |||
@@ -52,6 +52,11 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
52 | // MethodBase.GetCurrentMethod().DeclaringType); | 52 | // MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | private IUserAgentService m_HomeUsersService; | 54 | private IUserAgentService m_HomeUsersService; |
55 | public IUserAgentService HomeUsersService | ||
56 | { | ||
57 | get { return m_HomeUsersService; } | ||
58 | } | ||
59 | |||
55 | private string[] m_AuthorizedCallers; | 60 | private string[] m_AuthorizedCallers; |
56 | 61 | ||
57 | private bool m_VerifyCallers = false; | 62 | private bool m_VerifyCallers = false; |
@@ -96,6 +101,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
96 | 101 | ||
97 | server.AddXmlRPCHandler("locate_user", LocateUser, false); | 102 | server.AddXmlRPCHandler("locate_user", LocateUser, false); |
98 | server.AddXmlRPCHandler("get_uui", GetUUI, false); | 103 | server.AddXmlRPCHandler("get_uui", GetUUI, false); |
104 | server.AddXmlRPCHandler("get_uuid", GetUUID, false); | ||
99 | 105 | ||
100 | server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); | 106 | server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); |
101 | } | 107 | } |
@@ -216,6 +222,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
216 | 222 | ||
217 | } | 223 | } |
218 | 224 | ||
225 | [Obsolete] | ||
219 | public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient) | 226 | public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient) |
220 | { | 227 | { |
221 | Hashtable hash = new Hashtable(); | 228 | Hashtable hash = new Hashtable(); |
@@ -410,8 +417,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
410 | } | 417 | } |
411 | 418 | ||
412 | /// <summary> | 419 | /// <summary> |
413 | /// Locates the user. | 420 | /// Returns the UUI of a user given a UUID. |
414 | /// This is a sensitive operation, only authorized IP addresses can perform it. | ||
415 | /// </summary> | 421 | /// </summary> |
416 | /// <param name="request"></param> | 422 | /// <param name="request"></param> |
417 | /// <param name="remoteClient"></param> | 423 | /// <param name="remoteClient"></param> |
@@ -445,5 +451,33 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
445 | 451 | ||
446 | } | 452 | } |
447 | 453 | ||
454 | /// <summary> | ||
455 | /// Gets the UUID of a user given First name, Last name. | ||
456 | /// </summary> | ||
457 | /// <param name="request"></param> | ||
458 | /// <param name="remoteClient"></param> | ||
459 | /// <returns></returns> | ||
460 | public XmlRpcResponse GetUUID(XmlRpcRequest request, IPEndPoint remoteClient) | ||
461 | { | ||
462 | Hashtable hash = new Hashtable(); | ||
463 | |||
464 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
465 | //string host = (string)requestData["host"]; | ||
466 | //string portstr = (string)requestData["port"]; | ||
467 | if (requestData.ContainsKey("first") && requestData.ContainsKey("last")) | ||
468 | { | ||
469 | UUID userID = UUID.Zero; | ||
470 | string first = (string)requestData["first"]; | ||
471 | |||
472 | string last = (string)requestData["last"]; | ||
473 | UUID uuid = m_HomeUsersService.GetUUID(first, last); | ||
474 | hash["UUID"] = uuid.ToString(); | ||
475 | } | ||
476 | |||
477 | XmlRpcResponse response = new XmlRpcResponse(); | ||
478 | response.Value = hash; | ||
479 | return response; | ||
480 | |||
481 | } | ||
448 | } | 482 | } |
449 | } | 483 | } |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 9d6f964..040c840 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
67 | if (inventoryService == String.Empty) | 67 | if (inventoryService == String.Empty) |
68 | throw new Exception("No InventoryService in config file"); | 68 | throw new Exception("No InventoryService in config file"); |
69 | 69 | ||
70 | Object[] args = new Object[] { config }; | 70 | Object[] args = new Object[] { config, m_ConfigName }; |
71 | m_InventoryService = | 71 | m_InventoryService = |
72 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); | 72 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); |
73 | 73 | ||
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 8048f86..f83a239 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -73,6 +73,20 @@ namespace OpenSim.Server.Handlers.Login | |||
73 | 73 | ||
74 | if (requestData != null) | 74 | if (requestData != null) |
75 | { | 75 | { |
76 | // Debug code to show exactly what login parameters the viewer is sending us. | ||
77 | // TODO: Extract into a method that can be generally applied if one doesn't already exist. | ||
78 | // foreach (string key in requestData.Keys) | ||
79 | // { | ||
80 | // object value = requestData[key]; | ||
81 | // Console.WriteLine("{0}:{1}", key, value); | ||
82 | // if (value is ArrayList) | ||
83 | // { | ||
84 | // ICollection col = value as ICollection; | ||
85 | // foreach (object item in col) | ||
86 | // Console.WriteLine(" {0}", item); | ||
87 | // } | ||
88 | // } | ||
89 | |||
76 | if (requestData.ContainsKey("first") && requestData["first"] != null && | 90 | if (requestData.ContainsKey("first") && requestData["first"] != null && |
77 | requestData.ContainsKey("last") && requestData["last"] != null && ( | 91 | requestData.ContainsKey("last") && requestData["last"] != null && ( |
78 | (requestData.ContainsKey("passwd") && requestData["passwd"] != null) || | 92 | (requestData.ContainsKey("passwd") && requestData["passwd"] != null) || |
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 16c93c8..9a7ad34 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs | |||
@@ -94,6 +94,5 @@ namespace OpenSim.Server.Handlers.Login | |||
94 | server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); | 94 | server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); |
95 | server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); | 95 | server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); |
96 | } | 96 | } |
97 | |||
98 | } | 97 | } |
99 | } | 98 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1d1f9ef..5c9be8f 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -272,23 +272,28 @@ namespace OpenSim.Server.Handlers.Simulation | |||
272 | keysvals.Add("headers", headervals); | 272 | keysvals.Add("headers", headervals); |
273 | keysvals.Add("querystringkeys", querystringkeys); | 273 | keysvals.Add("querystringkeys", querystringkeys); |
274 | 274 | ||
275 | Stream inputStream; | 275 | httpResponse.StatusCode = 200; |
276 | httpResponse.ContentType = "text/html"; | ||
277 | httpResponse.KeepAlive = false; | ||
278 | Encoding encoding = Encoding.UTF8; | ||
279 | |||
280 | Stream inputStream = null; | ||
276 | if (httpRequest.ContentType == "application/x-gzip") | 281 | if (httpRequest.ContentType == "application/x-gzip") |
277 | inputStream = new GZipStream(request, CompressionMode.Decompress); | 282 | inputStream = new GZipStream(request, CompressionMode.Decompress); |
278 | else | 283 | else if (httpRequest.ContentType == "application/json") |
279 | inputStream = request; | 284 | inputStream = request; |
285 | else // no go | ||
286 | { | ||
287 | httpResponse.StatusCode = 406; | ||
288 | return encoding.GetBytes("false"); | ||
289 | } | ||
280 | 290 | ||
281 | Encoding encoding = Encoding.UTF8; | ||
282 | StreamReader reader = new StreamReader(inputStream, encoding); | 291 | StreamReader reader = new StreamReader(inputStream, encoding); |
283 | 292 | ||
284 | string requestBody = reader.ReadToEnd(); | 293 | string requestBody = reader.ReadToEnd(); |
285 | reader.Close(); | 294 | reader.Close(); |
286 | keysvals.Add("body", requestBody); | 295 | keysvals.Add("body", requestBody); |
287 | 296 | ||
288 | httpResponse.StatusCode = 200; | ||
289 | httpResponse.ContentType = "text/html"; | ||
290 | httpResponse.KeepAlive = false; | ||
291 | |||
292 | Hashtable responsedata = new Hashtable(); | 297 | Hashtable responsedata = new Hashtable(); |
293 | 298 | ||
294 | UUID agentID; | 299 | UUID agentID; |