[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Wed Jul 11 00:23:04 UTC 2018
The branch, master has been updated
via 36b4b56 pass 'rdonly' or 'directory' flag to open a directory file.
from 621349d s3/rpc_server: Character Encode Spotlight Queries
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 36b4b5655400df48f539d882b7c820ae109b3605
Author: Pooja Mahadik <pooja.mahadik at veritas.com>
Date: Tue Jul 10 11:17:42 2018 +0530
pass 'rdonly' or 'directory' flag to open a directory file.
Signed-off-by: Pooja Mahadik <pooja.mahadik at veritas.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Jul 11 02:22:18 CEST 2018 on sn-devel-144
-----------------------------------------------------------------------
Summary of changes:
source3/modules/lib_vxfs.c | 20 +++++++++++++++-----
source3/modules/vfs_vxfs.c | 8 +++++---
source3/modules/vfs_vxfs.h | 4 ++--
3 files changed, 22 insertions(+), 10 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/lib_vxfs.c b/source3/modules/lib_vxfs.c
index f9394d6..dcb5cb3 100644
--- a/source3/modules/lib_vxfs.c
+++ b/source3/modules/lib_vxfs.c
@@ -224,11 +224,15 @@ int vxfs_setwxattr_fd(int fd)
return ret;
}
-int vxfs_setwxattr_path(const char *path)
+int vxfs_setwxattr_path(const char *path, bool is_dir)
{
int ret, fd = -1;
- fd = open(path, O_WRONLY);
+ if (is_dir) {
+ fd = open(path, O_RDONLY|O_DIRECTORY);
+ } else {
+ fd = open(path, O_WRONLY);
+ }
if (fd == -1) {
DBG_DEBUG("file %s not opened, errno:%s\n",
path, strerror(errno));
@@ -259,11 +263,16 @@ int vxfs_clearwxattr_fd(int fd)
return ret;
}
-int vxfs_clearwxattr_path(const char *path)
+int vxfs_clearwxattr_path(const char *path, bool is_dir)
{
int ret, fd = -1;
- fd = open(path, O_WRONLY);
+ if (is_dir) {
+ fd = open(path, O_RDONLY|O_DIRECTORY);
+ } else {
+ fd = open(path, O_WRONLY);
+ }
+
if (fd == -1) {
DBG_DEBUG("file %s not opened, errno:%s\n",
path, strerror(errno));
@@ -297,7 +306,8 @@ int vxfs_checkwxattr_path(const char *path)
{
int ret, fd = -1;
- fd = open(path, O_WRONLY);
+ fd = open(path, O_RDONLY);
+
if (fd == -1) {
DBG_DEBUG("file %s not opened, errno:%s\n",
path, strerror(errno));
diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c
index 3bf3adc..1295c75 100644
--- a/source3/modules/vfs_vxfs.c
+++ b/source3/modules/vfs_vxfs.c
@@ -833,11 +833,13 @@ static NTSTATUS vxfs_set_ea_dos_attributes(struct vfs_handle_struct *handle,
uint32_t dosmode)
{
NTSTATUS err;
- int ret = 0;
+ int ret = 0;
bool attrset = false;
+ bool is_dir = false;
DBG_DEBUG("Entered function\n");
+ is_dir = S_ISDIR(smb_fname->st.st_ex_mode);
if (!(dosmode & FILE_ATTRIBUTE_READONLY)) {
ret = vxfs_checkwxattr_path(smb_fname->base_name);
if (ret == -1) {
@@ -848,7 +850,7 @@ static NTSTATUS vxfs_set_ea_dos_attributes(struct vfs_handle_struct *handle,
}
}
if (dosmode & FILE_ATTRIBUTE_READONLY) {
- ret = vxfs_setwxattr_path(smb_fname->base_name);
+ ret = vxfs_setwxattr_path(smb_fname->base_name, is_dir);
DBG_DEBUG("ret:%d\n", ret);
if (ret == -1) {
if ((errno != EOPNOTSUPP) && (errno != EINVAL)) {
@@ -861,7 +863,7 @@ static NTSTATUS vxfs_set_ea_dos_attributes(struct vfs_handle_struct *handle,
err = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle, smb_fname, dosmode);
if (!NT_STATUS_IS_OK(err)) {
if (attrset) {
- ret = vxfs_clearwxattr_path(smb_fname->base_name);
+ ret = vxfs_clearwxattr_path(smb_fname->base_name, is_dir);
DBG_DEBUG("ret:%d\n", ret);
if ((ret == -1) && (errno != ENOENT)) {
return map_nt_error_from_unix(errno);
diff --git a/source3/modules/vfs_vxfs.h b/source3/modules/vfs_vxfs.h
index f438bad..1975590 100644
--- a/source3/modules/vfs_vxfs.h
+++ b/source3/modules/vfs_vxfs.h
@@ -31,10 +31,10 @@ int vxfs_removexattr_fd(int, const char *);
int vxfs_listxattr_path(const char *, char *, size_t);
int vxfs_listxattr_fd(int, char *, size_t);
-int vxfs_setwxattr_path(const char *);
+int vxfs_setwxattr_path(const char *, bool);
int vxfs_setwxattr_fd(int);
-int vxfs_clearwxattr_path(const char *);
+int vxfs_clearwxattr_path(const char *, bool);
int vxfs_clearwxattr_fd(int);
int vxfs_checkwxattr_path(const char *);
--
Samba Shared Repository
More information about the samba-cvs
mailing list