smbprovider: Refactor AddEntryIfValid to identify shares as directories
AddEntryIfValid will identify entries with type SMBC_FILE_SHARE as a
directory. This is done so that is_directory will be true for shares in
DirectoryEntryProto.
BUG=chromium:757625
TEST=unit tests run
Change-Id: Ia69d38675704a636e428e189ab7e51b8ee090f1b
Reviewed-on: https://chromium-review.googlesource.com/957547
Commit-Ready: Allen Vicencio <allenvic@chromium.org>
Tested-by: Allen Vicencio <allenvic@chromium.org>
Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org>
diff --git a/smbprovider/iterator/directory_iterator.cc b/smbprovider/iterator/directory_iterator.cc
index 9344cb8..454a109 100644
--- a/smbprovider/iterator/directory_iterator.cc
+++ b/smbprovider/iterator/directory_iterator.cc
@@ -154,7 +154,8 @@
if (IsSelfOrParentDir(name) || !ShouldIncludeEntryType(dirent.smbc_type)) {
return;
}
- bool is_directory = dirent.smbc_type == SMBC_DIR;
+ bool is_directory =
+ dirent.smbc_type == SMBC_DIR || dirent.smbc_type == SMBC_FILE_SHARE;
directory_entries->emplace_back(is_directory, name,
AppendPath(parent_dir_path, name));
}