mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
smbd: convert SMB_VFS_GET_REAL_FILENAME() arg path to be a struct smb_filename
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
0c61b2658b
commit
f9c6706080
@ -643,7 +643,7 @@ static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int skel_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx, char **found_name)
|
||||
{
|
||||
|
@ -860,7 +860,7 @@ static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int skel_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx, char **found_name)
|
||||
{
|
||||
|
@ -314,6 +314,8 @@
|
||||
* bool closing
|
||||
* bool lock_failure_seen
|
||||
* changed to bitfields.
|
||||
* Version 43 - convert SMB_VFS_GET_REAL_FILENAME() arg path
|
||||
* to be a struct smb_filename
|
||||
*/
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 43
|
||||
@ -927,7 +929,7 @@ struct vfs_fn_pointers {
|
||||
struct stream_struct **streams);
|
||||
|
||||
int (*get_real_filename_fn)(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name);
|
||||
@ -1418,7 +1420,7 @@ NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
|
||||
unsigned int *num_streams,
|
||||
struct stream_struct **streams);
|
||||
int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name);
|
||||
@ -1893,7 +1895,7 @@ NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
|
||||
unsigned int *num_streams,
|
||||
struct stream_struct **streams);
|
||||
int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name);
|
||||
|
@ -1138,7 +1138,7 @@ static int cephwrap_chflags(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int cephwrap_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
|
@ -1395,7 +1395,7 @@ static int ceph_snap_gmt_setxattr(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
@ -1403,9 +1403,10 @@ static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle,
|
||||
time_t timestamp = 0;
|
||||
char stripped[PATH_MAX + 1];
|
||||
char conv[PATH_MAX + 1];
|
||||
struct smb_filename conv_fname;
|
||||
int ret;
|
||||
|
||||
ret = ceph_snap_gmt_strip_snapshot(handle, path,
|
||||
ret = ceph_snap_gmt_strip_snapshot(handle, path->base_name,
|
||||
×tamp, stripped, sizeof(stripped));
|
||||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
@ -1421,7 +1422,12 @@ static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle,
|
||||
errno = -ret;
|
||||
return -1;
|
||||
}
|
||||
ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, conv, name,
|
||||
|
||||
conv_fname = (struct smb_filename) {
|
||||
.base_name = conv,
|
||||
};
|
||||
|
||||
ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, &conv_fname, name,
|
||||
mem_ctx, found_name);
|
||||
return ret;
|
||||
}
|
||||
|
@ -3054,7 +3054,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int vfswrap_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
|
@ -1968,7 +1968,7 @@ static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
@ -1979,7 +1979,8 @@ static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
|
||||
found_name);
|
||||
|
||||
do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle,
|
||||
"%s/%s->%s", path, name, (result == 0) ? *found_name : "");
|
||||
"%s/%s->%s",
|
||||
path->base_name, name, (result == 0) ? *found_name : "");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1751,7 +1751,7 @@ static int vfs_gluster_chflags(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
@ -1768,7 +1768,7 @@ static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
|
||||
snprintf(key_buf, GLUSTER_NAME_MAX + 64,
|
||||
"glusterfs.get_real_filename:%s", name);
|
||||
|
||||
ret = glfs_getxattr(handle->data, path, key_buf, val_buf,
|
||||
ret = glfs_getxattr(handle->data, path->base_name, key_buf, val_buf,
|
||||
GLUSTER_NAME_MAX + 1);
|
||||
if (ret == -1) {
|
||||
if (errno == ENOATTR) {
|
||||
|
@ -24,7 +24,7 @@
|
||||
#define GLUSTER_NAME_MAX 255
|
||||
|
||||
static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **_found_name)
|
||||
@ -42,7 +42,7 @@ static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle,
|
||||
snprintf(key_buf, GLUSTER_NAME_MAX + 64,
|
||||
"glusterfs.get_real_filename:%s", name);
|
||||
|
||||
ret = getxattr(path, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
|
||||
ret = getxattr(path->base_name, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
|
||||
if (ret == -1) {
|
||||
if (errno == ENOATTR) {
|
||||
errno = ENOENT;
|
||||
|
@ -279,7 +279,7 @@ failure:
|
||||
}
|
||||
|
||||
static int vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
@ -308,7 +308,8 @@ static int vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
|
||||
mem_ctx, found_name);
|
||||
}
|
||||
|
||||
full_path_len = full_path_tos(path, name, tmpbuf, sizeof(tmpbuf),
|
||||
full_path_len = full_path_tos(path->base_name, name,
|
||||
tmpbuf, sizeof(tmpbuf),
|
||||
&full_path, &to_free);
|
||||
if (full_path_len == -1) {
|
||||
errno = ENOMEM;
|
||||
@ -345,7 +346,7 @@ static int vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
DEBUG(10, ("smbd_gpfs_get_realfilename_path: %s/%s -> %s\n",
|
||||
path, name, real_pathname));
|
||||
path->base_name, name, real_pathname));
|
||||
|
||||
name = strrchr_m(real_pathname, '/');
|
||||
if (name == NULL) {
|
||||
|
@ -646,7 +646,7 @@ NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
|
@ -2470,16 +2470,18 @@ static NTSTATUS shadow_copy2_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *fname,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
{
|
||||
char *path = fname->base_name;
|
||||
time_t timestamp = 0;
|
||||
char *stripped = NULL;
|
||||
ssize_t ret;
|
||||
int saved_errno = 0;
|
||||
char *conv;
|
||||
struct smb_filename conv_fname;
|
||||
|
||||
DEBUG(10, ("shadow_copy2_get_real_filename called for path=[%s], "
|
||||
"name=[%s]\n", path, name));
|
||||
@ -2491,7 +2493,7 @@ static int shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
DEBUG(10, ("timestamp == 0\n"));
|
||||
return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
|
||||
return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, fname, name,
|
||||
mem_ctx, found_name);
|
||||
}
|
||||
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
|
||||
@ -2500,9 +2502,14 @@ static int shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,
|
||||
DEBUG(10, ("shadow_copy2_convert failed\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
conv_fname = (struct smb_filename) {
|
||||
.base_name = conv,
|
||||
};
|
||||
|
||||
DEBUG(10, ("Calling NEXT_GET_REAL_FILE_NAME for conv=[%s], "
|
||||
"name=[%s]\n", conv, name));
|
||||
ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, conv, name,
|
||||
ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, &conv_fname, name,
|
||||
mem_ctx, found_name);
|
||||
DEBUG(10, ("NEXT_REAL_FILE_NAME returned %d\n", (int)ret));
|
||||
if (ret == -1) {
|
||||
|
@ -2623,23 +2623,25 @@ static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int snapper_gmt_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *fpath,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
{
|
||||
char *path = fpath->base_name;
|
||||
time_t timestamp;
|
||||
char *stripped;
|
||||
ssize_t ret;
|
||||
int saved_errno;
|
||||
char *conv;
|
||||
struct smb_filename conv_fname;
|
||||
|
||||
if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, path,
|
||||
×tamp, &stripped)) {
|
||||
return -1;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
|
||||
return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, fpath, name,
|
||||
mem_ctx, found_name);
|
||||
}
|
||||
if (stripped[0] == '\0') {
|
||||
@ -2655,7 +2657,12 @@ static int snapper_gmt_get_real_filename(struct vfs_handle_struct *handle,
|
||||
if (conv == NULL) {
|
||||
return -1;
|
||||
}
|
||||
ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, conv, name,
|
||||
|
||||
conv_fname = (struct smb_filename) {
|
||||
.base_name = conv,
|
||||
};
|
||||
|
||||
ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, &conv_fname, name,
|
||||
mem_ctx, found_name);
|
||||
saved_errno = errno;
|
||||
TALLOC_FREE(conv);
|
||||
|
@ -1616,7 +1616,7 @@ static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
@ -1632,7 +1632,8 @@ static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
|
||||
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
|
||||
|
||||
if (timediff > audit_timeout) {
|
||||
smb_time_audit_log_fname("get_real_filename", timediff, path);
|
||||
smb_time_audit_log_fname("get_real_filename",
|
||||
timediff, path->base_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -520,7 +520,7 @@ static char *dptr_ReadDirName(TALLOC_CTX *ctx,
|
||||
* scanning the whole directory.
|
||||
*/
|
||||
ret = SMB_VFS_GET_REAL_FILENAME(dptr->conn,
|
||||
dptr->smb_dname->base_name,
|
||||
dptr->smb_dname,
|
||||
dptr->wcard,
|
||||
ctx,
|
||||
&found_name);
|
||||
|
@ -1687,7 +1687,7 @@ int get_real_filename(connection_struct *conn,
|
||||
|
||||
/* Try the vfs first to take advantage of case-insensitive stat. */
|
||||
ret = SMB_VFS_GET_REAL_FILENAME(conn,
|
||||
path->base_name,
|
||||
path,
|
||||
name,
|
||||
mem_ctx,
|
||||
found_name);
|
||||
|
@ -2233,7 +2233,7 @@ NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const struct smb_filename *path,
|
||||
const char *name,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
char **found_name)
|
||||
|
Loading…
Reference in New Issue
Block a user