[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-521-g6a58d82
Volker Lendecke
vl at sernet.de
Fri Dec 7 13:02:33 GMT 2007
The branch, v3-2-test has been updated
via 6a58d823e51ccc8efd6682005e367c9096abc993 (commit)
via 8f70f691ffa3e171a73d04a1c867aa6fca4d4583 (commit)
via d000258b96b9bb714efdfe982947370a6dfb5d55 (commit)
via da94b5f9e37f38880e8ca4c2c7f8de6838864321 (commit)
via a0abb885214ed29659889e359aecb60fb6dec100 (commit)
from 4c03cbdc816842f1d657fdc8499e3ad9a459f0d7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 6a58d823e51ccc8efd6682005e367c9096abc993
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Dec 7 12:57:11 2007 +0100
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
commit 8f70f691ffa3e171a73d04a1c867aa6fca4d4583
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Dec 7 12:39:30 2007 +0100
More parameter shuffling
commit d000258b96b9bb714efdfe982947370a6dfb5d55
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Dec 7 11:58:40 2007 +0100
Re-arrange create_file() parameters
This changes them to be a bit closer to open_file_ntcreate and thus provides
less surprises to developers
commit da94b5f9e37f38880e8ca4c2c7f8de6838864321
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Dec 7 10:46:11 2007 +0100
Make fname arg to create_file a "const char *"
commit a0abb885214ed29659889e359aecb60fb6dec100
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Dec 7 09:20:45 2007 +0100
Fix two unused variable warnings
I know this will be overwritten by the next "make idl", but it just bugs me
*now* :-)
Volker
-----------------------------------------------------------------------
Summary of changes:
source/librpc/gen_ndr/ndr_wkssvc.c | 2 -
source/smbd/nttrans.c | 82 +++++++++++++++++++++++++++++++----
source/smbd/open.c | 70 +++++++++---------------------
3 files changed, 93 insertions(+), 61 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/librpc/gen_ndr/ndr_wkssvc.c b/source/librpc/gen_ndr/ndr_wkssvc.c
index c3a1f70..3599fef 100644
--- a/source/librpc/gen_ndr/ndr_wkssvc.c
+++ b/source/librpc/gen_ndr/ndr_wkssvc.c
@@ -8606,7 +8606,6 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus(struct ndr_pull *ndr
TALLOC_CTX *_mem_save_unknown_0;
TALLOC_CTX *_mem_save_num_ous_0;
TALLOC_CTX *_mem_save_ous_1;
- TALLOC_CTX *_mem_save_ous_2;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -9488,7 +9487,6 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus2(struct ndr_pull *nd
TALLOC_CTX *_mem_save_EncryptedPassword_0;
TALLOC_CTX *_mem_save_num_ous_0;
TALLOC_CTX *_mem_save_ous_1;
- TALLOC_CTX *_mem_save_ous_2;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index fb85a67..716f682 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -433,6 +433,7 @@ void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req)
struct timespec a_timespec;
struct timespec m_timespec;
NTSTATUS status;
+ int oplock_request;
uint8_t oplock_granted = NO_OPLOCK_RETURN;
TALLOC_CTX *ctx = talloc_tos();
@@ -497,11 +498,16 @@ void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req)
}
}
- status = create_file(conn, req, root_dir_fid, fname, flags,
- access_mask, file_attributes, share_access,
- create_disposition, create_options,
- allocation_size, NULL, NULL,
- &fsp, &info, &oplock_granted, &sbuf);
+ oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
+ if (oplock_request) {
+ oplock_request |= (flags & REQUEST_BATCH_OPLOCK)
+ ? BATCH_OPLOCK : 0;
+ }
+
+ status = create_file(conn, req, root_dir_fid, fname,
+ access_mask, share_access, create_disposition,
+ create_options, file_attributes, flags,
+ allocation_size, NULL, NULL, &fsp, &info, &sbuf);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->mid)) {
@@ -519,6 +525,31 @@ void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req)
return;
}
+ /*
+ * 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;
+ }
+
file_len = sbuf.st_size;
fattr = dos_mode(conn,fname,&sbuf);
if (fattr == 0) {
@@ -834,6 +865,7 @@ static void call_nt_transact_create(connection_struct *conn,
NTSTATUS status;
size_t param_len;
SMB_BIG_UINT allocation_size;
+ int oplock_request;
uint8_t oplock_granted;
TALLOC_CTX *ctx = talloc_tos();
@@ -941,11 +973,16 @@ static void call_nt_transact_create(connection_struct *conn,
return;
}
- status = create_file(conn, req, root_dir_fid, fname, flags,
- access_mask, file_attributes, share_access,
- create_disposition, create_options,
- allocation_size, sd, ea_list,
- &fsp, &info, &oplock_granted, &sbuf);
+ oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
+ if (oplock_request) {
+ oplock_request |= (flags & REQUEST_BATCH_OPLOCK)
+ ? BATCH_OPLOCK : 0;
+ }
+
+ status = create_file(conn, req, root_dir_fid, fname,
+ access_mask, share_access, create_disposition,
+ create_options, file_attributes, flags,
+ allocation_size, sd, ea_list, &fsp, &info, &sbuf);
if(!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->mid)) {
@@ -961,6 +998,31 @@ static void call_nt_transact_create(connection_struct *conn,
return;
}
+ /*
+ * 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;
+ }
+
file_len = sbuf.st_size;
fattr = dos_mode(conn,fname,&sbuf);
if (fattr == 0) {
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 66ceb8d..b156dbb 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -2447,20 +2447,19 @@ 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,
- uint32_t flags,
+ const char *fname,
uint32_t access_mask,
- uint32_t file_attributes,
uint32_t share_access,
uint32_t create_disposition,
uint32_t create_options,
+ uint32_t file_attributes,
+ 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,18 +2611,15 @@ 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;
}
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 +2630,7 @@ NTSTATUS create_file(connection_struct *conn,
*/
goto fail;
}
+ fname = resolved_fname;
}
/*
@@ -2646,10 +2642,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() */
@@ -2826,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;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list