aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-29 23:50:24 -0400
committerTeravus Ovares (Dan Olivares)2009-08-29 23:50:24 -0400
commit2f40161f38967e3362ac7be43b74d5cbc75564fa (patch)
treedb14920568864a932a064a4530d006fc67c60a5f
parentOk, merging the RegionCombinerModule with master. (diff)
parentRemove another IAuthentificationInterface user (diff)
downloadopensim-SC_OLD-2f40161f38967e3362ac7be43b74d5cbc75564fa.zip
opensim-SC_OLD-2f40161f38967e3362ac7be43b74d5cbc75564fa.tar.gz
opensim-SC_OLD-2f40161f38967e3362ac7be43b74d5cbc75564fa.tar.bz2
opensim-SC_OLD-2f40161f38967e3362ac7be43b74d5cbc75564fa.tar.xz
Merge branch 'master' of ssh://MyConnection/var/git/opensim
-rw-r--r--CONTRIBUTORS.txt18
-rw-r--r--OpenSim/Client/Linden/LLStandaloneLoginService.cs17
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs105
-rw-r--r--OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs41
-rw-r--r--OpenSim/Framework/Capabilities/LLSDInventoryItem.cs1
-rw-r--r--OpenSim/Framework/Communications/Services/LoginService.cs13
-rw-r--r--OpenSim/Framework/InventoryFolderBase.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestSessionService.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs95
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs50
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs24
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
-rw-r--r--OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs13
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs13
-rw-r--r--OpenSim/Services/AuthenticationService/AuthenticationService.cs312
-rw-r--r--OpenSim/Services/Interfaces/IAuthenticationService.cs108
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs12
-rw-r--r--bin/OpenSim.Data.MySQL.Tests.dll.config33
-rw-r--r--bin/OpenSim.Data.NHibernate.Tests.dll.config33
-rw-r--r--bin/OpenSim.Data.SQLite.Tests.dll.config33
-rw-r--r--bin/OpenSim.Data.Tests.dll.config33
-rw-r--r--bin/OpenSim.ini.example7
29 files changed, 465 insertions, 625 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index c48ede5..a369a75 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -13,7 +13,7 @@ people that make the day to day of OpenSim happen.
13* lbsa71 (Tribal Media AB) 13* lbsa71 (Tribal Media AB)
14* Sean Dague / sdague (IBM) 14* Sean Dague / sdague (IBM)
15* Tedd 15* Tedd
16* justincc (Black Dress Technology) 16* justincc
17* Teravus (w3z) 17* Teravus (w3z)
18* Johan Berntsson (3Di) 18* Johan Berntsson (3Di)
19* Ckrinke (Charles Krinke) 19* Ckrinke (Charles Krinke)
@@ -29,6 +29,7 @@ people that make the day to day of OpenSim happen.
29* nlin (3Di) 29* nlin (3Di)
30* Arthur Rodrigo S Valadares (IBM) 30* Arthur Rodrigo S Valadares (IBM)
31 31
32
32= Past Open Sim Developers = 33= Past Open Sim Developers =
33These folks are alumns of the OpenSim core group, but are now 34These folks are alumns of the OpenSim core group, but are now
34currently not active. Their great contributions helped get us to 35currently not active. Their great contributions helped get us to
@@ -44,6 +45,7 @@ where we are today.
44* Darok 45* Darok
45* Alondria 46* Alondria
46 47
48
47= Additional OpenSim Contributors = 49= Additional OpenSim Contributors =
48These folks have contributed code patches to OpenSim to help make it 50These folks have contributed code patches to OpenSim to help make it
49what it is today. 51what it is today.
@@ -90,6 +92,7 @@ what it is today.
90* maimedleech 92* maimedleech
91* Mic Bowman 93* Mic Bowman
92* Michelle Argus 94* Michelle Argus
95* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
93* Mike Osias (IBM) 96* Mike Osias (IBM)
94* Mike Pitman (IBM) 97* Mike Pitman (IBM)
95* mikkopa/_someone - RealXtend 98* mikkopa/_someone - RealXtend
@@ -123,8 +126,7 @@ what it is today.
123* Zha Ewry 126* Zha Ewry
124 127
125 128
126 129= LSL Devs =
127LSL Devs
128 130
129* Alondria 131* Alondria
130* CharlieO 132* CharlieO
@@ -132,7 +134,7 @@ LSL Devs
132* Melanie Thielker 134* Melanie Thielker
133 135
134 136
135Testers 137= Testers =
136 138
137* Ai Austin 139* Ai Austin
138* CharlieO (LSL) 140* CharlieO (LSL)
@@ -140,10 +142,6 @@ Testers
140* openlifegrid.com 142* openlifegrid.com
141 143
142 144
143AssetInventory Server and some plugins are based on Cable Beach
144Cable Beach is Copyright (c) 2008 Intel Corporation
145see http://forge.opensimulator.org/gf/project/assetserver/
146
147This software uses components from the following developers: 145This software uses components from the following developers:
148* Sleepycat Software (Berkeley DB) 146* Sleepycat Software (Berkeley DB)
149* SQLite (Public Domain) 147* SQLite (Public Domain)
@@ -161,6 +159,10 @@ This software uses components from the following developers:
161* log4net (http://logging.apache.org/log4net/) 159* log4net (http://logging.apache.org/log4net/)
162* GlynnTucker.Cache (http://gtcache.sourceforge.net/) 160* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
163 161
162Some plugins are based on Cable Beach
163Cable Beach is Copyright (c) 2008 Intel Corporation
164see http://forge.opensimulator.org/gf/project/assetserver/
165
164In addition, we would like to thank: 166In addition, we would like to thank:
165* The Mono Project 167* The Mono Project
166* The NANT Developers 168* The NANT Developers
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
index 2a13502..122110d 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
@@ -139,15 +139,8 @@ namespace OpenSim.Client.Linden
139 return m_regionsConnector.RequestNeighbourInfo(homeRegionId); 139 return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
140 } 140 }
141 141
142 /// <summary> 142 protected override bool PrepareLoginToRegion(
143 /// Prepare a login to the given region. This involves both telling the region to expect a connection 143 RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
144 /// and appropriately customising the response to the user.
145 /// </summary>
146 /// <param name="sim"></param>
147 /// <param name="user"></param>
148 /// <param name="response"></param>
149 /// <returns>true if the region was successfully contacted, false otherwise</returns>
150 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
151 { 144 {
152 IPEndPoint endPoint = regionInfo.ExternalEndPoint; 145 IPEndPoint endPoint = regionInfo.ExternalEndPoint;
153 response.SimAddress = endPoint.Address.ToString(); 146 response.SimAddress = endPoint.Address.ToString();
@@ -204,7 +197,8 @@ namespace OpenSim.Client.Linden
204 agent.Appearance = m_userManager.GetUserAppearance(user.ID); 197 agent.Appearance = m_userManager.GetUserAppearance(user.ID);
205 if (agent.Appearance == null) 198 if (agent.Appearance == null)
206 { 199 {
207 m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname); 200 m_log.WarnFormat(
201 "[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
208 agent.Appearance = new AvatarAppearance(agent.AgentID); 202 agent.Appearance = new AvatarAppearance(agent.AgentID);
209 } 203 }
210 204
@@ -243,7 +237,8 @@ namespace OpenSim.Client.Linden
243 return; 237 return;
244 } 238 }
245 239
246 m_regionsConnector.LogOffUserFromGrid(SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off"); 240 m_regionsConnector.LogOffUserFromGrid(
241 SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off");
247 } 242 }
248 } 243 }
249} 244}
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index df29c4e..c5560b8 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -57,8 +57,8 @@ namespace OpenSim.Framework.Capabilities
57 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, 57 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
58 bool isScriptRunning, byte[] data); 58 bool isScriptRunning, byte[] data);
59 59
60 public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, 60 public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
61 bool fetchFolders, bool fetchItems, int sortOrder); 61 bool fetchFolders, bool fetchItems, int sortOrder, out int version);
62 62
63 /// <summary> 63 /// <summary>
64 /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that 64 /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Capabilities
89 //private static readonly string m_requestTexture = "0003/"; 89 //private static readonly string m_requestTexture = "0003/";
90 private static readonly string m_notecardUpdatePath = "0004/"; 90 private static readonly string m_notecardUpdatePath = "0004/";
91 private static readonly string m_notecardTaskUpdatePath = "0005/"; 91 private static readonly string m_notecardTaskUpdatePath = "0005/";
92 // private static readonly string m_fetchInventoryPath = "0006/"; 92 private static readonly string m_fetchInventoryPath = "0006/";
93 93
94 // The following entries are in a module, however, they are also here so that we don't re-assign 94 // The following entries are in a module, however, they are also here so that we don't re-assign
95 // the path to another cap by mistake. 95 // the path to another cap by mistake.
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Capabilities
207 // As of RC 1.22.9 of the Linden client this is 207 // As of RC 1.22.9 of the Linden client this is
208 // supported 208 // supported
209 209
210 // m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); 210 m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
211 211
212 // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and 212 // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
213 // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires 213 // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
@@ -449,58 +449,59 @@ namespace OpenSim.Framework.Capabilities
449 contents.owner_id = invFetch.owner_id; 449 contents.owner_id = invFetch.owner_id;
450 contents.folder_id = invFetch.folder_id; 450 contents.folder_id = invFetch.folder_id;
451 451
452 // The version number being sent back was originally 1.
453 // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins
454 // without clearing client cache, objects in the root folder disappear until the cache is cleared,
455 // at which point they reappear.
456 //
457 // Seeing the version to something other than 0 may be the right thing to do, but there is
458 // a greater subtlety of the second life protocol that needs to be understood first.
459 contents.version = 0;
460
461 contents.descendents = 0;
462 reply.folders.Array.Add(contents); 452 reply.folders.Array.Add(contents);
463 List<InventoryItemBase> itemList = null; 453 InventoryCollection inv = new InventoryCollection();
454 inv.Folders = new List<InventoryFolderBase>();
455 inv.Items = new List<InventoryItemBase>();
456 int version = 0;
464 if (CAPSFetchInventoryDescendents != null) 457 if (CAPSFetchInventoryDescendents != null)
465 { 458 {
466 itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); 459 inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
467 } 460 }
468 461
469 if (itemList != null) 462 if (inv.Folders != null)
470 { 463 {
471 foreach (InventoryItemBase invItem in itemList) 464 foreach (InventoryFolderBase invFolder in inv.Folders)
472 { 465 {
473 contents.items.Array.Add(ConvertInventoryItem(invItem)); 466 contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
474 } 467 }
475 } 468 }
476 /* The following block is removed as it ALWAYS sends the error to the client because the RC 1.22.9 client tries to
477 find items that have become dissasociated with a paret folder and have parent of 00000000-0000-00000....
478 else
479 {
480 IClientAPI client = GetClient(m_agentID);
481 469
482 // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. 470 if (inv.Items != null)
483 // If we don't send back the response, 471 {
484 // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) 472 foreach (InventoryItemBase invItem in inv.Items)
485 if (client != null)
486 {
487 client.SendAgentAlertMessage(
488 "AGIN0001E: The inventory service has either failed or is not responding. Your inventory will not function properly for the rest of this session. Please clear your cache and relog.",
489 true);
490 }
491 else
492 { 473 {
493 m_log.ErrorFormat( 474 contents.items.Array.Add(ConvertInventoryItem(invItem));
494 "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure",
495 m_agentID);
496 } 475 }
497 }*/ 476 }
477
478 contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
479 contents.version = version;
498 480
499 contents.descendents = contents.items.Array.Count;
500 return reply; 481 return reply;
501 } 482 }
502 483
503 /// <summary> 484 /// <summary>
485 /// Convert an internal inventory folder object into an LLSD object.
486 /// </summary>
487 /// <param name="invFolder"></param>
488 /// <returns></returns>
489 private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder)
490 {
491 LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder();
492 llsdFolder.folder_id = invFolder.ID;
493 llsdFolder.parent_id = invFolder.ParentID;
494 llsdFolder.name = invFolder.Name;
495 if (invFolder.Type == -1)
496 llsdFolder.type = "-1";
497 else
498 llsdFolder.type = TaskInventoryItem.Types[invFolder.Type];
499 llsdFolder.preferred_type = "-1";
500
501 return llsdFolder;
502 }
503
504 /// <summary>
504 /// Convert an internal inventory item object into an LLSD object. 505 /// Convert an internal inventory item object into an LLSD object.
505 /// </summary> 506 /// </summary>
506 /// <param name="invItem"></param> 507 /// <param name="invItem"></param>
@@ -529,15 +530,29 @@ namespace OpenSim.Framework.Capabilities
529 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; 530 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
530 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; 531 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
531 llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; 532 llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
532 llsdItem.permissions.group_id = UUID.Zero; 533 llsdItem.permissions.group_id = invItem.GroupID;
533 llsdItem.permissions.group_mask = 0; 534 llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
534 llsdItem.permissions.is_owner_group = false; 535 llsdItem.permissions.is_owner_group = invItem.GroupOwned;
535 llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; 536 llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
536 llsdItem.permissions.owner_id = m_agentID; // FixMe 537 llsdItem.permissions.owner_id = m_agentID;
537 llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; 538 llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
538 llsdItem.sale_info = new LLSDSaleInfo(); 539 llsdItem.sale_info = new LLSDSaleInfo();
539 llsdItem.sale_info.sale_price = 10; 540 llsdItem.sale_info.sale_price = invItem.SalePrice;
540 llsdItem.sale_info.sale_type = "not"; 541 switch (invItem.SaleType)
542 {
543 default:
544 llsdItem.sale_info.sale_type = "not";
545 break;
546 case 1:
547 llsdItem.sale_info.sale_type = "original";
548 break;
549 case 2:
550 llsdItem.sale_info.sale_type = "copy";
551 break;
552 case 3:
553 llsdItem.sale_info.sale_type = "contents";
554 break;
555 }
541 556
542 return llsdItem; 557 return llsdItem;
543 } 558 }
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs
new file mode 100644
index 0000000..3c216e9
--- /dev/null
+++ b/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDInventoryFolder
34 {
35 public UUID folder_id;
36 public UUID parent_id;
37 public string name;
38 public string type;
39 public string preferred_type;
40 }
41}
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs
index d0498f6..cce18d7 100644
--- a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs
+++ b/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs
@@ -90,6 +90,7 @@ namespace OpenSim.Framework.Capabilities
90 public UUID agent_id; 90 public UUID agent_id;
91 public int descendents; 91 public int descendents;
92 public UUID folder_id; 92 public UUID folder_id;
93 public OSDArray categories = new OSDArray();
93 public OSDArray items = new OSDArray(); 94 public OSDArray items = new OSDArray();
94 public UUID owner_id; 95 public UUID owner_id;
95 public int version; 96 public int version;
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs
index cac6616..bf59f8e 100644
--- a/OpenSim/Framework/Communications/Services/LoginService.cs
+++ b/OpenSim/Framework/Communications/Services/LoginService.cs
@@ -1063,7 +1063,18 @@ namespace OpenSim.Framework.Communications.Services
1063 protected abstract RegionInfo RequestClosestRegion(string region); 1063 protected abstract RegionInfo RequestClosestRegion(string region);
1064 protected abstract RegionInfo GetRegionInfo(ulong homeRegionHandle); 1064 protected abstract RegionInfo GetRegionInfo(ulong homeRegionHandle);
1065 protected abstract RegionInfo GetRegionInfo(UUID homeRegionId); 1065 protected abstract RegionInfo GetRegionInfo(UUID homeRegionId);
1066 protected abstract bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client); 1066
1067 /// <summary>
1068 /// Prepare a login to the given region. This involves both telling the region to expect a connection
1069 /// and appropriately customising the response to the user.
1070 /// </summary>
1071 /// <param name="sim"></param>
1072 /// <param name="user"></param>
1073 /// <param name="response"></param>
1074 /// <param name="remoteClient"></param>
1075 /// <returns>true if the region was successfully contacted, false otherwise</returns>
1076 protected abstract bool PrepareLoginToRegion(
1077 RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client);
1067 1078
1068 /// <summary> 1079 /// <summary>
1069 /// Add active gestures of the user to the login response. 1080 /// Add active gestures of the user to the login response.
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index 1869d48..0edb2c6 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -30,7 +30,7 @@ using OpenMetaverse;
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// A Class for folders which contain users inventory 33 /// User inventory folder
34 /// </summary> 34 /// </summary>
35 public class InventoryFolderBase : InventoryNodeBase 35 public class InventoryFolderBase : InventoryNodeBase
36 { 36 {
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
index 2ef4a36..3f72c31 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
@@ -94,6 +94,7 @@ namespace OpenSim.Framework.Servers.HttpServer
94 94
95 Stream requestStream = request.GetRequestStream(); 95 Stream requestStream = request.GetRequestStream();
96 requestStream.Write(buffer.ToArray(), 0, length); 96 requestStream.Write(buffer.ToArray(), 0, length);
97 requestStream.Close();
97 TResponse deserial = default(TResponse); 98 TResponse deserial = default(TResponse);
98 using (WebResponse resp = request.GetResponse()) 99 using (WebResponse resp = request.GetResponse())
99 { 100 {
@@ -101,7 +102,6 @@ namespace OpenSim.Framework.Servers.HttpServer
101 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 102 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
102 resp.Close(); 103 resp.Close();
103 } 104 }
104 requestStream.Close();
105 return deserial; 105 return deserial;
106 } 106 }
107 } 107 }
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 0d3cc23..937f76b 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Threading;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -38,9 +39,12 @@ using OpenMetaverse.Imaging;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces;
41 43
42namespace OpenSim.Region.CoreModules.Agent.TextureSender 44namespace OpenSim.Region.CoreModules.Agent.TextureSender
43{ 45{
46 public delegate void J2KDecodeDelegate(UUID AssetId);
47
44 public class J2KDecoderModule : IRegionModule, IJ2KDecoder 48 public class J2KDecoderModule : IRegionModule, IJ2KDecoder
45 { 49 {
46 #region IRegionModule Members 50 #region IRegionModule Members
@@ -53,8 +57,12 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
53 /// </summary> 57 /// </summary>
54 private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>(); 58 private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>();
55 private bool OpenJpegFail = false; 59 private bool OpenJpegFail = false;
56 private readonly string CacheFolder = Util.dataDir() + "/j2kDecodeCache"; 60 private string CacheFolder = Util.dataDir() + "/j2kDecodeCache";
57 private readonly J2KDecodeFileCache fCache; 61 private int CacheTimeout = 720;
62 private J2KDecodeFileCache fCache = null;
63 private Thread CleanerThread = null;
64 private IAssetService AssetService = null;
65 private Scene m_Scene = null;
58 66
59 /// <summary> 67 /// <summary>
60 /// List of client methods to notify of results of decode 68 /// List of client methods to notify of results of decode
@@ -63,17 +71,37 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
63 71
64 public J2KDecoderModule() 72 public J2KDecoderModule()
65 { 73 {
66 fCache = new J2KDecodeFileCache(CacheFolder);
67 } 74 }
68 75
69 public void Initialise(Scene scene, IConfigSource source) 76 public void Initialise(Scene scene, IConfigSource source)
70 { 77 {
78 if (m_Scene == null)
79 m_Scene = scene;
80
81 IConfig j2kConfig = source.Configs["J2KDecoder"];
82 if (j2kConfig != null)
83 {
84 CacheFolder = j2kConfig.GetString("CacheDir", CacheFolder);
85 CacheTimeout = j2kConfig.GetInt("CacheTimeout", CacheTimeout);
86 }
87
88 if (fCache == null)
89 fCache = new J2KDecodeFileCache(CacheFolder, CacheTimeout);
90
71 scene.RegisterModuleInterface<IJ2KDecoder>(this); 91 scene.RegisterModuleInterface<IJ2KDecoder>(this);
92
93 if (CleanerThread == null && CacheTimeout != 0)
94 {
95 CleanerThread = new Thread(CleanCache);
96 CleanerThread.Name = "J2KCleanerThread";
97 CleanerThread.IsBackground = true;
98 CleanerThread.Start();
99 }
72 } 100 }
73 101
74 public void PostInitialise() 102 public void PostInitialise()
75 { 103 {
76 104 AssetService = m_Scene.AssetService;
77 } 105 }
78 106
79 public void Close() 107 public void Close()
@@ -329,8 +357,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
329 // Cache Decoded layers 357 // Cache Decoded layers
330 lock (m_cacheddecode) 358 lock (m_cacheddecode)
331 { 359 {
332 if (!m_cacheddecode.ContainsKey(AssetId)) 360 if (m_cacheddecode.ContainsKey(AssetId))
333 m_cacheddecode.Add(AssetId, layers); 361 m_cacheddecode.Remove(AssetId);
362 m_cacheddecode.Add(AssetId, layers);
334 363
335 } 364 }
336 365
@@ -348,11 +377,34 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
348 } 377 }
349 } 378 }
350 } 379 }
380
381 private void CleanCache()
382 {
383 m_log.Info("[J2KDecoderModule]: Cleaner thread started");
384
385 while (true)
386 {
387 if (AssetService != null)
388 fCache.ScanCacheFiles(RedecodeTexture);
389
390 System.Threading.Thread.Sleep(600000);
391 }
392 }
393
394 private void RedecodeTexture(UUID assetID)
395 {
396 AssetBase texture = AssetService.Get(assetID.ToString());
397 if (texture == null)
398 return;
399
400 doJ2kDecode(assetID, texture.Data);
401 }
351 } 402 }
352 403
353 public class J2KDecodeFileCache 404 public class J2KDecodeFileCache
354 { 405 {
355 private readonly string m_cacheDecodeFolder; 406 private readonly string m_cacheDecodeFolder;
407 private readonly int m_cacheTimeout;
356 private bool enabled = true; 408 private bool enabled = true;
357 409
358 private static readonly ILog m_log 410 private static readonly ILog m_log
@@ -362,9 +414,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
362 /// Creates a new instance of a file cache 414 /// Creates a new instance of a file cache
363 /// </summary> 415 /// </summary>
364 /// <param name="pFolder">base folder for the cache. Will be created if it doesn't exist</param> 416 /// <param name="pFolder">base folder for the cache. Will be created if it doesn't exist</param>
365 public J2KDecodeFileCache(string pFolder) 417 public J2KDecodeFileCache(string pFolder, int timeout)
366 { 418 {
367 m_cacheDecodeFolder = pFolder; 419 m_cacheDecodeFolder = pFolder;
420 m_cacheTimeout = timeout;
368 if (!Directory.Exists(pFolder)) 421 if (!Directory.Exists(pFolder))
369 { 422 {
370 Createj2KCacheFolder(pFolder); 423 Createj2KCacheFolder(pFolder);
@@ -555,6 +608,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
555 return String.Format("j2kCache_{0}.cache", AssetId); 608 return String.Format("j2kCache_{0}.cache", AssetId);
556 } 609 }
557 610
611 public UUID AssetIdFromFileName(string fileName)
612 {
613 string rawId = fileName.Replace("j2kCache_", "").Replace(".cache", "");
614 UUID asset;
615 if (!UUID.TryParse(rawId, out asset))
616 return UUID.Zero;
617
618 return asset;
619 }
620
558 /// <summary> 621 /// <summary>
559 /// Creates the Cache Folder 622 /// Creates the Cache Folder
560 /// </summary> 623 /// </summary>
@@ -619,5 +682,23 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
619 enabled = false; 682 enabled = false;
620 } 683 }
621 } 684 }
685
686 public void ScanCacheFiles(J2KDecodeDelegate decode)
687 {
688 DirectoryInfo dir = new DirectoryInfo(m_cacheDecodeFolder);
689 FileInfo[] files = dir.GetFiles("j2kCache_*.cache");
690
691 foreach (FileInfo f in files)
692 {
693 TimeSpan fileAge = DateTime.Now - f.CreationTime;
694
695 if (m_cacheTimeout != 0 && fileAge >= TimeSpan.FromMinutes(m_cacheTimeout))
696 {
697 File.Delete(f.Name);
698 decode(AssetIdFromFileName(f.Name));
699 System.Threading.Thread.Sleep(5000);
700 }
701 }
702 }
622 } 703 }
623} 704}
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index c91b63e..53b8ebc 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -1,29 +1,29 @@
1/* 1/*
2Copyright (c) Contributors, http://osflotsam.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * Neither the name of the Flotsam Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 15 *
16THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 26 */
27 27
28// Uncomment to make asset Get requests for existing 28// Uncomment to make asset Get requests for existing
29// #define WAIT_ON_INPROGRESS_REQUESTS 29// #define WAIT_ON_INPROGRESS_REQUESTS
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d51ed40..1696d82 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
45using OpenSim.Region.CoreModules.World.Serialiser; 45using OpenSim.Region.CoreModules.World.Serialiser;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Framework.Scenes.Serialization; 47using OpenSim.Region.Framework.Scenes.Serialization;
48using OpenSim.Services.Interfaces;
48using OpenSim.Tests.Common; 49using OpenSim.Tests.Common;
49using OpenSim.Tests.Common.Mock; 50using OpenSim.Tests.Common.Mock;
50using OpenSim.Tests.Common.Setup; 51using OpenSim.Tests.Common.Setup;
@@ -102,18 +103,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
102 Monitor.Wait(this, 60000); 103 Monitor.Wait(this, 60000);
103 } 104 }
104 105
105 /* 106 Console.WriteLine("here");
106 cm.UserAdminService.AddUser(userFirstName, userLastName, string.Empty, string.Empty, 1000, 1000, userId);
107 CachedUserInfo userInfo = cm.UserProfileCacheService.GetUserDetails(userId, InventoryReceived);
108 userInfo.FetchInventory();
109 for (int i = 0 ; i < 50 ; i++)
110 {
111 if (userInfo.HasReceivedInventory == true)
112 break;
113 Thread.Sleep(200);
114 }
115 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
116 */
117 107
118 // Create asset 108 // Create asset
119 SceneObjectGroup object1; 109 SceneObjectGroup object1;
@@ -148,7 +138,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
148 item1.AssetID = asset1.FullID; 138 item1.AssetID = asset1.FullID;
149 item1.ID = item1Id; 139 item1.ID = item1Id;
150 //userInfo.RootFolder.FindFolderByPath("Objects").ID; 140 //userInfo.RootFolder.FindFolderByPath("Objects").ID;
151 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); 141 //InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
142 Console.WriteLine("here2");
143 IInventoryService inventoryService = scene.InventoryService;
144 InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
145 InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID);
146 InventoryFolderBase objsFolder = null;
147 foreach (InventoryFolderBase folder in rootContents.Folders)
148 if (folder.Name == "Objects")
149 objsFolder = folder;
152 item1.Folder = objsFolder.ID; 150 item1.Folder = objsFolder.ID;
153 scene.AddInventoryItem(userId, item1); 151 scene.AddInventoryItem(userId, item1);
154 152
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index e577fbe..e83b1a8 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -484,6 +484,12 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
484 GetParams(partsDelimiter, ref nextLine, 11, ref points); 484 GetParams(partsDelimiter, ref nextLine, 11, ref points);
485 graph.FillPolygon(myBrush, points); 485 graph.FillPolygon(myBrush, points);
486 } 486 }
487 else if (nextLine.StartsWith("Polygon"))
488 {
489 PointF[] points = null;
490 GetParams(partsDelimiter, ref nextLine, 7, ref points);
491 graph.DrawPolygon(drawPen, points);
492 }
487 else if (nextLine.StartsWith("Ellipse")) 493 else if (nextLine.StartsWith("Ellipse"))
488 { 494 {
489 float x = 0; 495 float x = 0;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index c8f04a5..3c3534f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -88,13 +88,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
88 } 88 }
89 89
90 // If not, go get them and place them in the cache 90 // If not, go get them and place them in the cache
91 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); 91 Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID);
92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", 92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); 93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
94
95 if (folders.Count > 0)
96 lock (m_InventoryCache)
97 m_InventoryCache.Add(presence.UUID, folders);
98 } 94 }
99 95
100 void OnClientClosed(UUID clientID, Scene scene) 96 void OnClientClosed(UUID clientID, Scene scene)
@@ -113,26 +109,64 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
113 } 109 }
114 } 110 }
115 111
116 // Drop system folders 112 m_log.DebugFormat(
113 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
114 scene.RegionInfo.RegionName, clientID);
115 DropCachedSystemFolders(clientID);
116 }
117 }
118
119 /// <summary>
120 /// Cache a user's 'system' folders.
121 /// </summary>
122 /// <param name="userID"></param>
123 /// <returns>Folders cached</returns>
124 protected Dictionary<AssetType, InventoryFolderBase> CacheSystemFolders(UUID userID)
125 {
126 // If not, go get them and place them in the cache
127 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(userID);
128
129 if (folders.Count > 0)
117 lock (m_InventoryCache) 130 lock (m_InventoryCache)
118 if (m_InventoryCache.ContainsKey(clientID)) 131 m_InventoryCache.Add(userID, folders);
119 {
120 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
121 scene.RegionInfo.RegionName, clientID);
122 132
123 m_InventoryCache.Remove(clientID); 133 return folders;
124 }
125 }
126 } 134 }
127 135
136 /// <summary>
137 /// Drop a user's cached 'system' folders
138 /// </summary>
139 /// <param name="userID"></param>
140 protected void DropCachedSystemFolders(UUID userID)
141 {
142 // Drop system folders
143 lock (m_InventoryCache)
144 if (m_InventoryCache.ContainsKey(userID))
145 m_InventoryCache.Remove(userID);
146 }
128 147
148 /// <summary>
149 /// Get the system folder for a particular asset type
150 /// </summary>
151 /// <param name="userID"></param>
152 /// <param name="type"></param>
153 /// <returns></returns>
129 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 154 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
130 { 155 {
131 Dictionary<AssetType, InventoryFolderBase> folders = null; 156 Dictionary<AssetType, InventoryFolderBase> folders = null;
157
132 lock (m_InventoryCache) 158 lock (m_InventoryCache)
133 { 159 {
134 m_InventoryCache.TryGetValue(userID, out folders); 160 m_InventoryCache.TryGetValue(userID, out folders);
161
162 // In some situations (such as non-secured standalones), system folders can be requested without
163 // the user being logged in. So we need to try caching them here if we don't already have them.
164 if (null == folders)
165 CacheSystemFolders(userID);
166
167 m_InventoryCache.TryGetValue(userID, out folders);
135 } 168 }
169
136 if ((folders != null) && folders.ContainsKey(type)) 170 if ((folders != null) && folders.ContainsKey(type))
137 { 171 {
138 return folders[type]; 172 return folders[type];
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 3301536..650fc7e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -535,7 +535,9 @@ namespace OpenSim.Region.Framework.Scenes
535 } 535 }
536 536
537 UUID newFolderId = UUID.Random(); 537 UUID newFolderId = UUID.Random();
538 InventoryFolderBase newFolder = new InventoryFolderBase(newFolderId, folder.Name, recipientId, folder.Type, recipientParentFolderId, folder.Version); 538 InventoryFolderBase newFolder
539 = new InventoryFolderBase(
540 newFolderId, folder.Name, recipientId, folder.Type, recipientParentFolderId, folder.Version);
539 InventoryService.AddFolder(newFolder); 541 InventoryService.AddFolder(newFolder);
540 542
541 // Give all the subfolders 543 // Give all the subfolders
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index d3e414f..55b100b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -472,8 +472,8 @@ namespace OpenSim.Region.Framework.Scenes
472 /// <param name="fetchItems"></param> 472 /// <param name="fetchItems"></param>
473 /// <param name="sortOrder"></param> 473 /// <param name="sortOrder"></param>
474 /// <returns>null if the inventory look up failed</returns> 474 /// <returns>null if the inventory look up failed</returns>
475 public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, 475 public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
476 bool fetchFolders, bool fetchItems, int sortOrder) 476 bool fetchFolders, bool fetchItems, int sortOrder, out int version)
477 { 477 {
478// m_log.DebugFormat( 478// m_log.DebugFormat(
479// "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", 479// "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
@@ -487,11 +487,31 @@ namespace OpenSim.Region.Framework.Scenes
487 InventoryFolderImpl fold; 487 InventoryFolderImpl fold;
488 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) 488 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null)
489 { 489 {
490 return fold.RequestListOfItems(); 490 version = 0;
491 InventoryCollection ret = new InventoryCollection();
492 ret.Folders = new List<InventoryFolderBase>();
493 ret.Items = fold.RequestListOfItems();
494
495 return ret;
491 } 496 }
492 497
493 InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); 498 InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID);
494 return contents.Items; 499
500 if (folderID != UUID.Zero)
501 {
502 InventoryFolderBase containingFolder = new InventoryFolderBase();
503 containingFolder.ID = folderID;
504 containingFolder.Owner = agentID;
505 containingFolder = InventoryService.GetFolder(containingFolder);
506 version = containingFolder.Version;
507 }
508 else
509 {
510 // Lost itemsm don't really need a version
511 version = 1;
512 }
513
514 return contents;
495 515
496 } 516 }
497 517
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b1c357c..0de5c9b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -852,6 +852,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
852 return drawList; 852 return drawList;
853 } 853 }
854 854
855 public string osDrawPolygon(string drawList, LSL_List x, LSL_List y)
856 {
857 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon");
858
859 m_host.AddScriptLPS(1);
860
861 if (x.Length != y.Length || x.Length < 3)
862 {
863 return "";
864 }
865 drawList += "Polygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
866 for (int i = 1; i < x.Length; i++)
867 {
868 drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
869 }
870 drawList += "; ";
871 return drawList;
872 }
873
855 public string osSetFontSize(string drawList, int fontSize) 874 public string osSetFontSize(string drawList, int fontSize)
856 { 875 {
857 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 876 CheckThreatLevel(ThreatLevel.None, "osSetFontSize");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 2365bee..b129b39 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -97,6 +97,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
97 string osDrawEllipse(string drawList, int width, int height); 97 string osDrawEllipse(string drawList, int width, int height);
98 string osDrawRectangle(string drawList, int width, int height); 98 string osDrawRectangle(string drawList, int width, int height);
99 string osDrawFilledRectangle(string drawList, int width, int height); 99 string osDrawFilledRectangle(string drawList, int width, int height);
100 string osDrawPolygon(string drawList, LSL_List x, LSL_List y);
100 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y); 101 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y);
101 string osSetFontSize(string drawList, int fontSize); 102 string osSetFontSize(string drawList, int fontSize);
102 string osSetPenSize(string drawList, int penSize); 103 string osSetPenSize(string drawList, int penSize);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index f877acb..45492dd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -267,6 +267,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height); 267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height);
268 } 268 }
269 269
270 public string osDrawPolygon(string drawList, LSL_List x, LSL_List y)
271 {
272 return m_OSSL_Functions.osDrawPolygon(drawList, x, y);
273 }
274
270 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y) 275 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
271 { 276 {
272 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y); 277 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y);
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index 3de2245..c0933a8 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -110,12 +110,13 @@ namespace OpenSim.Server.Handlers.Neighbour
110 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; 110 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
111 return result; 111 return result;
112 } 112 }
113 if (!m_AuthenticationService.VerifyKey(regionID, authToken)) 113 // TODO: Rethink this
114 { 114 //if (!m_AuthenticationService.VerifyKey(regionID, authToken))
115 m_log.InfoFormat("[RegionPostHandler]: Authentication failed for neighbour message {0}", path); 115 //{
116 httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; 116 // m_log.InfoFormat("[RegionPostHandler]: Authentication failed for neighbour message {0}", path);
117 return result; 117 // httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
118 } 118 // return result;
119 //}
119 m_log.DebugFormat("[RegionPostHandler]: Authentication succeeded for {0}", regionID); 120 m_log.DebugFormat("[RegionPostHandler]: Authentication succeeded for {0}", regionID);
120 } 121 }
121 122
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 6c0b705..822edcb 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -109,12 +109,13 @@ namespace OpenSim.Server.Handlers.Simulation
109 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; 109 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
110 return result; 110 return result;
111 } 111 }
112 if (!m_AuthenticationService.VerifyKey(agentID, authToken)) 112 // TODO: Rethink this
113 { 113 //if (!m_AuthenticationService.VerifyKey(agentID, authToken))
114 m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path); 114 //{
115 httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; 115 // m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path);
116 return result; 116 // httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
117 } 117 // return result;
118 //}
118 m_log.DebugFormat("[AgentPostHandler]: Authentication succeeded for {0}", agentID); 119 m_log.DebugFormat("[AgentPostHandler]: Authentication succeeded for {0}", agentID);
119 } 120 }
120 121
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationService.cs b/OpenSim/Services/AuthenticationService/AuthenticationService.cs
deleted file mode 100644
index b81a004..0000000
--- a/OpenSim/Services/AuthenticationService/AuthenticationService.cs
+++ /dev/null
@@ -1,312 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using log4net;
33using OpenSim.Framework;
34using OpenSim.Data;
35using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces;
37using OpenMetaverse;
38
39namespace OpenSim.Services.AuthenticationService
40{
41 /// <summary>
42 /// Simple authentication service implementation dealing only with users.
43 /// It uses the user DB directly to access user information.
44 /// It takes two config vars:
45 /// - Authenticate = {true|false} : to do or not to do authentication
46 /// - Authority = string like "osgrid.org" : this identity authority
47 /// that will be called back for identity verification
48 /// </summary>
49 public class HGAuthenticationService : ServiceBase, IAuthenticationService
50 {
51 private static readonly ILog m_log
52 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 protected IUserDataPlugin m_Database;
55 protected string m_AuthorityURL;
56 protected bool m_PerformAuthentication;
57 protected Dictionary<UUID, List<string>> m_UserKeys = new Dictionary<UUID, List<string>>();
58
59
60 public HGAuthenticationService(IConfigSource config) : base(config)
61 {
62 string dllName = String.Empty;
63 string connString = String.Empty;
64
65 //
66 // Try reading the [DatabaseService] section first, if it exists
67 //
68 IConfig dbConfig = config.Configs["DatabaseService"];
69 if (dbConfig != null)
70 {
71 dllName = dbConfig.GetString("StorageProvider", String.Empty);
72 connString = dbConfig.GetString("ConnectionString", String.Empty);
73 }
74
75 //
76 // Try reading the more specific [InventoryService] section, if it exists
77 //
78 IConfig authConfig = config.Configs["AuthenticationService"];
79 if (authConfig != null)
80 {
81 dllName = authConfig.GetString("StorageProvider", dllName);
82 connString = authConfig.GetString("ConnectionString", connString);
83
84 m_PerformAuthentication = authConfig.GetBoolean("Authenticate", true);
85 m_AuthorityURL = "http://" + authConfig.GetString("Authority", "localhost");
86 if (!m_AuthorityURL.EndsWith("/"))
87 m_AuthorityURL += "/";
88 }
89
90 //
91 // We tried, but this doesn't exist. We can't proceed.
92 //
93 if (dllName.Equals(String.Empty))
94 throw new Exception("No InventoryService configuration");
95
96 m_Database = LoadPlugin<IUserDataPlugin>(dllName);
97 if (m_Database == null)
98 throw new Exception("Could not find a storage interface in the given module");
99
100 m_Database.Initialise(connString);
101 }
102
103 public UUID AuthenticateKey(UUID principalID, string key)
104 {
105 bool writeAgentData = false;
106
107 UserAgentData agent = m_Database.GetAgentByUUID(principalID);
108 if (agent == null)
109 {
110 agent = new UserAgentData();
111 agent.ProfileID = principalID;
112 agent.SessionID = UUID.Random();
113 agent.SecureSessionID = UUID.Random();
114 agent.AgentIP = "127.0.0.1";
115 agent.AgentPort = 0;
116 agent.AgentOnline = false;
117
118 writeAgentData = true;
119 }
120
121 if (!m_PerformAuthentication)
122 {
123 if (writeAgentData)
124 m_Database.AddNewUserAgent(agent);
125 return agent.SessionID;
126 }
127
128 if (!VerifyKey(principalID, key))
129 return UUID.Zero;
130
131 if (writeAgentData)
132 m_Database.AddNewUserAgent(agent);
133
134 return agent.SessionID;
135 }
136
137 /// <summary>
138 /// This implementation only authenticates users.
139 /// </summary>
140 /// <param name="principalID"></param>
141 /// <param name="password"></param>
142 /// <returns></returns>
143 public UUID AuthenticatePassword(UUID principalID, string password)
144 {
145 bool writeAgentData = false;
146
147 UserAgentData agent = m_Database.GetAgentByUUID(principalID);
148 if (agent == null)
149 {
150 agent = new UserAgentData();
151 agent.ProfileID = principalID;
152 agent.SessionID = UUID.Random();
153 agent.SecureSessionID = UUID.Random();
154 agent.AgentIP = "127.0.0.1";
155 agent.AgentPort = 0;
156 agent.AgentOnline = false;
157
158 writeAgentData = true;
159 }
160
161 if (!m_PerformAuthentication)
162 {
163 if (writeAgentData)
164 m_Database.AddNewUserAgent(agent);
165 return agent.SessionID;
166 }
167
168 UserProfileData profile = m_Database.GetUserByUUID(principalID);
169 bool passwordSuccess = false;
170 m_log.InfoFormat("[AUTH]: Authenticating {0} {1} ({2})", profile.FirstName, profile.SurName, profile.ID);
171
172 // we do this to get our hash in a form that the server password code can consume
173 // when the web-login-form submits the password in the clear (supposed to be over SSL!)
174 if (!password.StartsWith("$1$"))
175 password = "$1$" + Util.Md5Hash(password);
176
177 password = password.Remove(0, 3); //remove $1$
178
179 string s = Util.Md5Hash(password + ":" + profile.PasswordSalt);
180 // Testing...
181 //m_log.Info("[LOGIN]: SubHash:" + s + " userprofile:" + profile.passwordHash);
182 //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password);
183
184 passwordSuccess = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
185 || profile.PasswordHash.Equals(password, StringComparison.InvariantCulture));
186
187 if (!passwordSuccess)
188 return UUID.Zero;
189
190 if (writeAgentData)
191 m_Database.AddNewUserAgent(agent);
192
193 return agent.SessionID;
194 }
195
196 /// <summary>
197 /// This generates authorization keys in the form
198 /// http://authority/uuid
199 /// after verifying that the caller is, indeed, authorized to request a key
200 /// </summary>
201 /// <param name="userID">The principal ID requesting the new key</param>
202 /// <param name="authToken">The original authorization token for that principal, obtained during login</param>
203 /// <returns></returns>
204 public string GetKey(UUID principalID, string authToken)
205 {
206 UserProfileData profile = m_Database.GetUserByUUID(principalID);
207 string newKey = string.Empty;
208
209 if (profile != null)
210 {
211 m_log.DebugFormat("[AUTH]: stored auth token is {0}. Given token is {1}", profile.WebLoginKey.ToString(), authToken);
212 // I'm overloading webloginkey for this, so that no changes are needed in the DB
213 // The uses of webloginkey are fairly mutually exclusive
214 if (profile.WebLoginKey.ToString().Equals(authToken))
215 {
216 newKey = UUID.Random().ToString();
217 List<string> keys;
218 lock (m_UserKeys)
219 {
220 if (m_UserKeys.ContainsKey(principalID))
221 {
222 keys = m_UserKeys[principalID];
223 }
224 else
225 {
226 keys = new List<string>();
227 m_UserKeys.Add(principalID, keys);
228 }
229 keys.Add(newKey);
230 }
231 m_log.InfoFormat("[AUTH]: Successfully generated new auth key for {0}", principalID);
232 }
233 else
234 m_log.Warn("[AUTH]: Unauthorized key generation request. Denying new key.");
235 }
236 else
237 m_log.Warn("[AUTH]: Principal not found.");
238
239 return m_AuthorityURL + newKey;
240 }
241
242 /// <summary>
243 /// This verifies the uuid portion of the key given out by GenerateKey
244 /// </summary>
245 /// <param name="userID"></param>
246 /// <param name="key"></param>
247 /// <returns></returns>
248 public bool VerifyKey(UUID userID, string key)
249 {
250 lock (m_UserKeys)
251 {
252 if (m_UserKeys.ContainsKey(userID))
253 {
254 List<string> keys = m_UserKeys[userID];
255 if (keys.Contains(key))
256 {
257 // Keys are one-time only, so remove it
258 keys.Remove(key);
259 return true;
260 }
261 return false;
262 }
263 else
264 return false;
265 }
266 }
267
268 public UUID CreateUserSession(UUID userID, UUID oldSessionID)
269 {
270 UserAgentData agent = m_Database.GetAgentByUUID(userID);
271
272 if (agent == null)
273 return UUID.Zero;
274
275 agent.SessionID = UUID.Random();
276
277 m_Database.AddNewUserAgent(agent);
278 return agent.SessionID;
279 }
280
281 public bool VerifyUserSession(UUID userID, UUID sessionID)
282 {
283 UserProfileData userProfile = m_Database.GetUserByUUID(userID);
284
285 if (userProfile != null && userProfile.CurrentAgent != null)
286 {
287 m_log.DebugFormat("[AUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID);
288 if (userProfile.CurrentAgent.SessionID == sessionID)
289 {
290 return true;
291 }
292 }
293
294 return false;
295 }
296
297 public bool DestroyUserSession(UUID userID, UUID sessionID)
298 {
299 if (!VerifyUserSession(userID, sessionID))
300 return false;
301
302 UserAgentData agent = m_Database.GetAgentByUUID(userID);
303 if (agent == null)
304 return false;
305
306 agent.SessionID = UUID.Zero;
307 m_Database.AddNewUserAgent(agent);
308
309 return true;
310 }
311 }
312}
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs
index 2402414..d473cf8 100644
--- a/OpenSim/Services/Interfaces/IAuthenticationService.cs
+++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs
@@ -38,57 +38,89 @@ namespace OpenSim.Services.Interfaces
38 // 38 //
39 public interface IAuthenticationService 39 public interface IAuthenticationService
40 { 40 {
41 ////////////////////////////////////////////////// 41 //////////////////////////////////////////////////////
42 // Web login key portion 42 // PKI Zone!
43 // 43 //
44 44 // HG2 authentication works by using a cryptographic
45 // Get a service key given that principal's 45 // exchange.
46 // authentication token (master key). 46 // This method must provide a public key, the other
47 // crypto methods must understand hoow to deal with
48 // messages encrypted to it.
47 // 49 //
48 string GetKey(UUID principalID, string authToken); 50 // If the public key is of zero length, you will
49 51 // get NO encryption and NO security.
50 // Verify that a principal key is valid 52 //
53 // For non-HG installations, this is not relevant
51 // 54 //
52 bool VerifyKey(UUID principalID, string key); 55 // Implementors who are not using PKI can treat the
56 // cyphertext as a string and provide a zero-length
57 // key. Encryptionless implementations will not
58 // interoperate with implementations using encryption.
59 // If one side uses encryption, both must do so.
60 //
61 byte[] GetPublicKey();
53 62
54 ////////////////////////////////////////////////// 63 //////////////////////////////////////////////////////
55 // Password auth portion 64 // Authentication
65 //
66 // These methods will return a token, which can be used to access
67 // various services.
68 //
69 // The encrypted versions take the received cyphertext and
70 // the public key of the peer, which the connector must have
71 // obtained using a remote GetPublicKey call.
56 // 72 //
73 string AuthenticatePassword(UUID principalID, string password);
74 byte[] AuthenticatePasswordEncrypted(byte[] cyphertext, byte[] key);
57 75
58 // Here's how thos works, and why. 76 string AuthenticateWebkey(UUID principalID, string webkey);
59 // 77 byte[] AuthenticateWebkeyEncrypted(byte[] cyphertext, byte[] key);
60 // The authentication methods will return the existing session,
61 // or UUID.Zero if authentication failed. If there is no session,
62 // they will create one.
63 // The CreateUserSession method will unconditionally create a session
64 // and invalidate the prior session.
65 // Grid login uses this method to make sure that the session is
66 // fresh and new. Other software, like management applications,
67 // can obtain this existing session if they have a key or password
68 // for that account, this allows external apps to obtain credentials
69 // and use authenticating interface methods.
70 //
71
72 // Check the pricipal's password
73 //
74 UUID AuthenticatePassword(UUID principalID, string password);
75 78
76 // Check the principal's key 79 //////////////////////////////////////////////////////
80 // Verification
77 // 81 //
78 UUID AuthenticateKey(UUID principalID, string password); 82 // Allows to verify the authenticity of a token
83 //
84 // Tokens expire after 30 minutes and can be refreshed by
85 // re-verifying.
86 //
87 // If encrypted authentication was used, encrypted verification
88 // must be used to refresh. Unencrypted verification is still
89 // performed, but doesn't refresh token lifetime.
90 //
91 bool Verify(UUID principalID, string token);
92 bool VerifyEncrypted(byte[] cyphertext, byte[] key);
79 93
80 // Create a new session, invalidating the old ones 94 //////////////////////////////////////////////////////
95 // Teardown
96 //
97 // A token can be returned before the timeout. This
98 // invalidates it and it can not subsequently be used
99 // or refreshed.
100 //
101 // Tokens created by encrypted authentication must
102 // be returned by encrypted release calls;
81 // 103 //
82 UUID CreateUserSession(UUID principalID, UUID oldSessionID); 104 bool Release(UUID principalID, string token);
105 bool ReleaseEncrypted(byte[] cyphertext, byte[] key);
83 106
84 // Verify that a user session ID is valid. A session ID is 107 //////////////////////////////////////////////////////
85 // considered valid when a user has successfully authenticated 108 // Grid
86 // at least one time inside that session.
87 // 109 //
88 bool VerifyUserSession(UUID principalID, UUID sessionID); 110 // We no longer need a shared secret between grid
111 // servers. Anything a server requests from another
112 // server is either done on behalf of a user, in which
113 // case there is a token, or on behalf of a region,
114 // which has a session. So, no more keys.
115 // If sniffing on the local lan is an issue, admins
116 // need to take approriate action (IPSec is recommended)
117 // to secure inter-server traffic.
89 118
90 // Deauthenticate user 119 //////////////////////////////////////////////////////
120 // NOTE
91 // 121 //
92 bool DestroyUserSession(UUID principalID, UUID sessionID); 122 // Session IDs are not handled here. After obtaining
123 // a token, the session ID regions use can be
124 // obtained from the presence service.
93 } 125 }
94} 126}
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 19b1fd8..f04754b 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -88,6 +88,8 @@ namespace OpenSim.Services.InventoryService
88 // See IInventoryServices 88 // See IInventoryServices
89 public virtual InventoryFolderBase GetRootFolder(UUID userID) 89 public virtual InventoryFolderBase GetRootFolder(UUID userID)
90 { 90 {
91 //m_log.DebugFormat("[INVENTORY SERVICE]: Getting root folder for {0}", userID);
92
91 // Retrieve the first root folder we get from the DB. 93 // Retrieve the first root folder we get from the DB.
92 InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID); 94 InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID);
93 if (rootFolder != null) 95 if (rootFolder != null)
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index 1b14abb..ce116f2 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Data; 34using OpenSim.Data;
@@ -39,7 +41,9 @@ namespace OpenSim.Tests.Common.Mock
39 /// tests are single threaded. 41 /// tests are single threaded.
40 /// </summary> 42 /// </summary>
41 public class TestInventoryDataPlugin : IInventoryDataPlugin 43 public class TestInventoryDataPlugin : IInventoryDataPlugin
42 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
43 /// <value> 47 /// <value>
44 /// Inventory folders 48 /// Inventory folders
45 /// </value> 49 /// </value>
@@ -87,6 +91,8 @@ namespace OpenSim.Tests.Common.Mock
87 91
88 public InventoryFolderBase getUserRootFolder(UUID user) 92 public InventoryFolderBase getUserRootFolder(UUID user)
89 { 93 {
94 m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user);
95
90 InventoryFolderBase folder = null; 96 InventoryFolderBase folder = null;
91 m_rootFolders.TryGetValue(user, out folder); 97 m_rootFolders.TryGetValue(user, out folder);
92 98
@@ -124,7 +130,11 @@ namespace OpenSim.Tests.Common.Mock
124 m_folders[folder.ID] = folder; 130 m_folders[folder.ID] = folder;
125 131
126 if (folder.ParentID == UUID.Zero) 132 if (folder.ParentID == UUID.Zero)
133 {
134 m_log.DebugFormat(
135 "[MOCK INV DB]: Adding root folder {0} {1} for {2}", folder.Name, folder.ID, folder.Owner);
127 m_rootFolders[folder.Owner] = folder; 136 m_rootFolders[folder.Owner] = folder;
137 }
128 } 138 }
129 139
130 public void updateInventoryFolder(InventoryFolderBase folder) 140 public void updateInventoryFolder(InventoryFolderBase folder)
diff --git a/bin/OpenSim.Data.MySQL.Tests.dll.config b/bin/OpenSim.Data.MySQL.Tests.dll.config
deleted file mode 100644
index a3f681d..0000000
--- a/bin/OpenSim.Data.MySQL.Tests.dll.config
+++ /dev/null
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <runtime>
7 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8 <dependentAssembly>
9 <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
10 <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
11 <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
12 <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
13 </dependentAssembly>
14 </assemblyBinding>
15 </runtime>
16 <log4net>
17 <!-- A1 is set to be a ConsoleAppender -->
18 <appender name="A1" type="log4net.Appender.ConsoleAppender">
19
20 <!-- A1 uses PatternLayout -->
21 <layout type="log4net.Layout.PatternLayout">
22 <!-- Print the date in ISO 8601 format -->
23 <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
24 </layout>
25 </appender>
26
27 <!-- Set root logger level to DEBUG and its only appender to A1 -->
28 <root>
29 <level value="DEBUG" />
30 <appender-ref ref="A1" />
31 </root>
32 </log4net>
33</configuration>
diff --git a/bin/OpenSim.Data.NHibernate.Tests.dll.config b/bin/OpenSim.Data.NHibernate.Tests.dll.config
deleted file mode 100644
index 9b3231f..0000000
--- a/bin/OpenSim.Data.NHibernate.Tests.dll.config
+++ /dev/null
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <runtime>
7 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8 <dependentAssembly>
9 <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
10 <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
11 <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
12 <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
13 </dependentAssembly>
14 </assemblyBinding>
15 </runtime>
16 <log4net>
17 <!-- A1 is set to be a ConsoleAppender -->
18 <appender name="A1" type="log4net.Appender.ConsoleAppender">
19
20 <!-- A1 uses PatternLayout -->
21 <layout type="log4net.Layout.PatternLayout">
22 <!-- Print the date in ISO 8601 format -->
23 <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
24 </layout>
25 </appender>
26
27 <!-- Set root logger level to DEBUG and its only appender to A1 -->
28 <root>
29 <level value="Info" />
30 <appender-ref ref="A1" />
31 </root>
32 </log4net>
33</configuration>
diff --git a/bin/OpenSim.Data.SQLite.Tests.dll.config b/bin/OpenSim.Data.SQLite.Tests.dll.config
deleted file mode 100644
index a3f681d..0000000
--- a/bin/OpenSim.Data.SQLite.Tests.dll.config
+++ /dev/null
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <runtime>
7 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8 <dependentAssembly>
9 <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
10 <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
11 <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
12 <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
13 </dependentAssembly>
14 </assemblyBinding>
15 </runtime>
16 <log4net>
17 <!-- A1 is set to be a ConsoleAppender -->
18 <appender name="A1" type="log4net.Appender.ConsoleAppender">
19
20 <!-- A1 uses PatternLayout -->
21 <layout type="log4net.Layout.PatternLayout">
22 <!-- Print the date in ISO 8601 format -->
23 <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
24 </layout>
25 </appender>
26
27 <!-- Set root logger level to DEBUG and its only appender to A1 -->
28 <root>
29 <level value="DEBUG" />
30 <appender-ref ref="A1" />
31 </root>
32 </log4net>
33</configuration>
diff --git a/bin/OpenSim.Data.Tests.dll.config b/bin/OpenSim.Data.Tests.dll.config
deleted file mode 100644
index a3f681d..0000000
--- a/bin/OpenSim.Data.Tests.dll.config
+++ /dev/null
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <runtime>
7 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8 <dependentAssembly>
9 <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
10 <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
11 <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
12 <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
13 </dependentAssembly>
14 </assemblyBinding>
15 </runtime>
16 <log4net>
17 <!-- A1 is set to be a ConsoleAppender -->
18 <appender name="A1" type="log4net.Appender.ConsoleAppender">
19
20 <!-- A1 uses PatternLayout -->
21 <layout type="log4net.Layout.PatternLayout">
22 <!-- Print the date in ISO 8601 format -->
23 <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
24 </layout>
25 </appender>
26
27 <!-- Set root logger level to DEBUG and its only appender to A1 -->
28 <root>
29 <level value="DEBUG" />
30 <appender-ref ref="A1" />
31 </root>
32 </log4net>
33</configuration>
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index cff5d19..2303873 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1366,6 +1366,13 @@
1366 ; 1366 ;
1367 ;TextureDataLimit = 5 1367 ;TextureDataLimit = 5
1368 1368
1369;; The JPEG2000 decode cache
1370;; Timeout is in minutes
1371
1372[J2KDecoder]
1373;CacheDir = "./j2kDecodeCache"
1374;CacheTimeout = 720
1375
1369;; 1376;;
1370;; These are defaults that are overwritten below in [Architecture]. 1377;; These are defaults that are overwritten below in [Architecture].
1371;; These defaults allow OpenSim to work out of the box with 1378;; These defaults allow OpenSim to work out of the box with