added an additional hard limit to directory depth, just in case

This commit is contained in:
csoler 2017-09-24 23:51:47 +02:00
parent f497905497
commit 4766a8927a
2 changed files with 10 additions and 3 deletions

View File

@ -211,7 +211,7 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
case librs::util::FolderIterator::TYPE_DIR:
if(mMaxShareDepth > 0u && current_depth <= mMaxShareDepth)
if( (mMaxShareDepth > 0u && current_depth <= mMaxShareDepth) || (mMaxShareDepth==0 && current_depth < 64)) // 64 is here as a safe limit, to make loops impossible.
subdirs.insert(dirIt.file_name());
#ifdef DEBUG_LOCAL_DIR_UPDATER

View File

@ -94,6 +94,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="ignoreDuplicates_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When following sybolic links, Retroshare can encounter the same directory/file more than once. If checked, this option will make tell Retroshare to silently ignore the file. This option saves Retroshare indexing against directory loops.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ignore duplicate files/directories</string>
</property>
@ -102,7 +105,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Maximum depth:</string>
<string>Maximum depth (0=unlimited):</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -110,7 +113,11 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="maxDepth_SB"/>
<widget class="QSpinBox" name="maxDepth_SB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This value allows you to limit the depth of the directory hierarchy you are indexing, starting from the base directory. If you allow Retroshare to follow symbolic links and unchecked &amp;quot;Ignore duplicate files/directories&amp;quot;, this option will avoid that Retroshare loops indefinitly while parsing directories.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>