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));
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));
{
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));
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) {
}
}
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)) {
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);
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 *);