uint32_t *dosmode)
{
struct gpfs_config_data *config;
+ int fd = fsp_get_pathref_fd(fsp);
+ char buf[PATH_MAX];
+ const char *p = NULL;
struct gpfs_iattr64 iattr = { };
unsigned int litemask;
struct timespec ts;
return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode);
}
- ret = gpfswrap_fstat_x(fsp_get_pathref_fd(fsp), &litemask, &iattr, sizeof(iattr));
+ if (fsp->fsp_flags.is_pathref && !config->pathref_ok.gpfs_fstat_x) {
+ if (fsp->fsp_flags.have_proc_fds) {
+ p = sys_proc_fd_path(fd, buf, sizeof(buf));
+ if (p == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ } else {
+ p = fsp->fsp_name->base_name;
+ }
+ }
+
+ if (p != NULL) {
+ ret = gpfswrap_stat_x(p, &litemask, &iattr, sizeof(iattr));
+ } else {
+ ret = gpfswrap_fstat_x(fd, &litemask, &iattr, sizeof(iattr));
+ }
if (ret == -1 && errno == ENOSYS) {
return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode);
}
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
- ret = gpfswrap_fstat_x(fsp_get_pathref_fd(fsp), &litemask,
- &iattr, sizeof(iattr));
+ if (p != NULL) {
+ ret = gpfswrap_stat_x(p,
+ &litemask,
+ &iattr,
+ sizeof(iattr));
+ } else {
+ ret = gpfswrap_fstat_x(fd,
+ &litemask,
+ &iattr,
+ sizeof(iattr));
+ }
if (ret == -1) {
saved_errno = errno;
}