diff options
author | Ralph Boehme <slow@samba.org> | 2020-04-30 16:40:28 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-05-05 19:18:41 +0000 |
commit | f9c670608090fc22ccb48a29eed16bc44c9e75fd (patch) | |
tree | 9b9138f0ba0bf878ffe624ba4100094bdd8e84d0 | |
parent | 0c61b2658b003894f69d69198edc512943943157 (diff) | |
download | samba-f9c670608090fc22ccb48a29eed16bc44c9e75fd.tar.gz |
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>
-rw-r--r-- | examples/VFS/skel_opaque.c | 2 | ||||
-rw-r--r-- | examples/VFS/skel_transparent.c | 2 | ||||
-rw-r--r-- | source3/include/vfs.h | 8 | ||||
-rw-r--r-- | source3/modules/vfs_ceph.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_ceph_snapshots.c | 12 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 5 | ||||
-rw-r--r-- | source3/modules/vfs_glusterfs.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_glusterfs_fuse.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_gpfs.c | 7 | ||||
-rw-r--r-- | source3/modules/vfs_not_implemented.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 13 | ||||
-rw-r--r-- | source3/modules/vfs_snapper.c | 13 | ||||
-rw-r--r-- | source3/modules/vfs_time_audit.c | 5 | ||||
-rw-r--r-- | source3/smbd/dir.c | 2 | ||||
-rw-r--r-- | source3/smbd/filename.c | 2 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 2 |
17 files changed, 56 insertions, 31 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ed9f108009e..bab1d34469c 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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) { diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 1dce543734f..92f9e8a8123 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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) { diff --git a/source3/include/vfs.h b/source3/include/vfs.h index c6989207356..5e4190adc30 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -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); diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index ed7baba5ba5..5bc8f37a87d 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -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) diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 17f688353f9..4472f9717a1 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -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; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index bfc84e1d20b..578eb34180a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index f8eef6eb1df..fad8a14e245 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -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; } diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 2c00a2f6489..d8f39bd9a96 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -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) { diff --git a/source3/modules/vfs_glusterfs_fuse.c b/source3/modules/vfs_glusterfs_fuse.c index c621f9abf8e..1e07308e980 100644 --- a/source3/modules/vfs_glusterfs_fuse.c +++ b/source3/modules/vfs_glusterfs_fuse.c @@ -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; diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index ae3ee40e147..5e5351c3c86 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -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) { diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index cb770790479..f5cd002d897 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -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) diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index a8c904215ea..f405c8a80e2 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -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) { diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 50ea19112ca..b98289b90eb 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -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); diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 626ccd63921..8b7be9660c4 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -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; diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index d6aa45b7997..2cd659aab73 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -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); diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 976aa9c4cd9..0a3d8f39007 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -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); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index fc43eebcadf..89180e46e1e 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -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) |