Lines 2721-2727
Link Here
|
2721 |
|
2721 |
|
2722 |
static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) |
2722 |
static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) |
2723 |
{ |
2723 |
{ |
2724 |
int result; |
2724 |
int result, fd, real_fd; |
2725 |
|
2725 |
|
2726 |
START_PROFILE(syscall_fchmod); |
2726 |
START_PROFILE(syscall_fchmod); |
2727 |
|
2727 |
|
Lines 2731-2738
Link Here
|
2731 |
return result; |
2731 |
return result; |
2732 |
} |
2732 |
} |
2733 |
|
2733 |
|
|
|
2734 |
fd = fsp_get_pathref_fd(fsp); |
2735 |
|
2734 |
if (fsp->fsp_flags.have_proc_fds) { |
2736 |
if (fsp->fsp_flags.have_proc_fds) { |
2735 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
2736 |
const char *p = NULL; |
2737 |
const char *p = NULL; |
2737 |
char buf[PATH_MAX]; |
2738 |
char buf[PATH_MAX]; |
2738 |
|
2739 |
|
Lines 2746-2751
Link Here
|
2746 |
return result; |
2747 |
return result; |
2747 |
} |
2748 |
} |
2748 |
|
2749 |
|
|
|
2750 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
2751 |
int saved_errno; |
2752 |
|
2753 |
result = fchmod(real_fd, mode); |
2754 |
saved_errno = errno; |
2755 |
close(real_fd); |
2756 |
errno = saved_errno; |
2757 |
END_PROFILE(syscall_fchmod); |
2758 |
return result; |
2759 |
} |
2760 |
|
2749 |
/* |
2761 |
/* |
2750 |
* This is no longer a handle based call. |
2762 |
* This is no longer a handle based call. |
2751 |
*/ |
2763 |
*/ |
Lines 2758-2764
Link Here
|
2758 |
static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) |
2770 |
static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) |
2759 |
{ |
2771 |
{ |
2760 |
#ifdef HAVE_FCHOWN |
2772 |
#ifdef HAVE_FCHOWN |
2761 |
int result; |
2773 |
int result, fd, real_fd; |
2762 |
|
2774 |
|
2763 |
START_PROFILE(syscall_fchown); |
2775 |
START_PROFILE(syscall_fchown); |
2764 |
if (!fsp->fsp_flags.is_pathref) { |
2776 |
if (!fsp->fsp_flags.is_pathref) { |
Lines 2767-2774
Link Here
|
2767 |
return result; |
2779 |
return result; |
2768 |
} |
2780 |
} |
2769 |
|
2781 |
|
|
|
2782 |
fd = fsp_get_pathref_fd(fsp); |
2783 |
|
2770 |
if (fsp->fsp_flags.have_proc_fds) { |
2784 |
if (fsp->fsp_flags.have_proc_fds) { |
2771 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
2772 |
const char *p = NULL; |
2785 |
const char *p = NULL; |
2773 |
char buf[PATH_MAX]; |
2786 |
char buf[PATH_MAX]; |
2774 |
|
2787 |
|
Lines 2782-2787
Link Here
|
2782 |
return result; |
2795 |
return result; |
2783 |
} |
2796 |
} |
2784 |
|
2797 |
|
|
|
2798 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
2799 |
int saved_errno; |
2800 |
|
2801 |
result = fchown(real_fd, uid, gid); |
2802 |
saved_errno = errno; |
2803 |
close(real_fd); |
2804 |
errno = saved_errno; |
2805 |
END_PROFILE(syscall_fchown); |
2806 |
return result; |
2807 |
} |
2808 |
|
2785 |
/* |
2809 |
/* |
2786 |
* This is no longer a handle based call. |
2810 |
* This is no longer a handle based call. |
2787 |
*/ |
2811 |
*/ |
Lines 2855-2861
Link Here
|
2855 |
files_struct *fsp, |
2879 |
files_struct *fsp, |
2856 |
struct smb_file_time *ft) |
2880 |
struct smb_file_time *ft) |
2857 |
{ |
2881 |
{ |
2858 |
int result = -1; |
2882 |
int result = -1, fd, real_fd; |
2859 |
struct timespec ts[2]; |
2883 |
struct timespec ts[2]; |
2860 |
struct timespec *times = NULL; |
2884 |
struct timespec *times = NULL; |
2861 |
|
2885 |
|
Lines 2900-2907
Link Here
|
2900 |
goto out; |
2924 |
goto out; |
2901 |
} |
2925 |
} |
2902 |
|
2926 |
|
|
|
2927 |
fd = fsp_get_pathref_fd(fsp); |
2928 |
|
2903 |
if (fsp->fsp_flags.have_proc_fds) { |
2929 |
if (fsp->fsp_flags.have_proc_fds) { |
2904 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
2905 |
const char *p = NULL; |
2930 |
const char *p = NULL; |
2906 |
char buf[PATH_MAX]; |
2931 |
char buf[PATH_MAX]; |
2907 |
|
2932 |
|
Lines 2919-2924
Link Here
|
2919 |
goto out; |
2944 |
goto out; |
2920 |
} |
2945 |
} |
2921 |
|
2946 |
|
|
|
2947 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
2948 |
int saved_errno; |
2949 |
|
2950 |
result = futimens(real_fd, times); |
2951 |
saved_errno = errno; |
2952 |
close(real_fd); |
2953 |
errno = saved_errno; |
2954 |
goto out; |
2955 |
} |
2956 |
|
2922 |
/* |
2957 |
/* |
2923 |
* The fd is a pathref (opened with O_PATH) and there isn't fd to |
2958 |
* The fd is a pathref (opened with O_PATH) and there isn't fd to |
2924 |
* path translation mechanism. Fallback to path based call. |
2959 |
* path translation mechanism. Fallback to path based call. |
Lines 3322-3327
Link Here
|
3322 |
{ |
3357 |
{ |
3323 |
#ifdef HAVE_FCHFLAGS |
3358 |
#ifdef HAVE_FCHFLAGS |
3324 |
int fd = fsp_get_pathref_fd(fsp); |
3359 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
3360 |
int real_fd; |
3325 |
|
3361 |
|
3326 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3362 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3327 |
|
3363 |
|
Lines 3341-3346
Link Here
|
3341 |
return chflags(p, flags); |
3377 |
return chflags(p, flags); |
3342 |
} |
3378 |
} |
3343 |
|
3379 |
|
|
|
3380 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
3381 |
int saved_errno, result; |
3382 |
|
3383 |
result = fchflags(real_fd, flags); |
3384 |
saved_errno = errno; |
3385 |
close(real_fd); |
3386 |
errno = saved_errno; |
3387 |
return result; |
3388 |
} |
3389 |
|
3344 |
/* |
3390 |
/* |
3345 |
* This is no longer a handle based call. |
3391 |
* This is no longer a handle based call. |
3346 |
*/ |
3392 |
*/ |
Lines 3569-3574
Link Here
|
3569 |
size_t size) |
3615 |
size_t size) |
3570 |
{ |
3616 |
{ |
3571 |
int fd = fsp_get_pathref_fd(fsp); |
3617 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
3618 |
int real_fd; |
3572 |
|
3619 |
|
3573 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3620 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3574 |
|
3621 |
|
Lines 3588-3593
Link Here
|
3588 |
return getxattr(p, name, value, size); |
3635 |
return getxattr(p, name, value, size); |
3589 |
} |
3636 |
} |
3590 |
|
3637 |
|
|
|
3638 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
3639 |
int saved_errno, result; |
3640 |
|
3641 |
result = fgetxattr(real_fd, name, value, size); |
3642 |
saved_errno = errno; |
3643 |
close(real_fd); |
3644 |
errno = saved_errno; |
3645 |
return result; |
3646 |
} |
3647 |
|
3591 |
/* |
3648 |
/* |
3592 |
* This is no longer a handle based call. |
3649 |
* This is no longer a handle based call. |
3593 |
*/ |
3650 |
*/ |
Lines 3895-3900
Link Here
|
3895 |
static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) |
3952 |
static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) |
3896 |
{ |
3953 |
{ |
3897 |
int fd = fsp_get_pathref_fd(fsp); |
3954 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
3955 |
int real_fd; |
3898 |
|
3956 |
|
3899 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3957 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3900 |
|
3958 |
|
Lines 3914-3919
Link Here
|
3914 |
return listxattr(p, list, size); |
3972 |
return listxattr(p, list, size); |
3915 |
} |
3973 |
} |
3916 |
|
3974 |
|
|
|
3975 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
3976 |
int saved_errno, result; |
3977 |
|
3978 |
result = flistxattr(real_fd, list, size); |
3979 |
saved_errno = errno; |
3980 |
close(real_fd); |
3981 |
errno = saved_errno; |
3982 |
return result; |
3983 |
} |
3984 |
|
3917 |
/* |
3985 |
/* |
3918 |
* This is no longer a handle based call. |
3986 |
* This is no longer a handle based call. |
3919 |
*/ |
3987 |
*/ |
Lines 3923-3928
Link Here
|
3923 |
static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name) |
3991 |
static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name) |
3924 |
{ |
3992 |
{ |
3925 |
int fd = fsp_get_pathref_fd(fsp); |
3993 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
3994 |
int real_fd; |
3926 |
|
3995 |
|
3927 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3996 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3928 |
|
3997 |
|
Lines 3942-3947
Link Here
|
3942 |
return removexattr(p, name); |
4011 |
return removexattr(p, name); |
3943 |
} |
4012 |
} |
3944 |
|
4013 |
|
|
|
4014 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
4015 |
int saved_errno, result; |
4016 |
|
4017 |
result = fremovexattr(real_fd, name); |
4018 |
saved_errno = errno; |
4019 |
close(real_fd); |
4020 |
errno = saved_errno; |
4021 |
return result; |
4022 |
} |
4023 |
|
3945 |
/* |
4024 |
/* |
3946 |
* This is no longer a handle based call. |
4025 |
* This is no longer a handle based call. |
3947 |
*/ |
4026 |
*/ |
Lines 3951-3956
Link Here
|
3951 |
static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) |
4030 |
static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) |
3952 |
{ |
4031 |
{ |
3953 |
int fd = fsp_get_pathref_fd(fsp); |
4032 |
int fd = fsp_get_pathref_fd(fsp); |
|
|
4033 |
int real_fd; |
3954 |
|
4034 |
|
3955 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
4035 |
SMB_ASSERT(!fsp_is_alternate_stream(fsp)); |
3956 |
|
4036 |
|
Lines 3968-3973
Link Here
|
3968 |
} |
4048 |
} |
3969 |
|
4049 |
|
3970 |
return setxattr(p, name, value, size, flags); |
4050 |
return setxattr(p, name, value, size, flags); |
|
|
4051 |
} |
4052 |
|
4053 |
if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { |
4054 |
int saved_errno, result; |
4055 |
|
4056 |
result = fsetxattr(real_fd, name, value, size, flags); |
4057 |
saved_errno = errno; |
4058 |
close(real_fd); |
4059 |
errno = saved_errno; |
4060 |
return result; |
3971 |
} |
4061 |
} |
3972 |
|
4062 |
|
3973 |
/* |
4063 |
/* |