[PATCH] Fix bug #10587 - Opening directories on SLES's cifsd and Apple's smbx succeeds.
Jeremy Allison
jra at samba.org
Thu May 8 22:39:21 MDT 2014
On Thu, May 08, 2014 at 07:54:05PM -0700, Jeremy Allison wrote:
> On Thu, May 08, 2014 at 07:47:34PM -0700, Jeremy Allison wrote:
> > On Fri, May 09, 2014 at 12:19:11AM +0200, Stefan (metze) Metzmacher wrote:
> >
> > > Please avoid the ugly _internal_recv() function,
> > > just expose the attrs in the normal _recv and the sync function.
> >
> > That means changing the ABI to the cli_ntcreate_recv().
> > I thought this was already exposed to external callers,
> > but checking I guess we're not guarenteeing this
> > interface externally.
> >
> > OK, I'll fix it up to be the same as the smb2
> > version of the function that returns a struct
> > containing the full data returned from the
> > open in the _recv call.
>
> FYI - If I do it this way it's a *much*
> bigger change, as it means changing
> every caller of cli_ntcreate() and
> also cli_nttrans_create() as well
> (as we'll need the same return values
> here).
All right Metze, here's the goddam rewrite
you insisted upon :-).
Add a return parameter of struct smb_create_returns *cr to
cli_ntcreate()
cli_ntcreate_recv()
cli_nttrans_create()
cli_nttrans_create_recv()
and fixes everything up... It's now a 4-patch set.
Please review. *Now* will you be happy ! :-).
Jeremy.
-------------- next part --------------
>From 0a545e917a26b0a2b6e0f019899b021f872f74f7 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Thu, 8 May 2014 20:08:41 -0700
Subject: [PATCH 1/4] s3: client - rename 'struct smb2_create_returns' to
'struct smb_create_returns' so we can use this in SMB1 create returns as
well.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
libcli/smb/smb2_create_blob.h | 2 +-
libcli/smb/smb2cli_create.c | 6 +++---
libcli/smb/smbXcli_base.h | 6 +++---
source3/libsmb/cli_smb2_fnum.c | 4 ++--
source3/libsmb/cli_smb2_fnum.h | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libcli/smb/smb2_create_blob.h b/libcli/smb/smb2_create_blob.h
index 2f915b3..90697a7 100644
--- a/libcli/smb/smb2_create_blob.h
+++ b/libcli/smb/smb2_create_blob.h
@@ -33,7 +33,7 @@ struct smb2_create_blobs {
struct smb2_create_blob *blobs;
};
-struct smb2_create_returns {
+struct smb_create_returns {
uint8_t oplock_level;
uint32_t create_action;
NTTIME creation_time;
diff --git a/libcli/smb/smb2cli_create.c b/libcli/smb/smb2cli_create.c
index 9cb94b1..834a881 100644
--- a/libcli/smb/smb2cli_create.c
+++ b/libcli/smb/smb2cli_create.c
@@ -29,7 +29,7 @@ struct smb2cli_create_state {
uint64_t fid_persistent;
uint64_t fid_volatile;
- struct smb2_create_returns cr;
+ struct smb_create_returns cr;
struct smb2_create_blobs blobs;
};
@@ -225,7 +225,7 @@ static void smb2cli_create_done(struct tevent_req *subreq)
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb2_create_returns *cr)
+ struct smb_create_returns *cr)
{
struct smb2cli_create_state *state =
tevent_req_data(req,
@@ -258,7 +258,7 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
struct smb2_create_blobs *blobs,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb2_create_returns *cr)
+ struct smb_create_returns *cr)
{
TALLOC_CTX *frame = talloc_stackframe();
struct tevent_context *ev;
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 888242b..8cde85e 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -28,7 +28,7 @@ struct smb_trans_enc_state;
struct GUID;
struct iovec;
struct smb2_create_blobs;
-struct smb2_create_returns;
+struct smb_create_returns;
struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
int fd,
@@ -461,7 +461,7 @@ struct tevent_req *smb2cli_create_send(
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb2_create_returns *cr);
+ struct smb_create_returns *cr);
NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
uint32_t timeout_msec,
struct smbXcli_session *session,
@@ -477,7 +477,7 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
struct smb2_create_blobs *blobs,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb2_create_returns *cr);
+ struct smb_create_returns *cr);
struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 1e2047e..8eb776a 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -163,7 +163,7 @@ NTSTATUS cli_smb2_create_fnum(struct cli_state *cli,
uint32_t create_disposition,
uint32_t create_options,
uint16_t *pfid,
- struct smb2_create_returns *cr)
+ struct smb_create_returns *cr)
{
NTSTATUS status;
struct smb2_hnd h;
@@ -660,7 +660,7 @@ NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
uint32_t *attributes)
{
NTSTATUS status;
- struct smb2_create_returns cr;
+ struct smb_create_returns cr;
uint16_t fnum = 0xffff;
size_t namelen = strlen(name);
diff --git a/source3/libsmb/cli_smb2_fnum.h b/source3/libsmb/cli_smb2_fnum.h
index a5cae25..61a0f68 100644
--- a/source3/libsmb/cli_smb2_fnum.h
+++ b/source3/libsmb/cli_smb2_fnum.h
@@ -34,7 +34,7 @@ NTSTATUS cli_smb2_create_fnum(struct cli_state *cli,
uint32_t create_disposition,
uint32_t create_options,
uint16_t *pfid,
- struct smb2_create_returns *cr);
+ struct smb_create_returns *cr);
NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
NTSTATUS cli_smb2_mkdir(struct cli_state *cli, const char *dirname);
--
1.9.1
>From 4e4985586852dfc977725d69717777b9d65da560 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Thu, 8 May 2014 20:55:57 -0700
Subject: [PATCH 2/4] s3: client : Add extra return parameter to all client
open calls.
Add a return parameter of struct smb_create_returns *cr to
cli_ntcreate()
cli_ntcreate_recv()
cli_nttrans_create()
cli_nttrans_create_recv()
Always pass in NULL for now. This fixes the create
API to always fully return the data the server has
given back to us on the open file to the caller.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/client/client.c | 10 +--
source3/libsmb/clifile.c | 29 +++++---
source3/libsmb/cliquota.c | 2 +-
source3/libsmb/clisymlink.c | 4 +-
source3/libsmb/libsmb_xattr.c | 6 +-
source3/libsmb/proto.h | 14 ++--
source3/libsmb/pylibsmb.c | 2 +-
source3/torture/nbench.c | 2 +-
source3/torture/nbio.c | 2 +-
source3/torture/test_chain3.c | 2 +-
source3/torture/test_cleanup.c | 14 ++--
source3/torture/test_notify.c | 6 +-
source3/torture/test_notify_online.c | 4 +-
source3/torture/test_nttrans_create.c | 4 +-
source3/torture/test_nttrans_fsctl.c | 2 +-
source3/torture/test_posix_append.c | 2 +-
source3/torture/torture.c | 125 +++++++++++++++++-----------------
source3/torture/utable.c | 2 +-
source3/utils/net_rpc.c | 3 +-
source3/utils/net_rpc_printer.c | 7 +-
source3/utils/smbcacls.c | 6 +-
21 files changed, 136 insertions(+), 112 deletions(-)
diff --git a/source3/client/client.c b/source3/client/client.c
index 9e1f83d..592258d 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -573,7 +573,7 @@ static NTSTATUS display_finfo(struct cli_state *cli_state, struct file_info *fin
status = cli_ntcreate(cli_state, afname, 0,
CREATE_ACCESS_READ, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG( 0, ("display_finfo() Failed to open %s: %s\n",
afname, nt_errstr(status)));
@@ -1772,7 +1772,7 @@ static int do_allinfo(const char *name)
SEC_STD_SYNCHRONIZE, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE
|FILE_SHARE_DELETE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
/*
* Ignore failure, it does not hurt if we can't list
@@ -2496,12 +2496,12 @@ static int cmd_open(void)
status = cli_ntcreate(targetcli, targetname, 0,
FILE_READ_DATA|FILE_WRITE_DATA, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum);
+ 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
status = cli_ntcreate(targetcli, targetname, 0,
FILE_READ_DATA, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum);
+ 0x0, 0x0, &fnum, NULL);
if (NT_STATUS_IS_OK(status)) {
d_printf("open file %s: for read/write fnum %d\n", targetname, fnum);
} else {
@@ -3943,7 +3943,7 @@ static int cmd_notify(void)
status = cli_ntcreate(
cli, name, 0, FILE_READ_DATA, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum);
+ FILE_OPEN, 0, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Could not open file: %s\n", nt_errstr(status));
goto fail;
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 424354b..bd886ea 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -1795,6 +1795,7 @@ NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag)
struct cli_ntcreate_state {
uint16_t vwv[24];
uint16_t fnum;
+ struct smb_create_returns cr;
};
static void cli_ntcreate_done(struct tevent_req *subreq);
@@ -1887,10 +1888,13 @@ static void cli_ntcreate_done(struct tevent_req *subreq)
return;
}
state->fnum = SVAL(vwv+2, 1);
+ /* TODO - fill in state->cr.. */
tevent_req_done(req);
}
-NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum)
+NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
+ uint16_t *pfnum,
+ struct smb_create_returns *cr)
{
struct cli_ntcreate_state *state = tevent_req_data(
req, struct cli_ntcreate_state);
@@ -1900,6 +1904,7 @@ NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum)
return status;
}
*pfnum = state->fnum;
+ /* TODO - fill in *cr.. */
return NT_STATUS_OK;
}
@@ -1912,7 +1917,8 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
uint32_t CreateDisposition,
uint32_t CreateOptions,
uint8_t SecurityFlags,
- uint16_t *pfid)
+ uint16_t *pfid,
+ struct smb_create_returns *cr)
{
TALLOC_CTX *frame = NULL;
struct tevent_context *ev;
@@ -1929,7 +1935,7 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
CreateDisposition,
CreateOptions,
pfid,
- NULL);
+ cr);
}
frame = talloc_stackframe();
@@ -1962,7 +1968,7 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
goto fail;
}
- status = cli_ntcreate_recv(req, pfid);
+ status = cli_ntcreate_recv(req, pfid, cr);
fail:
TALLOC_FREE(frame);
return status;
@@ -1970,6 +1976,7 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
struct cli_nttrans_create_state {
uint16_t fnum;
+ struct smb_create_returns cr;
};
static void cli_nttrans_create_done(struct tevent_req *subreq);
@@ -2083,11 +2090,14 @@ static void cli_nttrans_create_done(struct tevent_req *subreq)
return;
}
state->fnum = SVAL(param, 2);
+ /* TODO - fill in state->cr.. */
TALLOC_FREE(param);
tevent_req_done(req);
}
-NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum)
+NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
+ uint16_t *fnum,
+ struct smb_create_returns *cr)
{
struct cli_nttrans_create_state *state = tevent_req_data(
req, struct cli_nttrans_create_state);
@@ -2097,6 +2107,7 @@ NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum)
return status;
}
*fnum = state->fnum;
+ /* TODO - fill in *cr.. */
return NT_STATUS_OK;
}
@@ -2112,7 +2123,8 @@ NTSTATUS cli_nttrans_create(struct cli_state *cli,
struct security_descriptor *secdesc,
struct ea_struct *eas,
int num_eas,
- uint16_t *pfid)
+ uint16_t *pfid,
+ struct smb_create_returns *cr)
{
TALLOC_CTX *frame = talloc_stackframe();
struct tevent_context *ev;
@@ -2141,7 +2153,7 @@ NTSTATUS cli_nttrans_create(struct cli_state *cli,
if (!tevent_req_poll_ntstatus(req, ev, &status)) {
goto fail;
}
- status = cli_nttrans_create_recv(req, pfid);
+ status = cli_nttrans_create_recv(req, pfid, cr);
fail:
TALLOC_FREE(frame);
return status;
@@ -2433,7 +2445,8 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
create_disposition,
create_options,
0,
- pfnum);
+ pfnum,
+ NULL);
/* Try and cope will all varients of "we don't do this call"
and fall back to openX. */
diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c
index 9136506..21dc72e 100644
--- a/source3/libsmb/cliquota.c
+++ b/source3/libsmb/cliquota.c
@@ -29,7 +29,7 @@ NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum)
return cli_ntcreate(cli, FAKE_FILE_NAME_QUOTA_WIN32,
0x00000016, DESIRED_ACCESS_PIPE,
0x00000000, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x00000000, 0x03, quota_fnum);
+ FILE_OPEN, 0x00000000, 0x03, quota_fnum, NULL);
}
void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list)
diff --git a/source3/libsmb/clisymlink.c b/source3/libsmb/clisymlink.c
index 338f932..eacae85 100644
--- a/source3/libsmb/clisymlink.c
+++ b/source3/libsmb/clisymlink.c
@@ -90,7 +90,7 @@ static void cli_symlink_create_done(struct tevent_req *subreq)
size_t data_len;
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->fnum);
+ status = cli_ntcreate_recv(subreq, &state->fnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
@@ -275,7 +275,7 @@ static void cli_readlink_opened(struct tevent_req *subreq)
req, struct cli_readlink_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->fnum);
+ status = cli_ntcreate_recv(subreq, &state->fnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 7d34290..8e6590a 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -904,7 +904,7 @@ cacl_get(SMBCCTX *context,
status = cli_ntcreate(targetcli, targetpath, 0,
CREATE_ACCESS_READ, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("cacl_get failed to open %s: %s\n",
targetpath, nt_errstr(status)));
@@ -1563,7 +1563,7 @@ cacl_set(SMBCCTX *context,
status = cli_ntcreate(targetcli, targetpath, 0, CREATE_ACCESS_READ, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum);
+ 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("cacl_set failed to open %s: %s\n",
targetpath, nt_errstr(status)));
@@ -1671,7 +1671,7 @@ cacl_set(SMBCCTX *context,
status = cli_ntcreate(targetcli, targetpath, 0,
WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum);
+ 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("cacl_set failed to open %s: %s\n",
targetpath, nt_errstr(status)));
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index a1389ff..525625c 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -356,7 +356,9 @@ struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
uint32_t CreateDisposition,
uint32_t CreateOptions,
uint8_t SecurityFlags);
-NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
+NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
+ uint16_t *pfnum,
+ struct smb_create_returns *cr);
NTSTATUS cli_ntcreate(struct cli_state *cli,
const char *fname,
uint32_t CreatFlags,
@@ -366,7 +368,8 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
uint32_t CreateDisposition,
uint32_t CreateOptions,
uint8_t SecurityFlags,
- uint16_t *pfid);
+ uint16_t *pfid,
+ struct smb_create_returns *cr);
uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
size_t str_len, size_t *pconverted_size);
uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
@@ -600,7 +603,9 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
struct security_descriptor *secdesc,
struct ea_struct *eas,
int num_eas);
-NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
+NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
+ uint16_t *fnum,
+ struct smb_create_returns *cr);
NTSTATUS cli_nttrans_create(struct cli_state *cli,
const char *fname,
uint32_t CreatFlags,
@@ -613,7 +618,8 @@ NTSTATUS cli_nttrans_create(struct cli_state *cli,
struct security_descriptor *secdesc,
struct ea_struct *eas,
int num_eas,
- uint16_t *pfid);
+ uint16_t *pfid,
+ struct smb_create_returns *cr);
/* The following definitions come from libsmb/clifsinfo.c */
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 533df67..2d6853a 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -610,7 +610,7 @@ static PyObject *py_cli_create(struct py_cli_state *self, PyObject *args,
if (!py_tevent_req_wait_exc(self->ev, req)) {
return NULL;
}
- status = cli_ntcreate_recv(req, &fnum);
+ status = cli_ntcreate_recv(req, &fnum, NULL);
TALLOC_FREE(req);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/torture/nbench.c b/source3/torture/nbench.c
index cb8a410..80b5a72 100644
--- a/source3/torture/nbench.c
+++ b/source3/torture/nbench.c
@@ -338,7 +338,7 @@ static void nbench_cmd_done(struct tevent_req *subreq)
switch (state->cmd->cmd) {
case NBENCH_CMD_NTCREATEX: {
struct ftable *ft;
- status = cli_ntcreate_recv(subreq, &state->ft->fnum);
+ status = cli_ntcreate_recv(subreq, &state->ft->fnum, NULL);
TALLOC_FREE(subreq);
if (status_wrong(req, state->cmd->status, status)) {
return;
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index fba83ea..ba4fa95 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -166,7 +166,7 @@ void nb_createx(const char *fname,
0x0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
create_disposition,
- create_options, 0, &fd);
+ create_options, 0, &fd, NULL);
if (!NT_STATUS_IS_OK(status) && handle != -1) {
printf("ERROR: cli_ntcreate failed for %s - %s\n",
fname, nt_errstr(status));
diff --git a/source3/torture/test_chain3.c b/source3/torture/test_chain3.c
index 7be8859..cad1a3f 100644
--- a/source3/torture/test_chain3.c
+++ b/source3/torture/test_chain3.c
@@ -234,7 +234,7 @@ static void chain3_ntcreate_done(struct tevent_req *subreq)
req, struct chain3_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->fnum);
+ status = cli_ntcreate_recv(subreq, &state->fnum, NULL);
TALLOC_FREE(subreq);
printf("cli_ntcreate returned %s, fnum=%u\n", nt_errstr(status),
(unsigned)state->fnum);
diff --git a/source3/torture/test_cleanup.c b/source3/torture/test_cleanup.c
index 319a55f..a831ed7 100644
--- a/source3/torture/test_cleanup.c
+++ b/source3/torture/test_cleanup.c
@@ -60,7 +60,7 @@ bool run_cleanup1(int dummy)
FILE_GENERIC_READ|FILE_GENERIC_WRITE|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, FILE_DELETE_ON_CLOSE, 0, &fnum);
+ FILE_OPEN, FILE_DELETE_ON_CLOSE, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("2nd open of %s failed (%s)\n", fname,
nt_errstr(status));
@@ -89,7 +89,7 @@ bool run_cleanup2(int dummy)
cli1, fname, 0, FILE_GENERIC_READ|FILE_GENERIC_WRITE,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
@@ -110,7 +110,7 @@ bool run_cleanup2(int dummy)
cli2, fname, 0, FILE_GENERIC_READ|FILE_GENERIC_WRITE,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
@@ -144,7 +144,7 @@ bool run_cleanup2(int dummy)
cli2, fname, 0, FILE_GENERIC_READ|FILE_GENERIC_WRITE,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
@@ -352,7 +352,7 @@ bool run_cleanup4(int dummy)
FILE_GENERIC_READ|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("creating file failed: %s\n",
nt_errstr(status));
@@ -364,7 +364,7 @@ bool run_cleanup4(int dummy)
FILE_GENERIC_READ|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("opening file 1st time failed: %s\n",
nt_errstr(status));
@@ -390,7 +390,7 @@ bool run_cleanup4(int dummy)
FILE_GENERIC_WRITE|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
printf("opening file 2nd time returned: %s\n",
nt_errstr(status));
diff --git a/source3/torture/test_notify.c b/source3/torture/test_notify.c
index 35e64bc..e377875 100644
--- a/source3/torture/test_notify.c
+++ b/source3/torture/test_notify.c
@@ -82,7 +82,7 @@ static void wait_for_one_notify_opened(struct tevent_req *subreq)
req, struct wait_for_one_notify_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->dnum);
+ status = cli_ntcreate_recv(subreq, &state->dnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
@@ -334,7 +334,7 @@ static void notify_bench3_mkdir1_done(struct tevent_req *subreq)
req, struct notify_bench3_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->dnum);
+ status = cli_ntcreate_recv(subreq, &state->dnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
@@ -471,7 +471,7 @@ static void notify_bench3_mksubdir_done(struct tevent_req *subreq)
req, struct notify_bench3_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->subdir_dnum);
+ status = cli_ntcreate_recv(subreq, &state->subdir_dnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
diff --git a/source3/torture/test_notify_online.c b/source3/torture/test_notify_online.c
index b59ce20..7f4f521 100644
--- a/source3/torture/test_notify_online.c
+++ b/source3/torture/test_notify_online.c
@@ -77,7 +77,7 @@ static void notify_online_opened_dir(struct tevent_req *subreq)
req, struct notify_online_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->dnum);
+ status = cli_ntcreate_recv(subreq, &state->dnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
@@ -131,7 +131,7 @@ static void notify_online_opened_file(struct tevent_req *subreq)
req, struct notify_online_state);
NTSTATUS status;
- status = cli_ntcreate_recv(subreq, &state->fnum);
+ status = cli_ntcreate_recv(subreq, &state->fnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
diff --git a/source3/torture/test_nttrans_create.c b/source3/torture/test_nttrans_create.c
index f6444e8..5e7ce7e 100644
--- a/source3/torture/test_nttrans_create.c
+++ b/source3/torture/test_nttrans_create.c
@@ -71,7 +71,7 @@ bool run_nttrans_create(int dummy)
READ_CONTROL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE| FILE_SHARE_DELETE,
- FILE_CREATE, 0, 0, sd, NULL, 0, &fnum);
+ FILE_CREATE, 0, 0, sd, NULL, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "cli_nttrans_create returned %s\n",
nt_errstr(status));
@@ -84,7 +84,7 @@ bool run_nttrans_create(int dummy)
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|
FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
status = cli_nt_delete_on_close(cli, fnum, true);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/torture/test_nttrans_fsctl.c b/source3/torture/test_nttrans_fsctl.c
index 963b20e..c2d8e68 100644
--- a/source3/torture/test_nttrans_fsctl.c
+++ b/source3/torture/test_nttrans_fsctl.c
@@ -51,7 +51,7 @@ bool run_nttrans_fsctl(int dummy)
READ_CONTROL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE| FILE_SHARE_DELETE,
- FILE_CREATE, 0, 0, NULL, NULL, 0, &fnum);
+ FILE_CREATE, 0, 0, NULL, NULL, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "cli_nttrans_create returned %s\n",
nt_errstr(status));
diff --git a/source3/torture/test_posix_append.c b/source3/torture/test_posix_append.c
index d4784e8..9f892e3 100644
--- a/source3/torture/test_posix_append.c
+++ b/source3/torture/test_posix_append.c
@@ -57,7 +57,7 @@ bool run_posix_append(int dummy)
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
FILE_OVERWRITE_IF,
FILE_NON_DIRECTORY_FILE|FILE_DELETE_ON_CLOSE,
- 0, &fnum);
+ 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_ntcreate failed: %s\n", nt_errstr(status));
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 0826506..95d8b33 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3873,7 +3873,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
- FILE_DELETE_ON_CLOSE, 0, &fnum1);
+ FILE_DELETE_ON_CLOSE, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[1] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -3900,7 +3900,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[2] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -3938,7 +3938,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] open - 1 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -3950,7 +3950,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("[3] open - 2 of %s succeeded - should have failed.\n", fname);
goto fail;
@@ -3960,7 +3960,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] open - 3 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4007,7 +4007,7 @@ static bool run_deletetest(int dummy)
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4017,7 +4017,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] open - 2 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4039,7 +4039,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("[4] open - 3 of %s succeeded ! Should have failed.\n", fname );
goto fail;
@@ -4086,7 +4086,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[6] open of %s failed (%s)\n", fname,
nt_errstr(status));
@@ -4116,7 +4116,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0,
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
- 0, 0, &fnum1);
+ 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4170,7 +4170,7 @@ static bool run_deletetest(int dummy)
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[8] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4180,7 +4180,7 @@ static bool run_deletetest(int dummy)
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[8] open 2 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4220,7 +4220,7 @@ static bool run_deletetest(int dummy)
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_NONE,
FILE_OVERWRITE_IF,
- FILE_DELETE_ON_CLOSE, 0, &fnum1);
+ FILE_DELETE_ON_CLOSE, 0, &fnum1, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("[9] open of %s succeeded should have failed!\n", fname);
goto fail;
@@ -4234,7 +4234,7 @@ static bool run_deletetest(int dummy)
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
FILE_OVERWRITE_IF, FILE_DELETE_ON_CLOSE,
- 0, &fnum1);
+ 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[10] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4266,7 +4266,7 @@ static bool run_deletetest(int dummy)
/* Create a readonly file. */
status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
FILE_ATTRIBUTE_READONLY, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[11] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4283,7 +4283,7 @@ static bool run_deletetest(int dummy)
FILE_READ_ATTRIBUTES|DELETE_ACCESS,
0,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum1);
+ FILE_OPEN, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[11] open of %s failed: %s\n", fname, nt_errstr(status));
goto fail;
@@ -4306,7 +4306,7 @@ static bool run_deletetest(int dummy)
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OVERWRITE_IF,
- FILE_DELETE_ON_CLOSE, 0, &fnum1);
+ FILE_DELETE_ON_CLOSE, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[12] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4315,7 +4315,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[12] open 2 of %s failed(%s).\n", fname, nt_errstr(status));
goto fail;
@@ -4337,7 +4337,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("[12] open 3 of %s succeeded - should fail).\n", fname);
goto fail;
@@ -4352,7 +4352,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("[12] open 4 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
@@ -4377,7 +4377,7 @@ static bool run_deletetest(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2);
+ FILE_OPEN, 0, 0, &fnum2, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("[12] open 5 of %s succeeded - should fail).\n", fname);
goto fail;
@@ -4460,7 +4460,7 @@ static bool run_deletetest_ln(int dummy)
status = cli_ntcreate(cli, fname, 0, FILE_READ_DATA,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN_IF, 0, 0, &fnum);
+ FILE_OPEN_IF, 0, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("ntcreate of %s failed (%s)\n", fname, nt_errstr(status));
return false;
@@ -4470,7 +4470,7 @@ static bool run_deletetest_ln(int dummy)
status = cli_ntcreate(cli, fname_ln, 0, DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN_IF, 0, 0, &fnum1);
+ FILE_OPEN_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("ntcreate of %s failed (%s)\n", fname_ln, nt_errstr(status));
return false;
@@ -4595,7 +4595,7 @@ static bool run_xcopy(int dummy)
status = cli_ntcreate(cli1, fname, 0, FIRST_DESIRED_ACCESS,
FILE_ATTRIBUTE_ARCHIVE, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0x4044, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0x4044, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("First open failed - %s\n", nt_errstr(status));
return False;
@@ -4603,7 +4603,7 @@ static bool run_xcopy(int dummy)
status = cli_ntcreate(cli1, fname, 0, SECOND_DESIRED_ACCESS, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0x200000, 0, &fnum2);
+ FILE_OPEN, 0x200000, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("second open failed - %s\n", nt_errstr(status));
return False;
@@ -4640,7 +4640,7 @@ static bool run_rename(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("First open failed - %s\n", nt_errstr(status));
return False;
@@ -4668,7 +4668,7 @@ static bool run_rename(int dummy)
#else
FILE_SHARE_DELETE|FILE_SHARE_READ,
#endif
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Second open failed - %s\n", nt_errstr(status));
return False;
@@ -4693,7 +4693,7 @@ static bool run_rename(int dummy)
status = cli_ntcreate(cli1, fname, 0, READ_CONTROL_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Third open failed - %s\n", nt_errstr(status));
return False;
@@ -4705,7 +4705,7 @@ static bool run_rename(int dummy)
uint16_t fnum2;
if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum2))) {
+ FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum2, NULL))) {
printf("Fourth open failed - %s\n", cli_errstr(cli1));
return False;
}
@@ -4743,7 +4743,7 @@ static bool run_rename(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Fourth open failed - %s\n", nt_errstr(status));
return False;
@@ -4771,7 +4771,7 @@ static bool run_rename(int dummy)
status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Fifth open failed - %s\n", nt_errstr(status));
return False;
@@ -4790,7 +4790,8 @@ static bool run_rename(int dummy)
*/
/* if (!NT_STATUS_OP(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OVERWRITE_IF, 0, 0, &fnum2))) {
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum2, NULL))) {
printf("Opening original file after rename of open file fails: %s\n",
cli_errstr(cli1));
}
@@ -4853,7 +4854,7 @@ static bool run_pipe_number(int dummy)
status = cli_ntcreate(cli1, pipe_name, 0, FILE_READ_DATA,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN_IF, 0, 0, &fnum);
+ FILE_OPEN_IF, 0, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Open of pipe %s failed with error (%s)\n", pipe_name, nt_errstr(status));
break;
@@ -5052,7 +5053,7 @@ static bool run_opentest(int dummy)
printf("TEST #1 testing 2 non-io opens (no delete)\n");
status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #1 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5060,7 +5061,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #1 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5087,7 +5088,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli1, fname, 0,
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #2 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5095,7 +5096,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #2 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5121,7 +5122,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #3 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5130,7 +5131,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli2, fname, 0,
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #3 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5157,7 +5158,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli1, fname, 0,
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #4 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5166,7 +5167,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli2, fname, 0,
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("TEST #4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5189,7 +5190,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli1, fname, 0,
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #5 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5198,7 +5199,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli2, fname, 0,
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #5 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5224,7 +5225,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #6 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5232,7 +5233,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #6 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5258,7 +5259,7 @@ static bool run_opentest(int dummy)
status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #7 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5268,7 +5269,7 @@ static bool run_opentest(int dummy)
DELETE_ACCESS|FILE_READ_ATTRIBUTES,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_DELETE,
- FILE_OPEN_IF, 0, 0, &fnum2);
+ FILE_OPEN_IF, 0, 0, &fnum2, NULL);
if (NT_STATUS_IS_OK(status)) {
printf("TEST #7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, nt_errstr(status));
return False;
@@ -5289,7 +5290,7 @@ static bool run_opentest(int dummy)
printf("TEST #8 testing open without WRITE_ATTRIBUTES, updating close write time.\n");
status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("TEST #8 open of %s failed (%s)\n", fname, nt_errstr(status));
correct = false;
@@ -5700,7 +5701,7 @@ static bool run_simple_posix_open_test(int dummy)
FILE_READ_DATA|FILE_WRITE_DATA, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
FILE_CREATE,
- 0x0, 0x0, &fnum2);
+ 0x0, 0x0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Windows create of %s failed (%s)\n", fname_windows,
nt_errstr(status));
@@ -5834,7 +5835,7 @@ static bool run_openattrtest(int dummy)
status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA,
open_attrs_table[i], FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("open %d (1) of %s failed (%s)\n", i, fname, nt_errstr(status));
return False;
@@ -5851,7 +5852,7 @@ static bool run_openattrtest(int dummy)
FILE_READ_DATA|FILE_WRITE_DATA,
open_attrs_table[j],
FILE_SHARE_NONE, FILE_OVERWRITE,
- 0, 0, &fnum1);
+ 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
for (l = 0; l < sizeof(attr_results)/sizeof(struct trunc_open_results); l++) {
if (attr_results[l].num == k) {
@@ -6187,7 +6188,7 @@ static bool run_eatest(int dummy)
status = cli_ntcreate(cli, fname, 0,
FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
FILE_SHARE_NONE, FILE_OVERWRITE_IF,
- 0x4044, 0, &fnum);
+ 0x4044, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("open failed - %s\n", nt_errstr(status));
talloc_destroy(mem_ctx);
@@ -6321,7 +6322,8 @@ static bool run_dirtest1(int dummy)
fstring fname;
slprintf(fname, sizeof(fname), "\\LISTDIR\\f%d", i);
if (!NT_STATUS_IS_OK(cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum))) {
+ FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
+ 0, 0, &fnum, NULL))) {
fprintf(stderr,"Failed to open %s\n", fname);
return False;
}
@@ -6516,7 +6518,7 @@ static bool run_sesssetup_bench(int dummy)
status = cli_ntcreate(c, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
- FILE_DELETE_ON_CLOSE, 0, &fnum);
+ FILE_DELETE_ON_CLOSE, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("open %s failed: %s\n", fname, nt_errstr(status));
return false;
@@ -6752,7 +6754,7 @@ static void torture_createdel_created(struct tevent_req *subreq)
NTSTATUS status;
uint16_t fnum;
- status = cli_ntcreate_recv(subreq, &fnum);
+ status = cli_ntcreate_recv(subreq, &fnum, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
DEBUG(10, ("cli_ntcreate_recv returned %s\n",
@@ -7055,7 +7057,7 @@ static bool run_notify_bench(int dummy)
0, FILE_SHARE_READ|FILE_SHARE_WRITE|
FILE_SHARE_DELETE,
FILE_OPEN_IF, FILE_DIRECTORY_FILE, 0,
- &dnum);
+ &dnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Could not create %s: %s\n", dname,
@@ -7125,7 +7127,7 @@ static bool run_mangle1(int dummy)
status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
- 0, 0, &fnum);
+ 0, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("open %s failed: %s\n", fname, nt_errstr(status));
return false;
@@ -7401,7 +7403,7 @@ static bool run_large_readx(int dummy)
/* Create a file of size 4MB. */
status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
- 0, 0, &fnum1);
+ 0, 0, &fnum1, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("open %s failed: %s\n", fname, nt_errstr(status));
@@ -7510,7 +7512,7 @@ static bool run_large_readx(int dummy)
status = cli_ntcreate(cli2, fname, 0, FILE_READ_DATA,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN,
- 0, 0, &fnum2);
+ 0, 0, &fnum2, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Second open %s failed: %s\n", fname, nt_errstr(status));
goto out;
@@ -7792,7 +7794,8 @@ static bool run_shortname_test(int dummy)
fname[15] = i;
status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum);
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) cli_nt_create of %s failed: %s\n",
__location__, fname, nt_errstr(status));
@@ -8048,7 +8051,7 @@ static bool run_streamerror(int dummy)
FILE_READ_DATA|FILE_READ_EA|
FILE_READ_ATTRIBUTES|READ_CONTROL_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
- FILE_OPEN, 0, 0, &fnum);
+ FILE_OPEN, 0, 0, &fnum, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
printf("ntcreate returned %s, expected "
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index a2db3ba..2733091 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -164,7 +164,7 @@ bool torture_casetable(int dummy)
GENERIC_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_NONE,
- FILE_OPEN_IF, 0, 0, &fnum))) {
+ FILE_OPEN_IF, 0, 0, &fnum, NULL))) {
printf("Failed to create file with char %04x\n", c);
continue;
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 778e888..b5c4d0b 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -5104,7 +5104,8 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
}
if (!NT_STATUS_IS_OK(cli_ntcreate(cli, "\\", 0, READ_CONTROL_ACCESS, 0,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum))) {
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL))) {
cli_query_secdesc(cli, fnum, mem_ctx, &root_sd);
}
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 7ff8386..3cdac62 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -177,7 +177,7 @@ NTSTATUS net_copy_fileattr(struct net_context *c,
nt_status = cli_ntcreate(cli_share_src, src_name, 0,
READ_CONTROL_ACCESS, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum_src);
+ 0x0, 0x0, &fnum_src, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUGADD(0,("cannot open %s %s on originating server %s\n",
is_file?"file":"dir", src_name, nt_errstr(nt_status)));
@@ -214,7 +214,7 @@ NTSTATUS net_copy_fileattr(struct net_context *c,
nt_status = cli_ntcreate(cli_share_dst, dst_name, 0,
WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum_dst);
+ 0x0, 0x0, &fnum_dst, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0,("failed to open %s on the destination server: %s: %s\n",
is_file?"file":"dir", dst_name, nt_errstr(nt_status)));
@@ -331,7 +331,8 @@ NTSTATUS net_copy_file(struct net_context *c,
nt_status = cli_open(cli_share_src, src_name, O_RDONLY, DENY_NONE, &fnum_src);
else
nt_status = cli_ntcreate(cli_share_src, src_name, 0, READ_CONTROL_ACCESS, 0,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum_src);
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN, 0x0, 0x0, &fnum_src, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUGADD(0,("cannot open %s %s on originating server %s\n",
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 8d3071c..684fe79 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -810,7 +810,7 @@ static uint16 get_fileinfo(struct cli_state *cli, const char *filename)
status = cli_ntcreate(cli, filename, 0, CREATE_ACCESS_READ,
0, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open %s: %s\n", filename, nt_errstr(status));
return 0;
@@ -858,7 +858,7 @@ static struct security_descriptor *get_secdesc(struct cli_state *cli, const char
status = cli_ntcreate(cli, filename, 0, desired_access,
0, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open %s: %s\n", filename, nt_errstr(status));
return NULL;
@@ -922,7 +922,7 @@ static bool set_secdesc(struct cli_state *cli, const char *filename,
status = cli_ntcreate(cli, filename, 0,
desired_access,
0, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open %s: %s\n", filename, nt_errstr(status));
return false;
--
1.9.1
>From 91579d52f9f981838b06b179b3210b04ea965a8c Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Thu, 8 May 2014 21:23:22 -0700
Subject: [PATCH 3/4] s3: client : correctly fill in the struct
smb_create_returns from cli_ntcreate(), cli_ntcreate_recv(),
cli_nttrans_create() and cli_nttrans_create_recv().
This completes the update of the create API to return
all the data returned by the server on open.
We can now use this data to detect buggy servers
without an extra round trip.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/libsmb/clifile.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index bd886ea..7f562a80 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -1881,14 +1881,23 @@ static void cli_ntcreate_done(struct tevent_req *subreq)
uint8_t *bytes;
NTSTATUS status;
- status = cli_smb_recv(subreq, state, NULL, 3, &wct, &vwv,
+ status = cli_smb_recv(subreq, state, NULL, 34, &wct, &vwv,
&num_bytes, &bytes);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
}
+ state->cr.oplock_level = CVAL(vwv+2, 0);
state->fnum = SVAL(vwv+2, 1);
- /* TODO - fill in state->cr.. */
+ state->cr.create_action = IVAL(vwv+3, 1);
+ state->cr.creation_time = BVAL(vwv+5, 1);
+ state->cr.last_access_time = BVAL(vwv+9, 1);
+ state->cr.last_write_time = BVAL(vwv+13, 1);
+ state->cr.change_time = BVAL(vwv+17, 1);
+ state->cr.file_attributes = IVAL(vwv+21, 1);
+ state->cr.allocation_size = BVAL(vwv+23, 1);
+ state->cr.end_of_file = BVAL(vwv+27, 1);
+
tevent_req_done(req);
}
@@ -1904,7 +1913,9 @@ NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
return status;
}
*pfnum = state->fnum;
- /* TODO - fill in *cr.. */
+ if (cr != NULL) {
+ *cr = state->cr;
+ }
return NT_STATUS_OK;
}
@@ -2089,8 +2100,17 @@ static void cli_nttrans_create_done(struct tevent_req *subreq)
if (tevent_req_nterror(req, status)) {
return;
}
+ state->cr.oplock_level = CVAL(param, 0);
state->fnum = SVAL(param, 2);
- /* TODO - fill in state->cr.. */
+ state->cr.create_action = IVAL(param, 4);
+ state->cr.creation_time = BVAL(param, 12);
+ state->cr.last_access_time = BVAL(param, 20);
+ state->cr.last_write_time = BVAL(param, 28);
+ state->cr.change_time = BVAL(param, 36);
+ state->cr.file_attributes = IVAL(param, 44);
+ state->cr.allocation_size = BVAL(param, 48);
+ state->cr.end_of_file = BVAL(param, 56);
+
TALLOC_FREE(param);
tevent_req_done(req);
}
@@ -2107,7 +2127,9 @@ NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
return status;
}
*fnum = state->fnum;
- /* TODO - fill in *cr.. */
+ if (cr != NULL) {
+ *cr = state->cr;
+ }
return NT_STATUS_OK;
}
--
1.9.1
>From b7e8bd1372a9e8ea3d982e53d99b1334f78a8968 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Thu, 8 May 2014 21:31:49 -0700
Subject: [PATCH 4/4] s3: libsmbclient: Work around bugs in SLES cifsd and
Apple smbx SMB1 servers.
SLES's cifsd and Apple's smbx do not correctly handle FILE_NON_DIRECTORY_FILE
which prevents recursive copies in gvfs from working correctly [1] since GVFS
tries to open the directory, expecting ENOTDIR, but it suceeds and appears as a
zero byte file.
This fix adds code to the cli_open() open code that checks if
CreateOptions was requested with FILE_NON_DIRECTORY_FILE set,
and if the attributes returned include FILE_ATTRIBUTE_DIRECTORY
we synchronously close the file handle just opened, and return
NT_STATUS_FILE_IS_A_DIRECTORY to the caller.
Depends on the previous API update to cli_ntcreate()
to add returned attributes.
Fixes bug #10587 - Opening directories on SLES's cifsd and Apple's smbx succeeds.
https://bugzilla.samba.org/show_bug.cgi?id=10587
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/libsmb/clifile.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 7f562a80..35c6bb3 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -2387,6 +2387,7 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
unsigned int openfn = 0;
unsigned int dos_deny = 0;
uint32_t access_mask, share_mode, create_disposition, create_options;
+ struct smb_create_returns cr;
/* Do the initial mapping into OpenX parameters. */
if (flags & O_CREAT) {
@@ -2468,7 +2469,7 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
create_options,
0,
pfnum,
- NULL);
+ &cr);
/* Try and cope will all varients of "we don't do this call"
and fall back to openX. */
@@ -2485,6 +2486,24 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
goto try_openx;
}
+ if (NT_STATUS_IS_OK(status) &&
+ (create_options & FILE_NON_DIRECTORY_FILE) &&
+ (cr.file_attributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ /*
+ * Some (broken) servers return a valid handle
+ * for directories even if FILE_NON_DIRECTORY_FILE
+ * is set. Just close the handle and set the
+ * error explicitly to NT_STATUS_FILE_IS_A_DIRECTORY.
+ */
+ status = cli_close(cli, *pfnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ status = NT_STATUS_FILE_IS_A_DIRECTORY;
+ /* Set this so libsmbclient can retrieve it. */
+ cli->raw_status = status;
+ }
+
return status;
try_openx:
--
1.9.1
More information about the samba-technical
mailing list