From 446de4f680fad224f88c3373d92f8dd4caf8172d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 21 Aug 2013 13:56:14 +0000 Subject: vfs3: Pass "lease" through SMB_VFS_CREATE_FILE Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- examples/VFS/skel_opaque.c | 1 + examples/VFS/skel_transparent.c | 2 ++ source3/include/vfs.h | 7 ++++++- source3/include/vfs_macros.h | 8 ++++---- source3/modules/vfs_default.c | 3 ++- source3/modules/vfs_full_audit.c | 2 ++ source3/modules/vfs_media_harmony.c | 3 +++ source3/modules/vfs_time_audit.c | 2 ++ source3/modules/vfs_worm.c | 3 ++- source3/printing/nt_printing.c | 3 +++ source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 2 ++ source3/smbd/dosmode.c | 1 + source3/smbd/nttrans.c | 4 ++++ source3/smbd/open.c | 3 +++ source3/smbd/proto.h | 1 + source3/smbd/reply.c | 10 ++++++++++ source3/smbd/smb2_create.c | 1 + source3/smbd/trans2.c | 6 ++++++ source3/smbd/vfs.c | 3 ++- 19 files changed, 57 insertions(+), 8 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 724dd7b210..47b46a4db7 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -169,6 +169,7 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 329b016d23..fbb1323a6e 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -164,6 +164,7 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -180,6 +181,7 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, create_options, file_attributes, oplock_request, + lease, allocation_size, private_flags, sd, ea_list, result, pinfo); diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 6c0bf70068..a81fb6c1be 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -156,7 +156,10 @@ fsp->pending_break_messages array */ /* Leave at 31 - not yet released. add SMB_VFS_[GET/SET]_COMPRESSION() */ -#define SMB_VFS_INTERFACE_VERSION 31 +/* Bump to version 32 - Samba 4.2 will ship with that. */ +/* Version 32 - Add "lease" to CREATE_FILE operation */ + +#define SMB_VFS_INTERFACE_VERSION 32 /* All intercepted VFS operations must be declared as static functions inside module source @@ -535,6 +538,7 @@ struct vfs_fn_pointers { uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -940,6 +944,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index de9f55fda8..e2d494dca6 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -136,13 +136,13 @@ smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode)) #define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \ - create_options, file_attributes, oplock_request, allocation_size, private_flags, sd, ea_list, result, pinfo) \ + create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo) \ smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \ - (create_options), (file_attributes), (oplock_request), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo)) + (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo)) #define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \ - create_options, file_attributes, oplock_request, allocation_size, private_flags, sd, ea_list, result, pinfo) \ + create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo) \ smb_vfs_call_create_file((handle)->next, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \ - (create_options), (file_attributes), (oplock_request), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo)) + (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo)) #define SMB_VFS_CLOSE(fsp) \ smb_vfs_call_close((fsp)->conn->vfs_handles, (fsp)) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index b8f4117fd1..3430cd0d68 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -517,6 +517,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -527,7 +528,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, return create_file_default(handle->conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, create_options, - file_attributes, oplock_request, + file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo); diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 7f0222cb0f..a51ab75815 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -863,6 +863,7 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -907,6 +908,7 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle, create_options, /* create_options */ file_attributes, /* file_attributes */ oplock_request, /* oplock_request */ + lease, /* lease */ allocation_size, /* allocation_size */ private_flags, sd, /* sd */ diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index bba98052e0..f9432dcfeb 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1207,6 +1207,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -1234,6 +1235,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, create_options, file_attributes, oplock_request, + lease, allocation_size, private_flags, sd, @@ -1270,6 +1272,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, create_options, file_attributes, oplock_request, + lease, allocation_size, private_flags, sd, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 3a45ecdb88..9dbbf8bdea 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -496,6 +496,7 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -519,6 +520,7 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle, create_options, /* create_options */ file_attributes, /* file_attributes */ oplock_request, /* oplock_request */ + lease, /* lease */ allocation_size, /* allocation_size */ private_flags, sd, /* sd */ diff --git a/source3/modules/vfs_worm.c b/source3/modules/vfs_worm.c index 77a18cad37..3097419f30 100644 --- a/source3/modules/vfs_worm.c +++ b/source3/modules/vfs_worm.c @@ -32,6 +32,7 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -62,7 +63,7 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, create_options, - file_attributes, oplock_request, allocation_size, + file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo); if (!NT_STATUS_IS_OK(status)) { return status; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index b76badf3f0..3a3a3396c8 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -531,6 +531,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -584,6 +585,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -762,6 +764,7 @@ static uint32 get_correct_cversion(struct auth_session_info *session_info, 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* private_flags */ 0, /* allocation_size */ NULL, /* sd */ diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 11abc6c838..855b8c7fb7 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -2359,6 +2359,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p, 0, /* create_options */ 0, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -2506,6 +2507,7 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p, 0, /* create_options */ 0, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 2e6871191b..965e695640 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1128,6 +1128,7 @@ static NTSTATUS get_file_handle_for_metadata(connection_struct *conn, 0, /* create_options */ 0, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 2521a1ef00..0cf1ea32d3 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -574,6 +574,7 @@ void reply_ntcreate_and_X(struct smb_request *req) create_options, /* create_options */ file_attributes, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ allocation_size, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -1180,6 +1181,7 @@ static void call_nt_transact_create(connection_struct *conn, create_options, /* create_options */ file_attributes, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ allocation_size, /* allocation_size */ 0, /* private_flags */ sd, /* sd */ @@ -1423,6 +1425,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ NO_OPLOCK, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -1447,6 +1450,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, 0, /* create_options */ fattr, /* file_attributes */ NO_OPLOCK, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ diff --git a/source3/smbd/open.c b/source3/smbd/open.c index a8bd974a3b..4157280b08 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3352,6 +3352,7 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, FILE_DIRECTORY_FILE, /* create_options */ FILE_ATTRIBUTE_DIRECTORY, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -3530,6 +3531,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn, 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE, /* private_flags */ NULL, /* sd */ @@ -4284,6 +4286,7 @@ NTSTATUS create_file_default(connection_struct *conn, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 3905a742a9..692f582815 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -639,6 +639,7 @@ NTSTATUS create_file_default(connection_struct *conn, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 6c664149b1..4cb446fb23 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1948,6 +1948,7 @@ void reply_open(struct smb_request *req) create_options, /* create_options */ dos_attr, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ private_flags, NULL, /* sd */ @@ -2116,6 +2117,7 @@ void reply_open_and_X(struct smb_request *req) create_options, /* create_options */ smb_attr, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ private_flags, NULL, /* sd */ @@ -2363,6 +2365,7 @@ void reply_mknew(struct smb_request *req) create_options, /* create_options */ fattr, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -2490,6 +2493,7 @@ void reply_ctemp(struct smb_request *req) 0, /* create_options */ fattr, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -2707,6 +2711,7 @@ static NTSTATUS do_unlink(connection_struct *conn, posix_paths ? FILE_FLAG_POSIX_SEMANTICS|0777 : FILE_ATTRIBUTE_NORMAL, 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -5968,6 +5973,7 @@ void reply_rmdir(struct smb_request *req) FILE_DIRECTORY_FILE, /* create_options */ FILE_ATTRIBUTE_DIRECTORY, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -6735,6 +6741,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, create_options, /* create_options */ posix_pathnames ? FILE_FLAG_POSIX_SEMANTICS|0777 : 0, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -6881,6 +6888,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, create_options, /* create_options */ posix_pathnames ? FILE_FLAG_POSIX_SEMANTICS|0777 : 0, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -7150,6 +7158,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -7179,6 +7188,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, 0, /* create_options */ dosattrs, /* file_attributes */ INTERNAL_OPEN_ONLY, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 6709f5199e..18534349bd 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -948,6 +948,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, in_create_options, in_file_attributes, map_smb2_oplock_levels_to_samba(requested_oplock_level), + NULL, allocation_size, 0, /* private_flags */ sec_desc, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 9a02a74d2c..1e2c02e12d 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1222,6 +1222,7 @@ static void call_trans2open(connection_struct *conn, create_options, /* create_options */ open_attr, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ open_size, /* allocation_size */ private_flags, NULL, /* sd */ @@ -5889,6 +5890,7 @@ static NTSTATUS smb_set_file_size(connection_struct *conn, 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -6874,6 +6876,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn, 0, /* create_options */ FILE_ATTRIBUTE_NORMAL, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -7389,6 +7392,7 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn, FILE_DIRECTORY_FILE, /* create_options */ mod_unixmode, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -7621,6 +7625,7 @@ static NTSTATUS smb_posix_open(connection_struct *conn, create_options, /* create_options */ mod_unixmode, /* file_attributes */ oplock_request, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ @@ -7751,6 +7756,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn, create_options, /* create_options */ FILE_FLAG_POSIX_SEMANTICS|0777, /* file_attributes */ 0, /* oplock_request */ + NULL, /* lease */ 0, /* allocation_size */ 0, /* private_flags */ NULL, /* sd */ diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index c219b1f62c..744db7ad7d 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1542,6 +1542,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, + struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -1553,7 +1554,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, return handle->fns->create_file_fn( handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, create_options, - file_attributes, oplock_request, allocation_size, + file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo); } -- cgit