#define IS_PRINT(conn) ((conn) && (conn)->printer)
#define CHECK_READ(fsp,req) \
- (((fsp)->fh->fd != -1) && \
+ ((!(fsp)->fsp_flags.is_pathref) && \
+ (fsp_get_io_fd(fsp) != -1) && \
(((fsp)->fsp_flags.can_read) || \
((req->flags2 & FLAGS2_READ_PERMIT_EXECUTE) && \
(fsp->access_mask & FILE_EXECUTE))))
* test).
*/
#define CHECK_READ_SMB2(fsp) \
- (((fsp)->fh->fd != -1) && \
+ ((!(fsp)->fsp_flags.is_pathref) && \
+ (fsp_get_io_fd(fsp) != -1) && \
(((fsp)->fsp_flags.can_read) || \
(fsp->access_mask & FILE_EXECUTE)))
* the "if execute is granted then also grant read" arrangement.
*/
#define CHECK_READ_IOCTL(fsp) \
- (((fsp)->fh->fd != -1) && \
+ ((!(fsp)->fsp_flags.is_pathref) && \
+ (fsp_get_io_fd(fsp) != -1) && \
(((fsp)->fsp_flags.can_read)))
#define CHECK_WRITE(fsp) \
((fsp)->fsp_flags.can_write && \
- ((fsp)->fh->fd != -1))
+ (!(fsp)->fsp_flags.is_pathref) && \
+ (fsp_get_io_fd(fsp) != -1))
#define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \
NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) )
if ((fsp == NULL)
|| (fsp->fh == NULL)
- || (fsp->fh->fd == -1))
+ || (fsp_get_io_fd(fsp) == -1))
{
smb_panic("bad fsp");
}
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_rbt.h"
#include "util_tdb.h"
+#include "smbd/fd_handle.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LOCKING
bool ret;
DEBUG(8,("posix_fcntl_lock %d %d %jd %jd %d\n",
- fsp->fh->fd,op,(intmax_t)offset,(intmax_t)count,type));
+ fsp_get_io_fd(fsp),op,(intmax_t)offset,(intmax_t)count,type));
ret = SMB_VFS_LOCK(fsp, op, offset, count, type);
bool ret;
DEBUG(8, ("posix_fcntl_getlock %d %ju %ju %d\n",
- fsp->fh->fd, (uintmax_t)*poffset, (uintmax_t)*pcount,
+ fsp_get_io_fd(fsp), (uintmax_t)*poffset, (uintmax_t)*pcount,
*ptype));
ret = SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, &pid);
/*
* There are outstanding locks on this dev/inode pair on
* other fds. Add our fd to the pending close db. We also
- * set fsp->fh->fd to -1 inside fd_close() after returning
+ * set fsp_get_io_fd(fsp) to -1 inside fd_close() after returning
* from VFS layer.
*/
cmd.cmd = READ_CMD;
cmd.erratic_testing_mode = config->erratic_testing_mode;
- DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd,
+ DEBUG(10, ("sending fd %d to child %d\n", fsp_get_io_fd(fsp),
(int)state->child->pid));
/*
* domain socket. This should never block.
*/
written = write_fd(state->child->sockfd, &cmd, sizeof(cmd),
- fsp->fh->fd);
+ fsp_get_io_fd(fsp));
if (written == -1) {
err = errno;
cmd.cmd = WRITE_CMD;
cmd.erratic_testing_mode = config->erratic_testing_mode;
- DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd,
+ DEBUG(10, ("sending fd %d to child %d\n", fsp_get_io_fd(fsp),
(int)state->child->pid));
/*
* domain socket. This should never block.
*/
written = write_fd(state->child->sockfd, &cmd, sizeof(cmd),
- fsp->fh->fd);
+ fsp_get_io_fd(fsp));
if (written == -1) {
err = errno;
cmd.cmd = FSYNC_CMD;
cmd.erratic_testing_mode = config->erratic_testing_mode;
- DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd,
+ DEBUG(10, ("sending fd %d to child %d\n", fsp_get_io_fd(fsp),
(int)state->child->pid));
/*
* domain socket. This should never block.
*/
written = write_fd(state->child->sockfd, &cmd, sizeof(cmd),
- fsp->fh->fd);
+ fsp_get_io_fd(fsp));
if (written == -1) {
err = errno;
return NULL;
}
- if (dirfsp->fh->fd != AT_FDCWD) {
- opd->dir_fd = dirfsp->fh->fd;
+ if (fsp_get_io_fd(dirfsp) != AT_FDCWD) {
+ opd->dir_fd = fsp_get_io_fd(dirfsp);
} else {
#if defined(O_DIRECTORY)
opd->dir_fd = open(".", O_RDONLY|O_DIRECTORY);
if (!aio_allow_open) {
/* aio opens turned off. */
- return openat(dirfsp->fh->fd,
+ return openat(fsp_get_io_fd(dirfsp),
smb_fname->base_name,
flags,
mode);
if (!(flags & O_CREAT)) {
/* Only creates matter. */
- return openat(dirfsp->fh->fd,
+ return openat(fsp_get_io_fd(dirfsp),
smb_fname->base_name,
flags,
mode);
if (!(flags & O_EXCL)) {
/* Only creates with O_EXCL matter. */
- return openat(dirfsp->fh->fd,
+ return openat(fsp_get_io_fd(dirfsp),
smb_fname->base_name,
flags,
mode);
/* Get the acl using fstatacl */
DEBUG(10,("Entering AIX sys_acl_get_fd\n"));
- DEBUG(10,("fd is %d\n",fsp->fh->fd));
+ DEBUG(10,("fd is %d\n",fsp_get_io_fd(fsp)));
file_acl = (struct acl *)SMB_MALLOC(BUFSIZ);
if(file_acl == NULL) {
memset(file_acl,0,BUFSIZ);
- rc = fstatacl(fsp->fh->fd,0,file_acl,BUFSIZ);
+ rc = fstatacl(fsp_get_io_fd(fsp),0,file_acl,BUFSIZ);
if( (rc == -1) && (errno == ENOSPC)) {
struct acl *new_acl = SMB_MALLOC(file_acl->acl_len + sizeof(struct acl));
if( new_acl == NULL) {
return NULL;
}
file_acl = new_acl;
- rc = fstatacl(fsp->fh->fd,0,file_acl,file_acl->acl_len + sizeof(struct acl));
+ rc = fstatacl(fsp_get_io_fd(fsp),0,file_acl,file_acl->acl_len + sizeof(struct acl));
if( rc == -1) {
DEBUG(0,("fstatacl returned %d with errno %d\n",rc,errno));
SAFE_FREE(file_acl);
if (!file_acl)
return -1;
- rc = fchacl(fsp->fh->fd,file_acl,file_acl->acl_len);
+ rc = fchacl(fsp_get_io_fd(fsp),file_acl,file_acl->acl_len);
DEBUG(10,("errno is %d\n",errno));
DEBUG(10,("return code is %d\n",rc));
SAFE_FREE(file_acl);
return -1;
rc = aclx_fput(
- fsp->fh->fd,
+ fsp_get_io_fd(fsp),
SET_ACL, /* set only the ACL, not mode bits */
acl_type_info,
acl_aixc,
}
ZERO_STRUCT(cr_args);
- cr_args.src_fd = src_fsp->fh->fd;
+ cr_args.src_fd = fsp_get_io_fd(src_fsp);
cr_args.src_offset = (uint64_t)src_off;
cr_args.dest_offset = (uint64_t)dest_off;
cr_args.src_length = (uint64_t)num;
- ret = ioctl(dest_fsp->fh->fd, BTRFS_IOC_CLONE_RANGE, &cr_args);
+ ret = ioctl(fsp_get_io_fd(dest_fsp), BTRFS_IOC_CLONE_RANGE, &cr_args);
if (ret < 0) {
/*
* BTRFS_IOC_CLONE_RANGE only supports 'sectorsize' aligned
(unsigned long long)cr_args.src_length,
(long long)cr_args.src_fd,
(unsigned long long)cr_args.src_offset,
- dest_fsp->fh->fd,
+ fsp_get_io_fd(dest_fsp),
(unsigned long long)cr_args.dest_offset));
subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
state,
NTSTATUS status;
DIR *dir = NULL;
- if ((fsp != NULL) && (fsp->fh->fd != -1)) {
- fd = fsp->fh->fd;
+ if ((fsp != NULL) && (fsp_get_io_fd(fsp) != -1)) {
+ fd = fsp_get_io_fd(fsp);
} else if (smb_fname != NULL) {
if (S_ISDIR(smb_fname->st.st_ex_mode)) {
dir = opendir(smb_fname->base_name);
int fd;
NTSTATUS status;
- if ((fsp == NULL) || (fsp->fh->fd == -1)) {
+ if ((fsp == NULL) || (fsp_get_io_fd(fsp) == -1)) {
status = NT_STATUS_INVALID_PARAMETER;
goto err_out;
}
- fd = fsp->fh->fd;
+ fd = fsp_get_io_fd(fsp);
ret = ioctl(fd, FS_IOC_GETFLAGS, &flags);
if (ret < 0) {
MODULE, (long long)g_readsz, (long long)*last,
fsp_str_dbg(fsp)));
- nread = sys_pread(fsp->fh->fd, g_readbuf, g_readsz, *last);
+ nread = sys_pread(fsp_get_io_fd(fsp), g_readbuf, g_readsz, *last);
if (nread < 0) {
*last = -1;
return False;
int result;
DBG_DEBUG("[CEPH] close(%p, %p)\n", handle, fsp);
- result = ceph_close(handle->data, fsp->fh->fd);
+ result = ceph_close(handle->data, fsp_get_io_fd(fsp));
DBG_DEBUG("[CEPH] close(...) = %d\n", result);
WRAP_RETURN(result);
DBG_DEBUG("[CEPH] pread(%p, %p, %p, %llu, %llu)\n", handle, fsp, data, llu(n), llu(offset));
- result = ceph_read(handle->data, fsp->fh->fd, data, n, offset);
+ result = ceph_read(handle->data, fsp_get_io_fd(fsp), data, n, offset);
DBG_DEBUG("[CEPH] pread(...) = %llu\n", llu(result));
WRAP_RETURN(result);
}
return NULL;
}
- ret = ceph_read(handle->data, fsp->fh->fd, data, n, offset);
+ ret = ceph_read(handle->data, fsp_get_io_fd(fsp), data, n, offset);
if (ret < 0) {
/* ceph returns -errno on error. */
tevent_req_error(req, -ret);
ssize_t result;
DBG_DEBUG("[CEPH] pwrite(%p, %p, %p, %llu, %llu)\n", handle, fsp, data, llu(n), llu(offset));
- result = ceph_write(handle->data, fsp->fh->fd, data, n, offset);
+ result = ceph_write(handle->data, fsp_get_io_fd(fsp), data, n, offset);
DBG_DEBUG("[CEPH] pwrite(...) = %llu\n", llu(result));
WRAP_RETURN(result);
}
return NULL;
}
- ret = ceph_write(handle->data, fsp->fh->fd, data, n, offset);
+ ret = ceph_write(handle->data, fsp_get_io_fd(fsp), data, n, offset);
if (ret < 0) {
/* ceph returns -errno on error. */
tevent_req_error(req, -ret);
off_t result = 0;
DBG_DEBUG("[CEPH] cephwrap_lseek\n");
- result = ceph_lseek(handle->data, fsp->fh->fd, offset, whence);
+ result = ceph_lseek(handle->data, fsp_get_io_fd(fsp), offset, whence);
WRAP_RETURN(result);
}
}
/* Make sync call. */
- ret = ceph_fsync(handle->data, fsp->fh->fd, false);
+ ret = ceph_fsync(handle->data, fsp_get_io_fd(fsp), false);
if (ret != 0) {
/* ceph_fsync returns -errno on error. */
int result = -1;
struct ceph_statx stx;
- DBG_DEBUG("[CEPH] fstat(%p, %d)\n", handle, fsp->fh->fd);
- result = ceph_fstatx(handle->data, fsp->fh->fd, &stx,
+ DBG_DEBUG("[CEPH] fstat(%p, %d)\n", handle, fsp_get_io_fd(fsp));
+ result = ceph_fstatx(handle->data, fsp_get_io_fd(fsp), &stx,
SAMBA_STATX_ATTR_MASK, 0);
DBG_DEBUG("[CEPH] fstat(...) = %d\n", result);
if (result < 0) {
int result;
DBG_DEBUG("[CEPH] fchmod(%p, %p, %d)\n", handle, fsp, mode);
- result = ceph_fchmod(handle->data, fsp->fh->fd, mode);
+ result = ceph_fchmod(handle->data, fsp_get_io_fd(fsp), mode);
DBG_DEBUG("[CEPH] fchmod(...) = %d\n", result);
WRAP_RETURN(result);
}
int result;
DBG_DEBUG("[CEPH] fchown(%p, %p, %d, %d)\n", handle, fsp, uid, gid);
- result = ceph_fchown(handle->data, fsp->fh->fd, uid, gid);
+ result = ceph_fchown(handle->data, fsp_get_io_fd(fsp), uid, gid);
DBG_DEBUG("[CEPH] fchown(...) = %d\n", result);
WRAP_RETURN(result);
}
/* Shrink - just ftruncate. */
if (pst->st_ex_size > len) {
- result = ceph_ftruncate(handle->data, fsp->fh->fd, len);
+ result = ceph_ftruncate(handle->data, fsp_get_io_fd(fsp), len);
WRAP_RETURN(result);
}
space_to_write = len - pst->st_ex_size;
- result = ceph_fallocate(handle->data, fsp->fh->fd, 0, pst->st_ex_size,
+ result = ceph_fallocate(handle->data, fsp_get_io_fd(fsp), 0, pst->st_ex_size,
space_to_write);
WRAP_RETURN(result);
}
return strict_allocate_ftruncate(handle, fsp, len);
}
- result = ceph_ftruncate(handle->data, fsp->fh->fd, len);
+ result = ceph_ftruncate(handle->data, fsp_get_io_fd(fsp), len);
WRAP_RETURN(result);
}
DBG_DEBUG("[CEPH] fallocate(%p, %p, %u, %llu, %llu\n",
handle, fsp, mode, llu(offset), llu(len));
/* unsupported mode flags are rejected by libcephfs */
- result = ceph_fallocate(handle->data, fsp->fh->fd, mode, offset, len);
+ result = ceph_fallocate(handle->data, fsp_get_io_fd(fsp), mode, offset, len);
DBG_DEBUG("[CEPH] fallocate(...) = %d\n", result);
WRAP_RETURN(result);
}
{
int ret;
DBG_DEBUG("[CEPH] fgetxattr(%p, %p, %s, %p, %llu)\n", handle, fsp, name, value, llu(size));
- ret = ceph_fgetxattr(handle->data, fsp->fh->fd, name, value, size);
+ ret = ceph_fgetxattr(handle->data, fsp_get_io_fd(fsp), name, value, size);
DBG_DEBUG("[CEPH] fgetxattr(...) = %d\n", ret);
if (ret < 0) {
WRAP_RETURN(ret);
int ret;
DBG_DEBUG("[CEPH] flistxattr(%p, %p, %p, %llu)\n",
handle, fsp, list, llu(size));
- ret = ceph_flistxattr(handle->data, fsp->fh->fd, list, size);
+ ret = ceph_flistxattr(handle->data, fsp_get_io_fd(fsp), list, size);
DBG_DEBUG("[CEPH] flistxattr(...) = %d\n", ret);
if (ret < 0) {
WRAP_RETURN(ret);
{
int ret;
DBG_DEBUG("[CEPH] fremovexattr(%p, %p, %s)\n", handle, fsp, name);
- ret = ceph_fremovexattr(handle->data, fsp->fh->fd, name);
+ ret = ceph_fremovexattr(handle->data, fsp_get_io_fd(fsp), name);
DBG_DEBUG("[CEPH] fremovexattr(...) = %d\n", ret);
WRAP_RETURN(ret);
}
{
int ret;
DBG_DEBUG("[CEPH] fsetxattr(%p, %p, %s, %p, %llu, %d)\n", handle, fsp, name, value, llu(size), flags);
- ret = ceph_fsetxattr(handle->data, fsp->fh->fd,
+ ret = ceph_fsetxattr(handle->data, fsp_get_io_fd(fsp),
name, value, size, flags);
DBG_DEBUG("[CEPH] fsetxattr(...) = %d\n", ret);
WRAP_RETURN(ret);
("%s: flushing %lu dirty bytes\n",
MODULE, (unsigned long)c->dbytes));
- return commit_do(c, fsp->fh->fd);
+ return commit_do(c, fsp_get_io_fd(fsp));
}
}
return 0;
c->dbytes += last_write; /* dirty bytes always counted */
if (c->dthresh && (c->dbytes > c->dthresh)) {
- return commit_do(c, fsp->fh->fd);
+ return commit_do(c, fsp_get_io_fd(fsp));
}
/* Return if we are not in EOF mode or if we have temporarily opted
/* This write hit or went past our cache the file size. */
if ((offset + last_write) >= c->eof) {
- if (commit_do(c, fsp->fh->fd) == -1) {
+ if (commit_do(c, fsp_get_io_fd(fsp)) == -1) {
return -1;
}
}
ret = symlinkat(msdfs_link,
- dirfsp->fh->fd,
+ fsp_get_io_fd(dirfsp),
smb_fname->base_name);
if (ret == 0) {
status = NT_STATUS_OK;
}
}
- referral_len = readlinkat(dirfsp->fh->fd,
+ referral_len = readlinkat(fsp_get_io_fd(dirfsp),
smb_fname->base_name,
link_target,
bufsize - 1);
DIR *result;
START_PROFILE(syscall_fdopendir);
- result = sys_fdopendir(fsp->fh->fd);
+ result = sys_fdopendir(fsp_get_io_fd(fsp));
END_PROFILE(syscall_fdopendir);
return result;
}
#if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
START_PROFILE_BYTES(syscall_pread, n);
- result = sys_pread_full(fsp->fh->fd, data, n, offset);
+ result = sys_pread_full(fsp_get_io_fd(fsp), data, n, offset);
END_PROFILE_BYTES(syscall_pread);
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be seeked (sought?) on. */
- result = sys_read(fsp->fh->fd, data, n);
+ result = sys_read(fsp_get_io_fd(fsp), data, n);
fsp->fh->pos = 0;
}
#if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
START_PROFILE_BYTES(syscall_pwrite, n);
- result = sys_pwrite_full(fsp->fh->fd, data, n, offset);
+ result = sys_pwrite_full(fsp_get_io_fd(fsp), data, n, offset);
END_PROFILE_BYTES(syscall_pwrite);
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be sought on. */
- result = sys_write(fsp->fh->fd, data, n);
+ result = sys_write(fsp_get_io_fd(fsp), data, n);
}
#else /* HAVE_PWRITE */
}
state->ret = -1;
- state->fd = fsp->fh->fd;
+ state->fd = fsp_get_io_fd(fsp);
state->buf = data;
state->count = n;
state->offset = offset;
}
state->ret = -1;
- state->fd = fsp->fh->fd;
+ state->fd = fsp_get_io_fd(fsp);
state->buf = data;
state->count = n;
state->offset = offset;
}
state->ret = -1;
- state->fd = fsp->fh->fd;
+ state->fd = fsp_get_io_fd(fsp);
SMBPROFILE_BYTES_ASYNC_START(syscall_asys_fsync, profile_p,
state->profile_bytes, 0);
START_PROFILE(syscall_lseek);
- result = lseek(fsp->fh->fd, offset, whence);
+ result = lseek(fsp_get_io_fd(fsp), offset, whence);
/*
* We want to maintain the fiction that we can seek
* on a fifo for file system purposes. This allows
ssize_t result;
START_PROFILE_BYTES(syscall_sendfile, n);
- result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n);
+ result = sys_sendfile(tofd, fsp_get_io_fd(fromfsp), hdr, offset, n);
END_PROFILE_BYTES(syscall_sendfile);
return result;
}
ssize_t result;
START_PROFILE_BYTES(syscall_recvfile, n);
- result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n);
+ result = sys_recvfile(fromfd, fsp_get_io_fd(tofsp), offset, n);
END_PROFILE_BYTES(syscall_recvfile);
return result;
}
START_PROFILE(syscall_fchmod);
#if defined(HAVE_FCHMOD)
- result = fchmod(fsp->fh->fd, mode);
+ result = fchmod(fsp_get_io_fd(fsp), mode);
#else
result = -1;
errno = ENOSYS;
int result;
START_PROFILE(syscall_fchown);
- result = fchown(fsp->fh->fd, uid, gid);
+ result = fchown(fsp_get_io_fd(fsp), uid, gid);
END_PROFILE(syscall_fchown);
return result;
#else
/* Shrink - just ftruncate. */
if (pst->st_ex_size > len)
- return ftruncate(fsp->fh->fd, len);
+ return ftruncate(fsp_get_io_fd(fsp), len);
space_to_write = len - pst->st_ex_size;
expansion and some that don't! On Linux fat can't do
ftruncate extend but ext2 can. */
- result = ftruncate(fsp->fh->fd, len);
+ result = ftruncate(fsp_get_io_fd(fsp), len);
/* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
extend a file with ftruncate. Provide alternate implementation
START_PROFILE(syscall_fallocate);
if (mode == 0) {
- result = sys_posix_fallocate(fsp->fh->fd, offset, len);
+ result = sys_posix_fallocate(fsp_get_io_fd(fsp), offset, len);
/*
* posix_fallocate returns 0 on success, errno on error
* and doesn't set errno. Make it behave like fallocate()
}
} else {
/* sys_fallocate handles filtering of unsupported mode flags */
- result = sys_fallocate(fsp->fh->fd, mode, offset, len);
+ result = sys_fallocate(fsp_get_io_fd(fsp), mode, offset, len);
}
END_PROFILE(syscall_fallocate);
return result;
op = map_process_lock_to_ofd_lock(op);
}
- result = fcntl_lock(fsp->fh->fd, op, offset, count, type);
+ result = fcntl_lock(fsp_get_io_fd(fsp), op, offset, count, type);
END_PROFILE(syscall_fcntl_lock);
return result;
}
uint32_t share_access, uint32_t access_mask)
{
START_PROFILE(syscall_kernel_flock);
- kernel_flock(fsp->fh->fd, share_access, access_mask);
+ kernel_flock(fsp_get_io_fd(fsp), share_access, access_mask);
END_PROFILE(syscall_kernel_flock);
return 0;
}
case F_SET_FILE_RW_HINT:
#endif
argp = va_arg(dup_cmd_arg, void *);
- result = sys_fcntl_ptr(fsp->fh->fd, cmd, argp);
+ result = sys_fcntl_ptr(fsp_get_io_fd(fsp), cmd, argp);
break;
default:
val = va_arg(dup_cmd_arg, int);
- result = sys_fcntl_int(fsp->fh->fd, cmd, val);
+ result = sys_fcntl_int(fsp_get_io_fd(fsp), cmd, val);
}
va_end(dup_cmd_arg);
op = map_process_lock_to_ofd_lock(op);
}
- result = fcntl_getlock(fsp->fh->fd, op, poffset, pcount, ptype, ppid);
+ result = fcntl_getlock(fsp_get_io_fd(fsp), op, poffset, pcount, ptype, ppid);
END_PROFILE(syscall_fcntl_getlock);
return result;
}
START_PROFILE(syscall_linux_setlease);
#ifdef HAVE_KERNEL_OPLOCKS_LINUX
- result = linux_setlease(fsp->fh->fd, leasetype);
+ result = linux_setlease(fsp_get_io_fd(fsp), leasetype);
#else
errno = ENOSYS;
#endif
void *value,
size_t size)
{
- return fgetxattr(fsp->fh->fd, name, value, size);
+ return fgetxattr(fsp_get_io_fd(fsp), name, value, size);
}
static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle,
static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
{
- return flistxattr(fsp->fh->fd, list, size);
+ return flistxattr(fsp_get_io_fd(fsp), list, size);
}
static int vfswrap_removexattr(struct vfs_handle_struct *handle,
static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
{
- return fremovexattr(fsp->fh->fd, name);
+ return fremovexattr(fsp_get_io_fd(fsp), name);
}
static int vfswrap_setxattr(struct vfs_handle_struct *handle,
static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
{
- return fsetxattr(fsp->fh->fd, name, value, size, flags);
+ return fsetxattr(fsp_get_io_fd(fsp), name, value, size, flags);
}
static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
access_mask & FILE_WRITE_DATA ? "WRITE" : "-",
share_mode);
- if (fsp->fh->fd == -1) {
+ if (fsp_get_io_fd(fsp) == -1) {
return NT_STATUS_OK;
}
}
if (ret < 0) {
DEBUG(0, ("glfs_fstat(%d) failed: %s\n",
- fsp->fh->fd, strerror(errno)));
+ fsp_get_io_fd(fsp), strerror(errno)));
}
END_PROFILE(syscall_fstat);
DBG_DEBUG("access_mask=0x%x, allow=0x%x, share_access=0x%x, "
"deny=0x%x\n", access_mask, allow, share_access, deny);
- result = gpfswrap_set_share(fsp->fh->fd, allow, deny);
+ result = gpfswrap_set_share(fsp_get_io_fd(fsp), allow, deny);
if (result == 0) {
return 0;
}
return 0;
}
- kernel_flock(fsp->fh->fd, share_access, access_mask);
+ kernel_flock(fsp_get_io_fd(fsp), share_access, access_mask);
ret = set_gpfs_sharemode(fsp, access_mask, share_access);
* close gets deferred due to outstanding POSIX locks
* (see fd_close_posix)
*/
- int ret = gpfswrap_set_share(fsp->fh->fd, 0, 0);
+ int ret = gpfswrap_set_share(fsp_get_io_fd(fsp), 0, 0);
if (ret != 0) {
DBG_ERR("Clearing GPFS sharemode on close failed for "
" %s/%s: %s\n",
struct gpfs_config_data,
return -1);
- ret = linux_set_lease_sighandler(fsp->fh->fd);
+ ret = linux_set_lease_sighandler(fsp_get_io_fd(fsp));
if (ret == -1) {
goto failure;
}
* correct delivery of lease-break signals.
*/
become_root();
- ret = gpfswrap_set_lease(fsp->fh->fd, gpfs_lease_type);
+ ret = gpfswrap_set_lease(fsp_get_io_fd(fsp), gpfs_lease_type);
if (ret < 0) {
saved_errno = errno;
}
}
attrs.winAttrs = vfs_gpfs_dosmode_to_winattrs(dosmode);
- ret = gpfswrap_set_winattrs(fsp->fh->fd,
+ ret = gpfswrap_set_winattrs(fsp_get_io_fd(fsp),
GPFS_WINATTR_SET_ATTRS, &attrs);
if (ret == -1 && errno == ENOSYS) {
return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
}
- result = gpfswrap_ftruncate(fsp->fh->fd, len);
+ result = gpfswrap_ftruncate(fsp_get_io_fd(fsp), len);
if ((result == -1) && (errno == ENOSYS)) {
return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
}
static void vfs_io_uring_pread_submit(struct vfs_io_uring_pread_state *state)
{
io_uring_prep_readv(&state->ur.sqe,
- state->fsp->fh->fd,
+ fsp_get_io_fd(state->fsp),
&state->iov, 1,
state->offset);
vfs_io_uring_request_submit(&state->ur);
static void vfs_io_uring_pwrite_submit(struct vfs_io_uring_pwrite_state *state)
{
io_uring_prep_writev(&state->ur.sqe,
- state->fsp->fh->fd,
+ fsp_get_io_fd(state->fsp),
&state->iov, 1,
state->offset);
vfs_io_uring_request_submit(&state->ur);
SMBPROFILE_BYTES_ASYNC_SET_IDLE(state->ur.profile_bytes);
io_uring_prep_fsync(&state->ur.sqe,
- fsp->fh->fd,
+ fsp_get_io_fd(fsp),
0); /* fsync_flags */
vfs_io_uring_request_submit(&state->ur);
restored_mode = existing_mode | expected_mode;
- if (fsp->fh->fd != -1) {
+ if (fsp_get_io_fd(fsp) != -1) {
ret = SMB_VFS_NEXT_FCHMOD(handle,
fsp,
restored_mode);
SMB_VFS_HANDLE_GET_DATA(handle, db, struct tdb_wrap, return -1);
- return posix_eadb_getattr(db, fsp->fsp_name->base_name, fsp->fh->fd, name, value, size);
+ return posix_eadb_getattr(db, fsp->fsp_name->base_name, fsp_get_io_fd(fsp), name, value, size);
}
/*
SMB_VFS_HANDLE_GET_DATA(handle, db, struct tdb_wrap, return -1);
- return posix_eadb_setattr(db, fsp->fsp_name->base_name, fsp->fh->fd, name, value, size, flags);
+ return posix_eadb_setattr(db, fsp->fsp_name->base_name, fsp_get_io_fd(fsp), name, value, size, flags);
}
/*
SMB_VFS_HANDLE_GET_DATA(handle, db, struct tdb_wrap, return -1);
- return posix_eadb_listattr(db, fsp->fsp_name->base_name, fsp->fh->fd, list, size);
+ return posix_eadb_listattr(db, fsp->fsp_name->base_name, fsp_get_io_fd(fsp), list, size);
}
/*
SMB_VFS_HANDLE_GET_DATA(handle, db, struct tdb_wrap, return -1);
- return posix_eadb_removeattr(db, fsp->fsp_name->base_name, fsp->fh->fd, name);
+ return posix_eadb_removeattr(db, fsp->fsp_name->base_name, fsp_get_io_fd(fsp), name);
}
/*
files_struct *fsp, TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
- acl_t acl = acl_get_fd(fsp->fh->fd);
+ acl_t acl = acl_get_fd(fsp_get_io_fd(fsp));
if (acl == NULL) {
return NULL;
if (acl == NULL) {
return -1;
}
- res = acl_set_fd(fsp->fh->fd, acl);
+ res = acl_set_fd(fsp_get_io_fd(fsp), acl);
acl_free(acl);
return res;
}
/* Maintain the allocated space even in the face of truncates. */
if ((psize = VFS_FETCH_FSP_EXTENSION(handle, fsp))) {
- preallocate_space(fsp->fh->fd, *psize);
+ preallocate_space(fsp_get_io_fd(fsp), *psize);
}
return ret;
if ( offset % rhd->off_bound == 0) {
#if defined(HAVE_LINUX_READAHEAD)
- int err = readahead(fromfsp->fh->fd, offset, (size_t)rhd->len);
+ int err = readahead(fsp_get_io_fd(fromfsp), offset, (size_t)rhd->len);
DEBUG(10,("readahead_sendfile: readahead on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fromfsp->fh->fd,
+ (unsigned int)fsp_get_io_fd(fromfsp),
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
#elif defined(HAVE_POSIX_FADVISE)
- int err = posix_fadvise(fromfsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+ int err = posix_fadvise(fsp_get_io_fd(fromfsp), offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fromfsp->fh->fd,
+ (unsigned int)fsp_get_io_fd(fromfsp),
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
if ( offset % rhd->off_bound == 0) {
#if defined(HAVE_LINUX_READAHEAD)
- int err = readahead(fsp->fh->fd, offset, (size_t)rhd->len);
+ int err = readahead(fsp_get_io_fd(fsp), offset, (size_t)rhd->len);
DEBUG(10,("readahead_pread: readahead on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fsp->fh->fd,
+ (unsigned int)fsp_get_io_fd(fsp),
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
#elif defined(HAVE_POSIX_FADVISE)
- int err = posix_fadvise(fsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+ int err = posix_fadvise(fsp_get_io_fd(fsp), offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
DEBUG(10,("readahead_pread: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fsp->fh->fd,
+ (unsigned int)fsp_get_io_fd(fsp),
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
DEBUG(10, ("entering solarisacl_sys_acl_get_fd.\n"));
- if (!solaris_acl_get_fd(fsp->fh->fd, &solaris_acl, &count)) {
+ if (!solaris_acl_get_fd(fsp_get_io_fd(fsp), &solaris_acl, &count)) {
goto done;
}
/*
strerror(errno)));
goto done;
}
- if (!solaris_acl_get_fd(fsp->fh->fd, &default_acl, &default_count)) {
+ if (!solaris_acl_get_fd(fsp_get_io_fd(fsp), &default_acl, &default_count)) {
DEBUG(10, ("error getting (default) acl from fd\n"));
goto done;
}
goto done;
}
- ret = facl(fsp->fh->fd, SETACL, count, solaris_acl);
+ ret = facl(fsp_get_io_fd(fsp), SETACL, count, solaris_acl);
if (ret != 0) {
DEBUG(10, ("call of facl failed (%s).\n", strerror(errno)));
}
if (fsp->fsp_flags.can_write && config->onclose) {
/* ideally we'd only do this if we have written some
data, but there is no flag for that in fsp yet. */
- fsync(fsp->fh->fd);
+ fsync(fsp_get_io_fd(fsp));
}
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
TALLOC_CTX *mem_ctx)
{
struct smb_acl_t *result;
- acl_t tru64_acl = acl_get_fd(fsp->fh->fd, ACL_TYPE_ACCESS);
+ acl_t tru64_acl = acl_get_fd(fsp_get_io_fd(fsp), ACL_TYPE_ACCESS);
if (tru64_acl == NULL) {
return NULL;
if (tru64_acl == NULL) {
return -1;
}
- res = acl_set_fd(fsp->fh->fd, ACL_TYPE_ACCESS, tru64_acl);
+ res = acl_set_fd(fsp_get_io_fd(fsp), ACL_TYPE_ACCESS, tru64_acl);
acl_free(tru64_acl);
return res;
DEBUG(10, ("In vxfs_fset_xattr\n"));
- ret = vxfs_setxattr_fd(fsp->fh->fd, name, value, size, flags);
+ ret = vxfs_setxattr_fd(fsp_get_io_fd(fsp), name, value, size, flags);
if ((ret == 0) ||
((ret == -1) && (errno != ENOTSUP) && (errno != ENOSYS))) {
SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
DEBUG(10, ("In vxfs_fget_xattr\n"));
- ret = vxfs_getxattr_fd(fsp->fh->fd, name, value, size);
+ ret = vxfs_getxattr_fd(fsp_get_io_fd(fsp), name, value, size);
if ((ret != -1) || ((errno != ENOTSUP) &&
(errno != ENOSYS) && (errno != ENODATA))) {
return ret;
old_errno = errno;
/* Remove with new way */
- ret_new = vxfs_removexattr_fd(fsp->fh->fd, name);
+ ret_new = vxfs_removexattr_fd(fsp_get_io_fd(fsp), name);
/*
* If both fail, return failuer else return whichever succeeded
*/
{
ssize_t result;
- result = vxfs_listxattr_fd(fsp->fh->fd, list, size);
+ result = vxfs_listxattr_fd(fsp_get_io_fd(fsp), list, size);
if (result >= 0 || ((errno != ENOTSUP) && (errno != ENOSYS))) {
return result;
}
DBG_DEBUG("Entered function\n");
if (!(dosmode & FILE_ATTRIBUTE_READONLY)) {
- ret = vxfs_checkwxattr_fd(fsp->fh->fd);
+ ret = vxfs_checkwxattr_fd(fsp_get_io_fd(fsp));
if (ret == -1) {
DBG_DEBUG("ret:%d\n", ret);
if ((errno != EOPNOTSUPP) && (errno != ENOENT)) {
}
}
if (dosmode & FILE_ATTRIBUTE_READONLY) {
- ret = vxfs_setwxattr_fd(fsp->fh->fd);
+ ret = vxfs_setwxattr_fd(fsp_get_io_fd(fsp));
DBG_DEBUG("ret:%d\n", ret);
if (ret == -1) {
if ((errno != EOPNOTSUPP) && (errno != EINVAL)) {
err = SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, fsp, dosmode);
if (!NT_STATUS_IS_OK(err)) {
if (attrset) {
- ret = vxfs_clearwxattr_fd(fsp->fh->fd);
+ ret = vxfs_clearwxattr_fd(fsp_get_io_fd(fsp));
DBG_DEBUG("ret:%d\n", ret);
if ((ret == -1) && (errno != ENOENT)) {
return map_nt_error_from_unix(errno);
* spoolss may have deleted it to signal someone has killed
* the job through it's interface */
- if (sys_fstat(fsp->fh->fd, &st, false) != 0) {
+ if (sys_fstat(fsp_get_io_fd(fsp), &st, false) != 0) {
ret = errno;
DEBUG(3, ("printfile_offset: sys_fstat failed on %s (%s)\n",
fsp_str_dbg(fsp), strerror(ret)));
/* check if the file is unlinked, this will signal spoolss has
* killed it, just return an error and close the file */
if (st.st_ex_nlink == 0) {
- close(fsp->fh->fd);
+ close(fsp_get_io_fd(fsp));
return EBADF;
}
offset = (st.st_ex_size & 0xffffffff00000000LL) + offset;
}
- n = write_data_at_offset(fsp->fh->fd, data, size, offset);
+ n = write_data_at_offset(fsp_get_io_fd(fsp), data, size, offset);
if (n == -1) {
ret = errno;
print_spool_terminate(fsp->conn, fsp->print_file);
* _spoolss_EndDocPrinter() will take
* care of deleting it for us.
*/
- ret = ftruncate(fsp->fh->fd, 0);
+ ret = ftruncate(fsp_get_io_fd(fsp), 0);
if (ret == -1) {
DBG_ERR("ftruncate failed: %s\n", strerror(errno));
}
for(fsp = file_find_di_first(conn->sconn, file_id);
fsp;
fsp = file_find_di_next(fsp)) {
- if (fsp->fh->fd != -1) {
+ if (fsp_get_io_fd(fsp) != -1) {
*ret_fsp = fsp;
return NT_STATUS_OK;
}
return NT_STATUS_NOT_SUPPORTED;
}
- if (fsp->fh->fd == -1) {
+ if (fsp_get_io_fd(fsp) == -1) {
return NT_STATUS_NOT_SUPPORTED;
}
NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through)
{
- if (fsp->fh->fd == -1)
+ if (fsp_get_io_fd(fsp) == -1)
return NT_STATUS_INVALID_HANDLE;
if (lp_strict_sync(SNUM(conn)) &&
}
}
- if (fsp->fh->fd != -1 && lp_kernel_share_modes(SNUM(conn))) {
+ if (!fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1 &&
+ lp_kernel_share_modes(SNUM(conn)))
+ {
int ret_flock;
/*
* Beware: streams implementing VFS modules may
DBG_NOTICE("Refused oplock on file %s, "
"fd = %d, file_id = %s. (%s)\n",
fsp_str_dbg(fsp),
- fsp->fh->fd,
+ fsp_get_io_fd(fsp),
file_id_str_buf(fsp->file_id, &idbuf),
strerror(errno));
return False;
* Check and print out the current kernel
* oplock state of this file.
*/
- int state = fcntl(fsp->fh->fd, F_GETLEASE, 0);
+ int state = fcntl(fsp_get_io_fd(fsp), F_GETLEASE, 0);
dbgtext("linux_release_kernel_oplock: file %s, file_id = %s "
"gen_id = %"PRIu64" has kernel oplock state "
"of %x.\n",
* Finally apply it to the file or directory.
*/
- if (default_ace || fsp->fsp_flags.is_directory || fsp->fh->fd == -1) {
+ if (default_ace || fsp->fsp_flags.is_directory || fsp_get_io_fd(fsp) == -1) {
if (SMB_VFS_SYS_ACL_SET_FILE(conn, fsp->fsp_name,
the_acl_type, the_acl) == -1) {
/*
int ret;
/* This ensures that we also consider the default ACL */
- if (fsp->fsp_flags.is_directory || fsp->fh->fd == -1) {
+ if (fsp->fsp_flags.is_directory || fsp_get_io_fd(fsp) == -1) {
return posix_sys_acl_blob_get_file(handle,
fsp->fsp_name,
mem_ctx,
DEBUG(2, ("reply_mknew: file %s\n", smb_fname_str_dbg(smb_fname)));
DEBUG(3, ("reply_mknew %s fd=%d dmode=0x%x\n",
- smb_fname_str_dbg(smb_fname), fsp->fh->fd,
+ smb_fname_str_dbg(smb_fname), fsp_get_io_fd(fsp),
(unsigned int)fattr));
out:
DEBUG(2, ("reply_ctemp: created temp file %s\n", fsp_str_dbg(fsp)));
DEBUG(3, ("reply_ctemp %s fd=%d umode=0%o\n", fsp_str_dbg(fsp),
- fsp->fh->fd, (unsigned int)smb_fname->st.st_ex_mode));
+ fsp_get_io_fd(fsp), (unsigned int)smb_fname->st.st_ex_mode));
out:
TALLOC_FREE(smb_fname);
TALLOC_FREE(wire_name);
conn != fsp->conn ||
req->vuid != fsp->vuid ||
fsp->fsp_flags.is_directory ||
- fsp->fh->fd == -1)
+ fsp_get_io_fd(fsp) == -1)
{
/*
* fsp could be NULL here so use the value from the packet. JRA.
if (conn != fsp->conn) {
return NULL;
}
- if (fsp->fh->fd == -1) {
+ if (fsp_get_io_fd(fsp) == -1) {
return NULL;
}
sync_file(conn, fsp, True /* write through */);
};
DBG_NOTICE("lock fd=%d %s offset=%"PRIu64" count=%"PRIu64"\n",
- fsp->fh->fd,
+ fsp_get_io_fd(fsp),
fsp_fnum_dbg(fsp),
lck->offset,
lck->count);
}
DBG_NOTICE("unlock fd=%d %s offset=%"PRIu64" count=%"PRIu64"\n",
- fsp->fh->fd,
+ fsp_get_io_fd(fsp),
fsp_fnum_dbg(fsp),
lck.offset,
lck.count);
SSVAL(req->outbuf,smb_vwv0,fsp->fnum);
DEBUG(3,("openprint fd=%d %s\n",
- fsp->fh->fd, fsp_fnum_dbg(fsp)));
+ fsp_get_io_fd(fsp), fsp_fnum_dbg(fsp)));
END_PROFILE(SMBsplopen);
return;
}
DEBUG(3,("printclose fd=%d %s\n",
- fsp->fh->fd, fsp_fnum_dbg(fsp)));
+ fsp_get_io_fd(fsp), fsp_fnum_dbg(fsp)));
status = close_file(req, fsp, NORMAL_CLOSE);
}
}
- if (fsp->fh->fd == -1) {
+ if (fsp_get_io_fd(fsp) == -1) {
tevent_req_nterror(req, NT_STATUS_INVALID_HANDLE);
return tevent_req_post(req, ev);
}
return NT_STATUS_NO_MEMORY;
}
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp && !fsp->fsp_flags.is_pathref && fsp_get_io_fd(fsp) != -1) {
sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size);
} else {
sizeret = SMB_VFS_GETXATTR(conn, smb_fname,
return NT_STATUS_OK;
}
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp && !fsp->fsp_flags.is_pathref && fsp_get_io_fd(fsp) != -1) {
sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist,
ea_namelist_size);
} else {
}
to_free = ea_namelist;
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist,
ea_namelist_size);
} else {
if (ea_list->ea.value.length == 0) {
/* Remove the attribute. */
- if (fsp && (fsp->fh->fd != -1)) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
DEBUG(10,("set_ea: deleting ea name %s on "
"file %s by file descriptor.\n",
unix_ea_name, fsp_str_dbg(fsp)));
}
#endif
} else {
- if (fsp && (fsp->fh->fd != -1)) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
DEBUG(10,("set_ea: setting ea name %s on file "
"%s by file descriptor.\n",
unix_ea_name, fsp_str_dbg(fsp)));
enum brl_type lock_type;
/* We need an open file with a real fd for this. */
- if (!fsp || fsp->fh->fd == -1) {
+ if (fsp == NULL ||
+ fsp->fsp_flags.is_pathref ||
+ fsp_get_io_fd(fsp) == -1)
+ {
return NT_STATUS_INVALID_LEVEL;
}
case SMB_QUERY_POSIX_LOCK:
{
- if (fsp == NULL || fsp->fh->fd == -1) {
+ if (fsp == NULL ||
+ fsp->fsp_flags.is_pathref ||
+ fsp_get_io_fd(fsp) == -1)
+ {
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
return;
}
DEBUG(10,("smb_set_file_size: file %s : setting new size to %.0f\n",
smb_fname_str_dbg(smb_fname), (double)size));
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
/* Handle based call. */
if (!(fsp->access_mask & FILE_WRITE_DATA)) {
return NT_STATUS_ACCESS_DENIED;
NTSTATUS status = NT_STATUS_OK;
- if (fsp == NULL || fsp->fh->fd == -1) {
+ if (fsp == NULL ||
+ fsp->fsp_flags.is_pathref ||
+ fsp_get_io_fd(fsp) == -1)
+ {
return NT_STATUS_INVALID_HANDLE;
}
"allocation size to %.0f\n", smb_fname_str_dbg(smb_fname),
(double)allocation_size));
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
/* Open file handle. */
if (!(fsp->access_mask & FILE_WRITE_DATA)) {
return NT_STATUS_ACCESS_DENIED;
"setting mode 0%o for file %s\n",
(unsigned int)unixmode,
smb_fname_str_dbg(smb_fname)));
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
ret = SMB_VFS_FCHMOD(fsp, unixmode);
} else {
ret = SMB_VFS_CHMOD(conn, smb_fname, unixmode);
(unsigned int)set_owner,
smb_fname_str_dbg(smb_fname)));
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
ret = SMB_VFS_FCHOWN(fsp, set_owner, (gid_t)-1);
} else {
/*
"changing group %u for file %s\n",
(unsigned int)set_grp,
smb_fname_str_dbg(smb_fname)));
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
ret = SMB_VFS_FCHOWN(fsp, (uid_t)-1, set_grp);
} else {
/*
return NT_STATUS_INVALID_PARAMETER;
}
- if (fsp && fsp->fh->fd != -1) {
+ if (fsp &&
+ !fsp->fsp_flags.is_pathref &&
+ fsp_get_io_fd(fsp) != -1)
+ {
/* XXX: we should be using SMB_VFS_FCHFLAGS here. */
return NT_STATUS_NOT_SUPPORTED;
} else {
LEASES_UTIL
NDR_OPEN_FILES
FNAME_UTIL
+ fd_handle
''')
bld.SAMBA3_SUBSYSTEM('LEASES_DB',