diff options
author | Justin Clarke Casey | 2008-12-29 16:56:48 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-29 16:56:48 +0000 |
commit | 266d0fbaaeac0dad06da98ceda8d19b8f3d732d6 (patch) | |
tree | 45f2ad93db485b5144c3fc86662891432c3a877a /OpenSim/Framework/Communications/Cache | |
parent | Revamp the return logic to close a privilege escalation loophole. (diff) | |
download | opensim-SC-266d0fbaaeac0dad06da98ceda8d19b8f3d732d6.zip opensim-SC-266d0fbaaeac0dad06da98ceda8d19b8f3d732d6.tar.gz opensim-SC-266d0fbaaeac0dad06da98ceda8d19b8f3d732d6.tar.bz2 opensim-SC-266d0fbaaeac0dad06da98ceda8d19b8f3d732d6.tar.xz |
* Apply http://opensimulator.org/mantis/view.php?id=2927 with some changes
* This allows configuration of the assetset and library control file paths to be other than ./inventory/Libraries.xml and ./assets/AssetSets.xml
* This is controlled via the LibrariesXMLFile and AssetSetsXMLFile configuration settings in [StandAlone] in OpenSim.ini (in standalone)
and via the user and asset config xml files for grid mode
* Thanks to SirKimba for the patch
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | 27 |
2 files changed, 14 insertions, 17 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index a289fb7..137bde9 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -106,11 +106,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | public virtual void LoadDefaultAssets() | 109 | public virtual void LoadDefaultAssets(string pAssetSetsXml) |
110 | { | 110 | { |
111 | m_log.Info("[ASSET SERVER]: Setting up asset database"); | 111 | m_log.Info("[ASSET SERVER]: Setting up asset database"); |
112 | 112 | ||
113 | assetLoader.ForEachDefaultXmlAsset(StoreAsset); | 113 | assetLoader.ForEachDefaultXmlAsset(pAssetSetsXml, StoreAsset); |
114 | } | 114 | } |
115 | 115 | ||
116 | public AssetServerBase() | 116 | public AssetServerBase() |
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index cf3490b..0b05adf 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | |||
@@ -52,11 +52,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
52 | /// </summary> | 52 | /// </summary> |
53 | protected Dictionary<UUID, InventoryFolderImpl> libraryFolders | 53 | protected Dictionary<UUID, InventoryFolderImpl> libraryFolders |
54 | = new Dictionary<UUID, InventoryFolderImpl>(); | 54 | = new Dictionary<UUID, InventoryFolderImpl>(); |
55 | 55 | ||
56 | public LibraryRootFolder() | 56 | public LibraryRootFolder(string pLibrariesLocation) |
57 | { | 57 | { |
58 | m_log.Info("[LIBRARY INVENTORY]: Loading library inventory"); | ||
59 | |||
60 | Owner = libOwner; | 58 | Owner = libOwner; |
61 | ID = new UUID("00000112-000f-0000-0000-000100bba000"); | 59 | ID = new UUID("00000112-000f-0000-0000-000100bba000"); |
62 | Name = "OpenSim Library"; | 60 | Name = "OpenSim Library"; |
@@ -66,7 +64,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
66 | 64 | ||
67 | libraryFolders.Add(ID, this); | 65 | libraryFolders.Add(ID, this); |
68 | 66 | ||
69 | LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml")); | 67 | LoadLibraries(pLibrariesLocation); |
70 | } | 68 | } |
71 | 69 | ||
72 | public InventoryItemBase CreateItem(UUID inventoryID, UUID assetID, string name, string description, | 70 | public InventoryItemBase CreateItem(UUID inventoryID, UUID assetID, string name, string description, |
@@ -96,9 +94,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
96 | /// <param name="assets"></param> | 94 | /// <param name="assets"></param> |
97 | protected void LoadLibraries(string librariesControlPath) | 95 | protected void LoadLibraries(string librariesControlPath) |
98 | { | 96 | { |
99 | m_log.InfoFormat( | 97 | m_log.InfoFormat("[LIBRARY INVENTORY]: Loading library control file {0}", librariesControlPath); |
100 | "[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath); | ||
101 | |||
102 | LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); | 98 | LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); |
103 | } | 99 | } |
104 | 100 | ||
@@ -106,17 +102,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
106 | /// Read a library set from config | 102 | /// Read a library set from config |
107 | /// </summary> | 103 | /// </summary> |
108 | /// <param name="config"></param> | 104 | /// <param name="config"></param> |
109 | protected void ReadLibraryFromConfig(IConfig config) | 105 | protected void ReadLibraryFromConfig(IConfig config, string path) |
110 | { | 106 | { |
107 | string basePath = Path.GetDirectoryName(path); | ||
111 | string foldersPath | 108 | string foldersPath |
112 | = Path.Combine( | 109 | = Path.Combine( |
113 | Util.inventoryDir(), config.GetString("foldersFile", String.Empty)); | 110 | basePath, config.GetString("foldersFile", String.Empty)); |
114 | 111 | ||
115 | LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig); | 112 | LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig); |
116 | 113 | ||
117 | string itemsPath | 114 | string itemsPath |
118 | = Path.Combine( | 115 | = Path.Combine( |
119 | Util.inventoryDir(), config.GetString("itemsFile", String.Empty)); | 116 | basePath, config.GetString("itemsFile", String.Empty)); |
120 | 117 | ||
121 | LoadFromFile(itemsPath, "Library items", ReadItemFromConfig); | 118 | LoadFromFile(itemsPath, "Library items", ReadItemFromConfig); |
122 | } | 119 | } |
@@ -125,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
125 | /// Read a library inventory folder from a loaded configuration | 122 | /// Read a library inventory folder from a loaded configuration |
126 | /// </summary> | 123 | /// </summary> |
127 | /// <param name="source"></param> | 124 | /// <param name="source"></param> |
128 | private void ReadFolderFromConfig(IConfig config) | 125 | private void ReadFolderFromConfig(IConfig config, string path) |
129 | { | 126 | { |
130 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); | 127 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); |
131 | 128 | ||
@@ -158,7 +155,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
158 | /// Read a library inventory item metadata from a loaded configuration | 155 | /// Read a library inventory item metadata from a loaded configuration |
159 | /// </summary> | 156 | /// </summary> |
160 | /// <param name="source"></param> | 157 | /// <param name="source"></param> |
161 | private void ReadItemFromConfig(IConfig config) | 158 | private void ReadItemFromConfig(IConfig config, string path) |
162 | { | 159 | { |
163 | InventoryItemBase item = new InventoryItemBase(); | 160 | InventoryItemBase item = new InventoryItemBase(); |
164 | item.Owner = libOwner; | 161 | item.Owner = libOwner; |
@@ -195,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
195 | } | 192 | } |
196 | } | 193 | } |
197 | 194 | ||
198 | private delegate void ConfigAction(IConfig config); | 195 | private delegate void ConfigAction(IConfig config, string path); |
199 | 196 | ||
200 | /// <summary> | 197 | /// <summary> |
201 | /// Load the given configuration at a path and perform an action on each Config contained within it | 198 | /// Load the given configuration at a path and perform an action on each Config contained within it |
@@ -213,7 +210,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
213 | 210 | ||
214 | for (int i = 0; i < source.Configs.Count; i++) | 211 | for (int i = 0; i < source.Configs.Count; i++) |
215 | { | 212 | { |
216 | action(source.Configs[i]); | 213 | action(source.Configs[i], path); |
217 | } | 214 | } |
218 | } | 215 | } |
219 | catch (XmlException e) | 216 | catch (XmlException e) |