git://scientific.zcu.cz
/
dmlite-plugins-vfs-old.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ace6b98
)
Fix access when mode metadata is missing (owner root, no permissions).
master
author
František Dvořák
<valtri@civ.zcu.cz>
Wed, 18 Dec 2013 18:44:40 +0000
(19:44 +0100)
committer
František Dvořák
<valtri@civ.zcu.cz>
Wed, 18 Dec 2013 18:44:40 +0000
(19:44 +0100)
src/VfsNs.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/VfsNs.cpp
b/src/VfsNs.cpp
index
da7c898
..
cf32d5c
100644
(file)
--- a/
src/VfsNs.cpp
+++ b/
src/VfsNs.cpp
@@
-28,9
+28,9
@@
#define IS_VFS_XATTR(NAME) (strncmp((NAME), VFS_XATTR, VFS_XATTR_LENGTH) == 0)
#define IS_VFS_FILE(NAME) (strncmp((NAME), VFS_FILE, VFS_FILE_LENGTH) == 0)
#define IS_VFS_XATTR(NAME) (strncmp((NAME), VFS_XATTR, VFS_XATTR_LENGTH) == 0)
#define IS_VFS_FILE(NAME) (strncmp((NAME), VFS_FILE, VFS_FILE_LENGTH) == 0)
-//
force everything to current owner for now
-#define VFS_UID_NONE
xStat.stat.st_uid
-#define VFS_GID_NONE
xStat.stat.st_gid
+//
no owner or group ==> root
+#define VFS_UID_NONE
0
+#define VFS_GID_NONE
0
#define INODE_CACHE_SIZE 256
#define INODE_CACHE_SIZE 256
@@
-201,6
+201,9
@@
void VfsCatalog::vfsUpdateStat(ExtendedStat &xStat, Extensible xattrs) throw (Dm
xStat.stat.st_uid = xattrs.getUnsigned(VFS_XATTR "owner", VFS_UID_NONE);
modeStr = xattrs.getString(VFS_XATTR "mode", "");
xStat.stat.st_uid = xattrs.getUnsigned(VFS_XATTR "owner", VFS_UID_NONE);
modeStr = xattrs.getString(VFS_XATTR "mode", "");
+ // 1) prefer type from the filesystem
+ // 2) no permissions at all when not in xattrs
+ xStat.stat.st_mode &= S_IFMT;
if (!modeStr.empty()) {
errno = 0;
mode = strtoull(modeStr.c_str(), &parse, 8);
if (!modeStr.empty()) {
errno = 0;
mode = strtoull(modeStr.c_str(), &parse, 8);
@@
-213,8
+216,6
@@
void VfsCatalog::vfsUpdateStat(ExtendedStat &xStat, Extensible xattrs) throw (Dm
log(LOG_ERR, "conversion of the mode '%s' failed on '%s'", modeStr.c_str(), xStat.name.c_str());
#endif
} else {
log(LOG_ERR, "conversion of the mode '%s' failed on '%s'", modeStr.c_str(), xStat.name.c_str());
#endif
} else {
- // prefer type from the filesystem
- mode &= ~S_IFMT;
mode |= xStat.stat.st_mode & S_IFMT;
// use xattr for everything else
xStat.stat.st_mode = mode;
mode |= xStat.stat.st_mode & S_IFMT;
// use xattr for everything else
xStat.stat.st_mode = mode;