From 30d31a3f85399042cd7f337c85a261352dd31b09 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Dec 2007 10:46:11 +0100 Subject: Make fname arg to create_file a "const char *" (This used to be commit da94b5f9e37f38880e8ca4c2c7f8de6838864321) --- source3/smbd/open.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'source3/smbd/open.c') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 66ceb8dac7..f4c3791b43 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2447,7 +2447,7 @@ static struct case_semantics_state *set_posix_case_semantics(TALLOC_CTX *mem_ctx NTSTATUS create_file(connection_struct *conn, struct smb_request *req, uint16_t root_dir_fid, - char *fname, + const char *fname, uint32_t flags, uint32_t access_mask, uint32_t file_attributes, @@ -2624,7 +2624,10 @@ NTSTATUS create_file(connection_struct *conn, } if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) { - status = resolve_dfspath(talloc_tos(), conn, true, fname, &fname); + char *resolved_fname; + + status = resolve_dfspath(talloc_tos(), conn, true, fname, + &resolved_fname); if (!NT_STATUS_IS_OK(status)) { /* @@ -2635,6 +2638,7 @@ NTSTATUS create_file(connection_struct *conn, */ goto fail; } + fname = resolved_fname; } /* @@ -2646,10 +2650,15 @@ NTSTATUS create_file(connection_struct *conn, file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS; } - status = unix_convert(talloc_tos(), conn, fname, False, &fname, NULL, - &sbuf); - if (!NT_STATUS_IS_OK(status)) { - goto fail; + { + char *converted_fname; + + status = unix_convert(talloc_tos(), conn, fname, False, + &converted_fname, NULL, &sbuf); + if (!NT_STATUS_IS_OK(status)) { + goto fail; + } + fname = converted_fname; } /* All file access must go through check_name() */ -- cgit From c55e44b6a7c8ca569010ddd7596ba05239c4d673 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Dec 2007 11:58:40 +0100 Subject: Re-arrange create_file() parameters This changes them to be a bit closer to open_file_ntcreate and thus provides less surprises to developers (This used to be commit d000258b96b9bb714efdfe982947370a6dfb5d55) --- source3/smbd/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/open.c') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f4c3791b43..f555aeccb3 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2450,10 +2450,10 @@ NTSTATUS create_file(connection_struct *conn, const char *fname, uint32_t flags, uint32_t access_mask, - uint32_t file_attributes, uint32_t share_access, uint32_t create_disposition, uint32_t create_options, + uint32_t file_attributes, SMB_BIG_UINT allocation_size, struct security_descriptor *sd, struct ea_list *ea_list, -- cgit From ce535b4dd8c410d91f9c0fa2d1d973b4326af64d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Dec 2007 12:39:30 +0100 Subject: More parameter shuffling (This used to be commit 8f70f691ffa3e171a73d04a1c867aa6fca4d4583) --- source3/smbd/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/open.c') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f555aeccb3..11dff4dfe5 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2448,12 +2448,12 @@ NTSTATUS create_file(connection_struct *conn, struct smb_request *req, uint16_t root_dir_fid, const char *fname, - uint32_t flags, uint32_t access_mask, uint32_t share_access, uint32_t create_disposition, uint32_t create_options, uint32_t file_attributes, + uint32_t flags, SMB_BIG_UINT allocation_size, struct security_descriptor *sd, struct ea_list *ea_list, -- cgit From ca4eee5bbe477af2abcdbed542c5e8f7ef5eb610 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Dec 2007 12:57:11 +0100 Subject: Pass only internal oplock request values to create_file Other callers (e.g. reply_open_and_X) might have other ideas of the bit shuffling (This used to be commit 6a58d823e51ccc8efd6682005e367c9096abc993) --- source3/smbd/open.c | 47 +++++------------------------------------------ 1 file changed, 5 insertions(+), 42 deletions(-) (limited to 'source3/smbd/open.c') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 11dff4dfe5..b156dbbce1 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2453,14 +2453,13 @@ NTSTATUS create_file(connection_struct *conn, uint32_t create_disposition, uint32_t create_options, uint32_t file_attributes, - uint32_t flags, + uint32_t oplock_request, SMB_BIG_UINT allocation_size, struct security_descriptor *sd, struct ea_list *ea_list, files_struct **result, int *pinfo, - uint8_t *poplock_granted, SMB_STRUCT_STAT *psbuf) { TALLOC_CTX *frame = talloc_stackframe(); @@ -2468,21 +2467,20 @@ NTSTATUS create_file(connection_struct *conn, SMB_STRUCT_STAT sbuf; int info = FILE_WAS_OPENED; files_struct *fsp = NULL; - uint8_t oplock_granted = NO_OPLOCK_RETURN; - int oplock_request; NTSTATUS status; - DEBUG(10,("create_file: flags = 0x%x, access_mask = 0x%x " + DEBUG(10,("create_file: access_mask = 0x%x " "file_attributes = 0x%x, share_access = 0x%x, " "create_disposition = 0x%x create_options = 0x%x " + "oplock_request = 0x%x " "root_dir_fid = 0x%x, ea_list = 0x%p, sd = 0x%p, " "fname = %s\n", - (unsigned int)flags, (unsigned int)access_mask, (unsigned int)file_attributes, (unsigned int)share_access, (unsigned int)create_disposition, (unsigned int)create_options, + (unsigned int)oplock_request, (unsigned int)root_dir_fid, ea_list, sd, fname)); @@ -2613,12 +2611,6 @@ NTSTATUS create_file(connection_struct *conn, } } - oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0; - if (oplock_request) { - oplock_request |= (flags & REQUEST_BATCH_OPLOCK) - ? BATCH_OPLOCK : 0; - } - if (req == NULL) { oplock_request |= INTERNAL_OPEN_ONLY; } @@ -2835,42 +2827,13 @@ NTSTATUS create_file(connection_struct *conn, } } - /* - * If the caller set the extended oplock request bit - * and we granted one (by whatever means) - set the - * correct bit for extended oplock reply. - */ - - if (oplock_request && - (lp_fake_oplocks(SNUM(conn)) - || EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))) { - - /* - * Exclusive oplock granted - */ - - if (flags & REQUEST_BATCH_OPLOCK) { - oplock_granted = BATCH_OPLOCK_RETURN; - } else { - oplock_granted = EXCLUSIVE_OPLOCK_RETURN; - } - } else if (fsp->oplock_type == LEVEL_II_OPLOCK) { - oplock_granted = LEVEL_II_OPLOCK_RETURN; - } else { - oplock_granted = NO_OPLOCK_RETURN; - } - done: - DEBUG(10, ("create_file: info=%d, oplock_granted=%d\n", - info, (int)oplock_granted)); + DEBUG(10, ("create_file: info=%d\n", info)); *result = fsp; if (pinfo != NULL) { *pinfo = info; } - if (poplock_granted != NULL) { - *poplock_granted = oplock_granted; - } if (psbuf != NULL) { *psbuf = sbuf; } -- cgit