summaryrefslogtreecommitdiff
path: root/mythfs/service/inodes
diff options
context:
space:
mode:
Diffstat (limited to 'mythfs/service/inodes')
-rw-r--r--mythfs/service/inodes/abstractDynamicDirectory.cpp6
-rw-r--r--mythfs/service/inodes/allDirectory.cpp7
-rw-r--r--mythfs/service/inodes/filterByDateDirectory.cpp2
-rw-r--r--mythfs/service/inodes/filterByTitleDirectory.cpp2
-rw-r--r--mythfs/service/inodes/groupingByDateDirectory.cpp5
-rw-r--r--mythfs/service/inodes/groupingByTitleDirectory.cpp5
6 files changed, 19 insertions, 8 deletions
diff --git a/mythfs/service/inodes/abstractDynamicDirectory.cpp b/mythfs/service/inodes/abstractDynamicDirectory.cpp
index 0a703db..48287e6 100644
--- a/mythfs/service/inodes/abstractDynamicDirectory.cpp
+++ b/mythfs/service/inodes/abstractDynamicDirectory.cpp
@@ -12,11 +12,5 @@ namespace MythFS {
1, "root", "root", 0, 0, 0, 0, 0, 0, 0
};
}
-
- Node::PointerType
- AbstractDynamicDirectory::getChild(const std::string &) const
- {
- throw ::NetFS::SystemError(EINVAL);
- }
}
diff --git a/mythfs/service/inodes/allDirectory.cpp b/mythfs/service/inodes/allDirectory.cpp
index d61b8b9..d7745f6 100644
--- a/mythfs/service/inodes/allDirectory.cpp
+++ b/mythfs/service/inodes/allDirectory.cpp
@@ -1,6 +1,7 @@
#include "allDirectory.h"
#include <util.h>
#include "symlink.h"
+#include <exceptions.h>
namespace MythFS {
AllDirectory::AllDirectory(const DBPrx & d) : db(d) { }
@@ -14,6 +15,12 @@ namespace MythFS {
Node::PointerType
AllDirectory::getChild(const std::string & path) const
{
+ auto rs = db->getRecorded();
+ if (std::find_if(rs.begin(), rs.end(), [path](auto r) {
+ return r->basename == path;
+ }) == rs.end()) {
+ throw NetFS::SystemError(ENOENT);
+ }
return new Symlink("/var/store/mythrecordings/" + path);
}
}
diff --git a/mythfs/service/inodes/filterByDateDirectory.cpp b/mythfs/service/inodes/filterByDateDirectory.cpp
index ddf048c..a8964c0 100644
--- a/mythfs/service/inodes/filterByDateDirectory.cpp
+++ b/mythfs/service/inodes/filterByDateDirectory.cpp
@@ -27,7 +27,7 @@ namespace MythFS {
FilterByDateDirectory::getChild(const std::string & n) const
{
for (auto r :db->getRecorded()) {
- if (attribute(r) == n) {
+ if (matches(r) && attribute(r) == n) {
return new Symlink("/var/store/mythrecordings/" + r->basename);
}
}
diff --git a/mythfs/service/inodes/filterByTitleDirectory.cpp b/mythfs/service/inodes/filterByTitleDirectory.cpp
index 25b0e71..d17999f 100644
--- a/mythfs/service/inodes/filterByTitleDirectory.cpp
+++ b/mythfs/service/inodes/filterByTitleDirectory.cpp
@@ -26,7 +26,7 @@ namespace MythFS {
FilterByTitleDirectory::getChild(const std::string & n) const
{
for (auto r :db->getRecorded()) {
- if (attribute(r) == n) {
+ if (matches(r) && attribute(r) == n) {
return new Symlink("/var/store/mythrecordings/" + r->basename);
}
}
diff --git a/mythfs/service/inodes/groupingByDateDirectory.cpp b/mythfs/service/inodes/groupingByDateDirectory.cpp
index dccf38e..1ab83a2 100644
--- a/mythfs/service/inodes/groupingByDateDirectory.cpp
+++ b/mythfs/service/inodes/groupingByDateDirectory.cpp
@@ -1,5 +1,7 @@
#include "groupingByDateDirectory.h"
#include "filterByDateDirectory.h"
+#include <safeMapFind.h>
+#include <exceptions.h>
namespace MythFS {
ByDateDirectory::ByDateDirectory(DBPrx db) :
@@ -16,6 +18,9 @@ namespace MythFS {
Node::PointerType
ByDateDirectory::getChild(const std::string & t) const
{
+ if (!AdHoc::containerContains(getContents(), t)) {
+ throw NetFS::SystemError(ENOENT);
+ }
return new FilterByDateDirectory(db, t);
}
}
diff --git a/mythfs/service/inodes/groupingByTitleDirectory.cpp b/mythfs/service/inodes/groupingByTitleDirectory.cpp
index 4ab4134..e215e55 100644
--- a/mythfs/service/inodes/groupingByTitleDirectory.cpp
+++ b/mythfs/service/inodes/groupingByTitleDirectory.cpp
@@ -1,5 +1,7 @@
#include "groupingByTitleDirectory.h"
#include "filterByTitleDirectory.h"
+#include <safeMapFind.h>
+#include <exceptions.h>
namespace MythFS {
ByTitleDirectory::ByTitleDirectory(DBPrx db) :
@@ -16,6 +18,9 @@ namespace MythFS {
Node::PointerType
ByTitleDirectory::getChild(const std::string & t) const
{
+ if (!AdHoc::containerContains(getContents(), t)) {
+ throw NetFS::SystemError(ENOENT);
+ }
return new FilterByTitleDirectory(db, t);
}
}