aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDr Scofield2008-09-22 11:20:09 +0000
committerDr Scofield2008-09-22 11:20:09 +0000
commit7def786ef4d62c2ffad8cea0cba7db033f8f0d27 (patch)
tree4da62a195714ea1206fd4d3b3688b22c31ce254c
parentRemove the script engine identifier tag, so the compiler just sees (diff)
downloadopensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.zip
opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.gz
opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.bz2
opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.xz
cleanups in inventory REST code. also, disables digest authentications
for inventory REST calls for the time being, as firefox, curl, and also python's urllib2 cannot authenticate using digest auth. fix permission checking for prim inventory to be the same as for normal edit ops.
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs2
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs35
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs3
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs3
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs2
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs30
8 files changed, 66 insertions, 14 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
index 21fcf92..d7935bc 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
@@ -392,7 +392,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
392 392
393 /// Supported Digest algorithms 393 /// Supported Digest algorithms
394 394
395 public const string Digest_MD5 = "MD5"; // assumedd efault if omitted 395 public const string Digest_MD5 = "MD5"; // assumed default if omitted
396 public const string Digest_MD5Sess = "MD5-sess"; 396 public const string Digest_MD5Sess = "MD5-sess";
397 397
398 public const string Qop_Auth = "auth"; 398 public const string Qop_Auth = "auth";
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index 18a0baf..8db3fde 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -45,7 +45,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
45 public class RestAppearanceServices : IRest 45 public class RestAppearanceServices : IRest
46 { 46 {
47 private static readonly int PARM_USERID = 0; 47 private static readonly int PARM_USERID = 0;
48 //private static readonly int PARM_PATH = 1; 48 // private static readonly int PARM_PATH = 1;
49 49
50 private bool enabled = false; 50 private bool enabled = false;
51 private string qPrefix = "appearance"; 51 private string qPrefix = "appearance";
@@ -166,6 +166,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
166 166
167 try 167 try
168 { 168 {
169 // digest scheme seems borked: disable it for the time
170 // being
171 rdata.scheme = Rest.AS_BASIC;
169 if (!rdata.IsAuthenticated) 172 if (!rdata.IsAuthenticated)
170 { 173 {
171 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); 174 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
@@ -335,7 +338,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
335 AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 338 AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
336 rdata.userAppearance = new AvatarAppearance(); 339 rdata.userAppearance = new AvatarAppearance();
337 340
338 rdata.userAppearance.Owner = old.Owner; 341 rdata.userAppearance.Owner = old.Owner;
342 rdata.userAppearance.Serial = old.Serial;
339 343
340 if (GetUserAppearance(rdata)) 344 if (GetUserAppearance(rdata))
341 { 345 {
@@ -343,6 +347,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
343 created = !modified; 347 created = !modified;
344 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 348 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
345 } 349 }
350 else
351 {
352 created = true;
353 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
354 }
346 355
347 if (created) 356 if (created)
348 { 357 {
@@ -383,11 +392,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
383 392
384 rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 393 rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
385 394
386 if (GetUserAppearance(rdata)) 395 // If the user exists then this is considered a modification regardless
396 // of what may, or may not be, specified in the payload.
397
398 if (rdata.userAppearance != null)
387 { 399 {
388 modified = rdata.userAppearance != null; 400 modified = true;
389 created = !modified; 401 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
390 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
391 } 402 }
392 403
393 if (created) 404 if (created)
@@ -465,6 +476,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
465 rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value); 476 rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value);
466 indata = true; 477 indata = true;
467 } 478 }
479 if (xml.MoveToAttribute("Owner"))
480 {
481 rdata.userAppearance.Owner = xml.Value;
482 indata = true;
483 }
484 if (xml.MoveToAttribute("Serial"))
485 {
486 rdata.userAppearance.Serial = Convert.ToInt32(xml.Value);
487 indata = true;
488 }
468 break; 489 break;
469 case "Body" : 490 case "Body" :
470 if (xml.MoveToAttribute("Item")) 491 if (xml.MoveToAttribute("Item"))
@@ -687,6 +708,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
687 708
688 rdata.writer.WriteStartElement("Appearance"); 709 rdata.writer.WriteStartElement("Appearance");
689 rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString()); 710 rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString());
711 rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
712 rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString());
690 713
691 rdata.writer.WriteStartElement("Body"); 714 rdata.writer.WriteStartElement("Body");
692 rdata.writer.WriteAttributeString("Item",rdata.userAppearance.BodyItem.ToString()); 715 rdata.writer.WriteAttributeString("Item",rdata.userAppearance.BodyItem.ToString());
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
index b67922f..7a6d4af 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
@@ -130,6 +130,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
130 130
131 try 131 try
132 { 132 {
133 // digest scheme seems borked: disable it for the time
134 // being
135 rdata.scheme = Rest.AS_BASIC;
133 if (!rdata.IsAuthenticated) 136 if (!rdata.IsAuthenticated)
134 { 137 {
135 rdata.Fail(Rest.HttpStatusCodeNotAuthorized, String.Format("user \"{0}\" could not be authenticated")); 138 rdata.Fail(Rest.HttpStatusCodeNotAuthorized, String.Format("user \"{0}\" could not be authenticated"));
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 0aad058..ab40b5d 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -167,6 +167,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
167 167
168 try 168 try
169 { 169 {
170 // digest scheme seems borked: disable it for the time
171 // being
172 rdata.scheme = Rest.AS_BASIC;
170 if (!rdata.IsAuthenticated) 173 if (!rdata.IsAuthenticated)
171 { 174 {
172 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); 175 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs
index b24b5ed..b7c9027 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs
@@ -235,7 +235,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
235 ci = t.GetConstructor(parms); 235 ci = t.GetConstructor(parms);
236 ht = ci.Invoke(args); 236 ht = ci.Invoke(args);
237 tests.Add((ITest)ht); 237 tests.Add((ITest)ht);
238 Rest.Log.WarnFormat("{0} Test {1} added", MsgId, t); 238 Rest.Log.InfoFormat("{0} Test {1} added", MsgId, t);
239 } 239 }
240 } 240 }
241 catch (Exception e) 241 catch (Exception e)
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
index 54d8478..bd42473 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
@@ -65,7 +65,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
65 public void Initialize() 65 public void Initialize()
66 { 66 {
67 enabled = true; 67 enabled = true;
68 Rest.Log.InfoFormat("{0} Remote services initialize", MsgId); 68 Rest.Log.InfoFormat("{0} Remote services initialized", MsgId);
69 } 69 }
70 70
71 // Called by the plug-in to halt REST processing. Local processing is 71 // Called by the plug-in to halt REST processing. Local processing is
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index bd67f1e..c649493 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -5200,6 +5200,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5200 } 5200 }
5201 break; 5201 break;
5202 case PacketType.UpdateTaskInventory: 5202 case PacketType.UpdateTaskInventory:
5203 m_log.DebugFormat("[AMW] UpdateTaskInventory request");
5203 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 5204 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
5204 if (OnUpdateTaskInventory != null) 5205 if (OnUpdateTaskInventory != null)
5205 { 5206 {
@@ -5266,7 +5267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5266 break; 5267 break;
5267 5268
5268 case PacketType.RezScript: 5269 case PacketType.RezScript:
5269 5270 m_log.DebugFormat("[AMW] RezScript");
5270 //Console.WriteLine(Pack.ToString()); 5271 //Console.WriteLine(Pack.ToString());
5271 RezScriptPacket rezScriptx = (RezScriptPacket)Pack; 5272 RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
5272 5273
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index c670076..a188701 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1186,11 +1186,21 @@ namespace OpenSim.Region.Environment.Scenes
1186 1186
1187 if (part != null) 1187 if (part != null)
1188 { 1188 {
1189 if (part.OwnerID != remoteClient.AgentId)
1190 return;
1191 1189
1192 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 1190 // replacing the following two checks with the
1193 return; 1191 // ExternalChecks.ExternalChecksCanEditObject(...)
1192 // call
1193
1194 // if (part.OwnerID != remoteClient.AgentId)
1195 // return;
1196
1197 // if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1198 // return;
1199
1200 if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
1201 {
1202 return;
1203 }
1194 1204
1195 TaskInventoryItem currentItem = part.GetInventoryItem(itemID); 1205 TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
1196 1206
@@ -1283,11 +1293,23 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T
1283 SceneObjectPart part = GetSceneObjectPart(localID); 1293 SceneObjectPart part = GetSceneObjectPart(localID);
1284 if (part != null) 1294 if (part != null)
1285 { 1295 {
1296
1297 /*
1286 if (part.OwnerID != remoteClient.AgentId) 1298 if (part.OwnerID != remoteClient.AgentId)
1299 {
1287 return; 1300 return;
1301 }
1288 1302
1289 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 1303 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1304 {
1290 return; 1305 return;
1306 }
1307 */
1308
1309 if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
1310 {
1311 return;
1312 }
1291 1313
1292 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); 1314 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
1293 // TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez 1315 // TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez