This removes "git grep fsp_name->base_name" references.
Referencing fsp_name->base_name is potentially racy and affected by
https://bugzilla.samba.org/show_bug.cgi?id=15909
This removes some obvious git grep lines, still leaving far too many...
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
/* Now parse entries */
ok = ad_unpack(ad, ADEID_NUM_XATTR, AD_DATASZ_XATTR);
if (!ok) {
- DBG_WARNING(
- "Invalid AppleDouble xattr metadata (%s) in file: %s - "
- "Consider deleting the corrupted file.\n",
- smb_fname->base_name,
- ad->ad_fsp->fsp_name->base_name);
+ DBG_WARNING("Invalid AppleDouble xattr metadata (%s) in file: "
+ "%s - Consider deleting the corrupted file.\n",
+ smb_fname->base_name,
+ fsp_str_dbg(ad->ad_fsp));
errno = EINVAL;
rc = -1;
goto exit;
DBG_WARNING("Invalid AppleDouble resource (%s) in file: %s - "
"Consider deleting the corrupted file.\n",
smb_fname->base_name,
- ad->ad_fsp->fsp_name->base_name);
+ fsp_str_dbg(ad->ad_fsp));
errno = EINVAL;
return -1;
}
DBG_WARNING("Invalid AppleDouble resource (%s) in file: %s - "
"Consider deleting the corrupted file.\n",
smb_fname->base_name,
- ad->ad_fsp->fsp_name->base_name);
+ fsp_str_dbg(ad->ad_fsp));
errno = EINVAL;
return -1;
}
lp_fake_directory_create_times(SNUM(handle->conn));
DBG_DEBUG("fstat for %s failed with EACCES. Trying with "
- "CAP_DAC_OVERRIDE.\n", fsp->fsp_name->base_name);
+ "CAP_DAC_OVERRIDE.\n",
+ fsp_str_dbg(fsp));
ret = fstat_with_cap_dac_override(fsp_get_pathref_fd(fsp),
sbuf,
fake_dctime);
lp_fake_directory_create_times(SNUM(handle->conn));
DBG_DEBUG("fstatat for %s failed with EACCES. Trying with "
- "CAP_DAC_OVERRIDE.\n", dirfsp->fsp_name->base_name);
+ "CAP_DAC_OVERRIDE.\n",
+ fsp_str_dbg(dirfsp));
ret = fstatat_with_cap_dac_override(fsp_get_pathref_fd(dirfsp),
smb_fname->base_name,
sbuf,
(*out_cfh)->fd = -1;
out:
DBG_DEBUG("[CEPH] vfs_ceph_add_fh: name = %s ret = %d\n",
- fsp->fsp_name->base_name, ret);
+ fsp_str_dbg(fsp),
+ ret);
return ret;
}
*out_cfh = VFS_FETCH_FSP_EXTENSION(handle, fsp);
ret = (*out_cfh == NULL) ? -EBADF : 0;
DBG_DEBUG("[CEPH] vfs_ceph_fetch_fh: name = %s ret = %d\n",
- fsp->fsp_name->base_name, ret);
+ fsp_str_dbg(fsp),
+ ret);
return ret;
}
*out_cfh = VFS_FETCH_FSP_EXTENSION(handle, fsp);
ret = (*out_cfh == NULL) || ((*out_cfh)->fh == NULL) ? -EBADF : 0;
DBG_DEBUG("[CEPH] vfs_ceph_fetch_io_fh: name = %s ret = %d\n",
- fsp->fsp_name->base_name, ret);
+ fsp_str_dbg(fsp),
+ ret);
return ret;
}
struct vfs_ceph_fh *cfh = NULL;
START_PROFILE_X(SNUM(handle->conn), syscall_fdopendir);
- DBG_DEBUG("[CEPH] fdopendir: name=%s\n", fsp->fsp_name->base_name);
+ DBG_DEBUG("[CEPH] fdopendir: name=%s\n", fsp_str_dbg(fsp));
ret = vfs_ceph_fetch_fh(handle, fsp, &cfh);
if (ret != 0) {
goto out;
result = &cfh->dirp;
out:
DBG_DEBUG("[CEPH] fdopendir: handle=%p name=%s ret=%d\n",
- handle, fsp->fsp_name->base_name, ret);
+ handle,
+ fsp_str_dbg(fsp),
+ ret);
if (ret != 0) {
errno = -ret;
}
int ret = -1;
START_PROFILE_X(SNUM(handle->conn), syscall_readdir);
- DBG_DEBUG("[CEPH] readdir: name=%s\n", dirfsp->fsp_name->base_name);
+ DBG_DEBUG("[CEPH] readdir: name=%s\n", fsp_str_dbg(dirfsp));
result = vfs_ceph_get_fh_dirent(dircfh);
if (result == NULL) {
errno = saved_errno;
out:
DBG_DEBUG("[CEPH] readdir: handle=%p name=%s ret=%d\n",
- handle, dirfsp->fsp_name->base_name, ret);
+ handle,
+ fsp_str_dbg(dirfsp),
+ ret);
END_PROFILE_X(syscall_readdir);
return result;
}
fsp->fsp_flags.have_proc_fds = false;
err_out:
DBG_DEBUG("[CEPH] openat: name=%s result=%d",
- fsp->fsp_name->base_name, result);
+ fsp_str_dbg(fsp),
+ result);
END_PROFILE_X(syscall_openat);
return status_code(result);
}
vfs_ceph_remove_fh(handle, fsp);
out:
DBG_DEBUG("[CEPH] close: handle=%p name=%s result=%d\n",
- handle, fsp->fsp_name->base_name, result);
+ handle,
+ fsp_str_dbg(fsp),
+ result);
END_PROFILE_X(syscall_close);
return status_code(result);
}
result = vfs_ceph_ll_read(handle, cfh, offset, n, data);
out:
- DBG_DEBUG("[CEPH] pread: handle=%p name=%s n=%" PRIu64 "offset=%" PRIu64
- " result=%" PRIu64 "\n",
+ DBG_DEBUG("[CEPH] pread: handle=%p name=%s n=%" PRIu64
+ "offset=%" PRIu64 " result=%" PRIu64 "\n",
handle,
- fsp->fsp_name->base_name,
+ fsp_str_dbg(fsp),
n,
(intmax_t)offset,
result);
struct vfs_ceph_aio_state *state = NULL;
int ret = -1;
- DBG_DEBUG("[CEPH] pread_send: handle=%p name=%s data=%p n=%zu offset=%zd\n",
+ DBG_DEBUG("[CEPH] pread_send: handle=%p name=%s data=%p n=%zu "
+ "offset=%zd\n",
handle,
- fsp->fsp_name->base_name,
+ fsp_str_dbg(fsp),
data,
n,
offset);
}
result = vfs_ceph_ll_write(handle, cfh, offset, n, data);
out:
- DBG_DEBUG("[CEPH] pwrite: name=%s data=%p n=%" PRIu64 "offset=%" PRIu64 "\n",
- fsp->fsp_name->base_name,
+ DBG_DEBUG("[CEPH] pwrite: name=%s data=%p n=%" PRIu64 "offset=%" PRIu64
+ "\n",
+ fsp_str_dbg(fsp),
data,
n,
(intmax_t)offset);
struct vfs_ceph_aio_state *state = NULL;
int ret = -1;
- DBG_DEBUG("[CEPH] pwrite_send: handle=%p name=%s data=%p n=%zu offset=%zd\n",
+ DBG_DEBUG("[CEPH] pwrite_send: handle=%p name=%s data=%p n=%zu "
+ "offset=%zd\n",
handle,
- fsp->fsp_name->base_name,
+ fsp_str_dbg(fsp),
data,
n,
offset);
result = vfs_ceph_ll_lseek(handle, cfh, offset, whence);
out:
DBG_DEBUG("[CEPH] lseek: handle=%p name=%s offset=%zd whence=%d\n",
- handle, fsp->fsp_name->base_name, offset, whence);
+ handle,
+ fsp_str_dbg(fsp),
+ offset,
+ whence);
END_PROFILE_X(syscall_lseek);
return lstatus_code(result);
}
struct vfs_ceph_aio_state *state = NULL;
int ret = -1;
- DBG_DEBUG("[CEPH] fsync_send: name=%s\n", fsp->fsp_name->base_name);
+ DBG_DEBUG("[CEPH] fsync_send: name=%s\n", fsp_str_dbg(fsp));
req = tevent_req_create(mem_ctx, &state, struct vfs_ceph_aio_state);
if (req == NULL) {
if (ret != 0) {
/* ceph_fsync returns -errno on error. */
DBG_DEBUG("[CEPH] fsync_send: ceph_fsync returned error "
- "name=%s ret=%d\n", fsp->fsp_name->base_name, ret);
+ "name=%s ret=%d\n",
+ fsp_str_dbg(fsp),
+ ret);
tevent_req_error(req, -ret);
return tevent_req_post(req, ev);
}
}
out:
- DBG_DEBUG("[CEPH] ntimes: handle=%p name=%s {mtime=%ld atime=%ld ctime=%ld"
- " create_time=%ld} result=%d\n",
+ DBG_DEBUG("[CEPH] ntimes: handle=%p name=%s {mtime=%ld atime=%ld "
+ "ctime=%ld create_time=%ld} result=%d\n",
handle,
- fsp->fsp_name->base_name, ft->mtime.tv_sec, ft->atime.tv_sec,
- ft->ctime.tv_sec, ft->create_time.tv_sec, result);
+ fsp_str_dbg(fsp),
+ ft->mtime.tv_sec,
+ ft->atime.tv_sec,
+ ft->ctime.tv_sec,
+ ft->create_time.tv_sec,
+ result);
END_PROFILE_X(syscall_fntimes);
return status_code(result);
}
}
out:
DBG_DEBUG("[CEPH] fchmod: handle=%p, name=%s result=%d\n",
- handle, fsp->fsp_name->base_name, result);
+ handle,
+ fsp_str_dbg(fsp),
+ result);
END_PROFILE_X(syscall_fchmod);
return status_code(result);
}
}
out:
DBG_DEBUG("[CEPH] fchown: handle=%p name=%s uid=%d gid=%d result=%d\n",
- handle, fsp->fsp_name->base_name, uid, gid, result);
+ handle,
+ fsp_str_dbg(fsp),
+ uid,
+ gid,
+ result);
END_PROFILE_X(syscall_fchown);
return status_code(result);
}
START_PROFILE_X(SNUM(handle->conn), syscall_ftruncate);
DBG_DEBUG("[CEPH] ftruncate: handle=%p, name=%s, len=%zd\n",
- handle, fsp->fsp_name->base_name, (intmax_t)len);
+ handle,
+ fsp_str_dbg(fsp),
+ (intmax_t)len);
if (lp_strict_allocate(SNUM(fsp->conn))) {
END_PROFILE(syscall_ftruncate);
}
result = vfs_ceph_ll_ftruncate(handle, cfh, len);
out:
- DBG_DEBUG("[CEPH] ftruncate: name=%s result=%d\n", fsp->fsp_name->base_name, result);
+ DBG_DEBUG("[CEPH] ftruncate: name=%s result=%d\n",
+ fsp_str_dbg(fsp),
+ result);
END_PROFILE_X(syscall_ftruncate);
return status_code(result);
}
"ceph", "snapdir",
CEPH_SNAP_SUBDIR_DEFAULT);
- DBG_DEBUG("getting shadow copy data for %s\n",
- fsp->fsp_name->base_name);
+ DBG_DEBUG("getting shadow copy data for %s\n", fsp_str_dbg(fsp));
tmp_ctx = talloc_new(fsp);
if (tmp_ctx == NULL) {
handle, dirfsp, smb_fname, &st, AT_SYMLINK_NOFOLLOW);
if (ret != 0) {
DBG_ERR("fstatat [%s%s] failed [%s]\n",
- dirfsp->fsp_name->base_name,
+ fsp_str_dbg(dirfsp),
smb_fname->base_name,
strerror(errno));
return -1;
if (errno == EACCES) {
DBG_NOTICE("GPFS share mode denied for %s/%s.\n",
fsp->conn->connectpath,
- fsp->fsp_name->base_name);
+ fsp_str_dbg(fsp));
} else if (errno == EPERM) {
DBG_ERR("Samba requested GPFS sharemode for %s/%s, but the "
"GPFS file system is not configured accordingly. "
"Configure file system with mmchfs -D nfs4 or "
"set gpfs:sharemodes=no in Samba.\n",
fsp->conn->connectpath,
- fsp->fsp_name->base_name);
+ fsp_str_dbg(fsp));
} else {
DBG_ERR("gpfs_set_share failed: %s\n", strerror(errno));
}
DBG_ERR("Clearing GPFS sharemode on close failed for "
" %s/%s: %s\n",
fsp->conn->connectpath,
- fsp->fsp_name->base_name,
+ fsp_str_dbg(fsp),
strerror(errno));
}
}
if (ret == -1) {
DBG_WARNING("Getting winattrs failed for %s: %s\n",
- fsp->fsp_name->base_name, strerror(errno));
+ fsp_str_dbg(fsp),
+ strerror(errno));
return map_nt_error_from_unix(errno);
}
DIR *dirstream;
DEBUG(MH_INFO_DEBUG, ("Entering with fsp->fsp_name->base_name '%s'\n",
- fsp->fsp_name->base_name));
+ fsp_str_dbg(fsp)));
dirstream = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
if (!dirstream)
err:
/* Failure is freed here. */
DEBUG(MH_ERR_DEBUG, ("Failing with fsp->fsp_name->base_name '%s'\n",
- fsp->fsp_name->base_name));
+ fsp_str_dbg(fsp)));
TALLOC_FREE(dirInfo);
return NULL;
}
struct um_dirinfo_struct *dirInfo = NULL;
DIR *dirstream;
- DEBUG(10, ("Entering with fsp->fsp_name->base_name '%s'\n",
- fsp->fsp_name->base_name));
+ DBG_DEBUG("Entering with fsp->fsp_name '%s'\n", fsp_str_dbg(fsp));
dirstream = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
if (!dirstream) {
return (DIR *) dirInfo;
err:
- DEBUG(1, ("Failing with fsp->fsp_name->base_name '%s'\n",
- fsp->fsp_name->base_name));
+ DBG_WARNING("Failing with fsp->fsp_name '%s'\n", fsp_str_dbg(fsp));
TALLOC_FREE(dirInfo);
return NULL;
}
{
int status = 0;
- DEBUG(10, ("Entering with fsp->fsp_name->base_name "
- "'%s'\n", fsp_str_dbg(fsp)));
+ DBG_DEBUG("Entering with fsp->fsp_name '%s'\n", fsp_str_dbg(fsp));
status = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
if (status != 0) {
*/
if (!called) {
- DBG_DEBUG("No handle specified using path %s\n", fsp->fsp_name->base_name);
+ DBG_DEBUG("No handle specified using path %s\n",
+ fsp_str_dbg(fsp));
ret = vxfs_getxattr_path(fsp->fsp_name->base_name, name, value, size);
if ((ret != -1) || ((errno != ENOTSUP) &&
(errno != ENOSYS) && (errno != ENODATA))) {
*/
if (!called) {
- DBG_DEBUG("No handle specified using path %s\n", fsp->fsp_name->base_name);
+ DBG_DEBUG("No handle specified using path %s\n",
+ fsp_str_dbg(fsp));
ret = vxfs_checkwxattr_path(fsp->fsp_name->base_name);
}
&how);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("fd_openat(%s) returned %s\n",
- dirfsp->fsp_name->base_name,
+ fsp_str_dbg(dirfsp),
nt_errstr(status));
file_free(NULL, new_fsp);
return status;
full_fname = full_path_from_dirfsp_atname(conn, dirfsp, smb_fname_rel);
if (full_fname == NULL) {
DBG_DEBUG("full_path_from_dirfsp_atname(%s/%s) failed\n",
- dirfsp->fsp_name->base_name,
+ fsp_str_dbg(dirfsp),
smb_fname_rel->base_name);
file_free(NULL, fsp);
return NT_STATUS_NO_MEMORY;
if ((fd == -1) && (errno == ENOENT)) {
status = map_nt_error_from_unix(errno);
DBG_DEBUG("smb_vfs_openat(%s/%s) failed: %s\n",
- dirfsp->fsp_name->base_name,
+ fsp_str_dbg(dirfsp),
smb_fname_rel->base_name,
strerror(errno));
file_free(NULL, fsp);
status = map_nt_error_from_unix(errno);
DBG_DEBUG("SMB_VFS_%sSTAT(%s/%s) failed: %s\n",
(fd >= 0) ? "F" : "",
- dirfsp->fsp_name->base_name,
+ fsp_str_dbg(dirfsp),
smb_fname_rel->base_name,
strerror(errno));
fd_close(fsp);
if (fsp->notify != NULL) {
DEBUG(1, ("change_notify_create: fsp->notify != NULL, "
- "fname = %s\n", fsp->fsp_name->base_name));
+ "fname = %s\n", fsp_str_dbg(fsp)));
return NT_STATUS_INVALID_PARAMETER;
}
static struct files_struct *smbd_notifyd_reregister(struct files_struct *fsp,
void *private_data)
{
- DBG_DEBUG("reregister %s\n", fsp->fsp_name->base_name);
+ DBG_DEBUG("reregister %s\n", fsp_str_dbg(fsp));
if ((fsp->conn->sconn->notify_ctx != NULL) &&
(fsp->notify != NULL) &&
"expose=%s for %s notify %s\n",
has_sec_change_notify_privilege ? "true" : "false",
expose ? "true" : "false",
- fsp->fsp_name->base_name, name);
+ fsp_str_dbg(fsp),
+ name);
if (!expose) {
return;
}
}
if (!strequal(fsp->fsp_name->base_name, smb_fname->base_name)) {
- DEBUG(10, ("Lease requested for file %s, reopened file "
- "is named %s\n", smb_fname->base_name,
- fsp->fsp_name->base_name));
+ DBG_DEBUG("Lease requested for file %s, reopened file "
+ "is named %s\n",
+ smb_fname->base_name,
+ fsp_str_dbg(fsp));
TALLOC_FREE(smb_fname);
return NT_STATUS_INVALID_PARAMETER;
}
DEBUG(8,("smbd_smb2_query_directory_send: dirpath=<%s> dontdescend=<%s>, "
"in_output_buffer_length = %u\n",
- fsp->fsp_name->base_name, lp_dont_descend(talloc_tos(), lp_sub, SNUM(conn)),
+ fsp_str_dbg(fsp), lp_dont_descend(talloc_tos(), lp_sub, SNUM(conn)),
(unsigned int)in_output_buffer_length ));
state->dont_descend = in_list(
if (!NT_STATUS_IS_OK(status)) {
DBG_NOTICE("Error %s rename %s -> %s\n",
nt_errstr(status),
- smb_fname_str_dbg(fsp->fsp_name),
+ fsp_str_dbg(fsp),
smb_fname_str_dbg(smb_fname_dst));
if (NT_STATUS_EQUAL(status,NT_STATUS_SHARING_VIOLATION))
status = NT_STATUS_ACCESS_DENIED;