[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Dec 6 18:06:03 UTC 2017


The branch, master has been updated
       via  a852926 s3: libsmb: Plumb in the new SMB2 get reparse point calls into the cli_readlink_XXXX() calls.
       via  a373a8a s3: libsmb: Add SMB2 calls cli_smb2_get_reparse_point_fnum_send()/cli_smb2_get_reparse_point_fnum_recv().
       via  eb3028a s3: libsmb: Do a naive response to SMB2 "stopped on symlink". Assume the last component was the reparse point.
       via  cd0e0b1 s3: libsmb: Plumb in the new SMB2 reparse point calls into the cli_symlink_create_XXX() calls.
       via  4581bfe s3: libsmb: Add SMB2 calls cli_smb2_set_reparse_point_fnum_send()/cli_smb2_set_reparse_point_fnum_recv().
       via  1b6e8e5 s3: libsmb: Make cli_close_send()/cli_close_recv() work for SMB1 and SMB2.
       via  f29b592 s3: libsmb: Rename cli_close_create() -> cli_smb1_close_create().
      from  9e1f792 vfs: drop casts for VFS_ADD_FSP_EXTENSION() callers

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a852926157af7c35d4ef5f966138a596baca4c2b
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Nov 29 12:38:08 2017 -0800

    s3: libsmb: Plumb in the new SMB2 get reparse point calls into the cli_readlink_XXXX() calls.
    
    Reparse point symlinks can now be queried over SMB1 and SMB2 from smbclient.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Dec  6 19:05:34 CET 2017 on sn-devel-144

commit a373a8a537f351cf5fae8f3ca0b18bdbfac2cd3e
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Nov 29 12:37:36 2017 -0800

    s3: libsmb: Add SMB2 calls cli_smb2_get_reparse_point_fnum_send()/cli_smb2_get_reparse_point_fnum_recv().
    
    Allow reparse points to be queried over SMB2.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit eb3028a46f263642b9ab4afddbd2d0034443eb0b
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 28 15:46:40 2017 -0800

    s3: libsmb: Do a naive response to SMB2 "stopped on symlink". Assume the last component was the reparse point.
    
    Attempt re-open with FILE_OPEN_REPARSE_POINT. This matches the SMB1
    behavior for smbclient.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit cd0e0b112001e122ef1e4fa3434eda32ffd50e46
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 28 14:10:26 2017 -0800

    s3: libsmb: Plumb in the new SMB2 reparse point calls into the cli_symlink_create_XXX() calls.
    
    Reparse point symlinks can now be created over SMB1 and SMB2 from
    smbclient.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 4581bfe76ce924d170f2dd2b436ca9acc1b8ec37
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 28 14:09:39 2017 -0800

    s3: libsmb: Add SMB2 calls cli_smb2_set_reparse_point_fnum_send()/cli_smb2_set_reparse_point_fnum_recv().
    
    Allow reparse points to be created over SMB2.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 1b6e8e52f0a5beb4eb0da0a8d6483dd7914010e1
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 27 14:38:49 2017 -0800

    s3: libsmb: Make cli_close_send()/cli_close_recv() work for SMB1 and SMB2.
    
    Remove the escape into synchronous smb2 code.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f29b59239e59c6c9bc3bd8971b3251c6b3b33cba
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Nov 22 00:47:48 2017 +0000

    s3: libsmb: Rename cli_close_create() -> cli_smb1_close_create().
    
    Move cli_smb1_close_done() next to its caller. This is SMB1 specific.
    Prepare to wrap cli_close_send/cli_close_recv to handle SMB2.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/cli_smb2_fnum.c | 258 ++++++++++++++++++++++++++++++++++++++++-
 source3/libsmb/cli_smb2_fnum.h |  17 +++
 source3/libsmb/clifile.c       |  69 ++++++++---
 source3/libsmb/clisymlink.c    |  88 +++++++++-----
 source3/libsmb/proto.h         |   2 +-
 source3/torture/test_chain3.c  |   2 +-
 source3/torture/torture.c      |   2 +-
 7 files changed, 391 insertions(+), 47 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 78f61fb..2d87b58 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -686,6 +686,27 @@ NTSTATUS cli_smb2_rmdir(struct cli_state *cli, const char *dname)
 			&fnum,
 			NULL);
 
+	if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+		/*
+		 * Naive option to match our SMB1 code. Assume the
+		 * symlink path that tripped us up was the last
+		 * component and try again. Eventually we will have to
+		 * deal with the returned path unprocessed component. JRA.
+		 */
+		status = cli_smb2_create_fnum(cli,
+			dname,
+			0,			/* create_flags */
+			DELETE_ACCESS,		/* desired_access */
+			FILE_ATTRIBUTE_DIRECTORY, /* file attributes */
+			FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access */
+			FILE_OPEN,		/* create_disposition */
+			FILE_DIRECTORY_FILE|
+				FILE_DELETE_ON_CLOSE|
+				FILE_OPEN_REPARSE_POINT, /* create_options */
+			&fnum,
+			NULL);
+	}
+
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
@@ -724,6 +745,26 @@ NTSTATUS cli_smb2_unlink(struct cli_state *cli, const char *fname)
 			&fnum,
 			NULL);
 
+	if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+		/*
+		 * Naive option to match our SMB1 code. Assume the
+		 * symlink path that tripped us up was the last
+		 * component and try again. Eventually we will have to
+		 * deal with the returned path unprocessed component. JRA.
+		 */
+		status = cli_smb2_create_fnum(cli,
+			fname,
+			0,			/* create_flags */
+			DELETE_ACCESS,		/* desired_access */
+			FILE_ATTRIBUTE_NORMAL, /* file attributes */
+			FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access */
+			FILE_OPEN,		/* create_disposition */
+			FILE_DELETE_ON_CLOSE|
+				FILE_OPEN_REPARSE_POINT, /* create_options */
+			&fnum,
+			NULL);
+	}
+
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
@@ -1157,6 +1198,7 @@ static NTSTATUS get_fnum_from_path(struct cli_state *cli,
 	NTSTATUS status;
 	size_t namelen = strlen(name);
 	TALLOC_CTX *frame = talloc_stackframe();
+	uint32_t create_options = 0;
 
 	/* SMB2 is pickier about pathnames. Ensure it doesn't
 	   end in a '\' */
@@ -1178,11 +1220,32 @@ static NTSTATUS get_fnum_from_path(struct cli_state *cli,
 			0, /* file attributes */
 			FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access */
 			FILE_OPEN,		/* create_disposition */
-			0,	/* create_options */
+			create_options,
 			pfnum,
 			NULL);
 
+	if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+		/*
+		 * Naive option to match our SMB1 code. Assume the
+		 * symlink path that tripped us up was the last
+		 * component and try again. Eventually we will have to
+		 * deal with the returned path unprocessed component. JRA.
+		 */
+		create_options |= FILE_OPEN_REPARSE_POINT;
+		status = cli_smb2_create_fnum(cli,
+			name,
+			0,			/* create_flags */
+			desired_access,
+			0, /* file attributes */
+			FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access */
+			FILE_OPEN,		/* create_disposition */
+			create_options,
+			pfnum,
+			NULL);
+	}
+
 	if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
+		create_options |= FILE_DIRECTORY_FILE;
 		status = cli_smb2_create_fnum(cli,
 			name,
 			0,			/* create_flags */
@@ -4181,3 +4244,196 @@ fail:
 	TALLOC_FREE(frame);
 	return status;
 }
+
+struct cli_smb2_set_reparse_point_fnum_state {
+	struct cli_state *cli;
+	uint16_t fnum;
+	struct smb2_hnd *ph;
+	DATA_BLOB input_buffer;
+};
+
+static void cli_smb2_set_reparse_point_fnum_done(struct tevent_req *subreq);
+
+struct tevent_req *cli_smb2_set_reparse_point_fnum_send(
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct cli_state *cli,
+				uint16_t fnum,
+				DATA_BLOB in_buf)
+{
+	struct tevent_req *req, *subreq;
+	struct cli_smb2_set_reparse_point_fnum_state *state = NULL;
+	NTSTATUS status;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct cli_smb2_set_reparse_point_fnum_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) {
+		tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+		return tevent_req_post(req, ev);
+	}
+
+	state->cli = cli;
+	state->fnum = fnum;
+
+	status = map_fnum_to_smb2_handle(cli, fnum, &state->ph);
+	if (tevent_req_nterror(req, status)) {
+		return tevent_req_post(req, ev);
+	}
+
+	state->input_buffer = data_blob_talloc(state,
+						in_buf.data,
+						in_buf.length);
+	if (state->input_buffer.data == NULL) {
+		tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
+		return tevent_req_post(req, ev);
+	}
+
+	subreq = smb2cli_ioctl_send(state, ev, state->cli->conn,
+			state->cli->timeout,
+			state->cli->smb2.session,
+			state->cli->smb2.tcon,
+			state->ph->fid_persistent, /* in_fid_persistent */
+			state->ph->fid_volatile, /* in_fid_volatile */
+			FSCTL_SET_REPARSE_POINT,
+			0, /* in_max_input_length */
+			&state->input_buffer ,
+			0,
+			NULL,
+			SMB2_IOCTL_FLAG_IS_FSCTL);
+
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq,
+				cli_smb2_set_reparse_point_fnum_done,
+				req);
+
+	return req;
+}
+
+static void cli_smb2_set_reparse_point_fnum_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct cli_smb2_set_reparse_point_fnum_state *state = tevent_req_data(
+		req, struct cli_smb2_set_reparse_point_fnum_state);
+	NTSTATUS status;
+
+	status = smb2cli_ioctl_recv(subreq, state,
+				NULL,
+				NULL);
+	TALLOC_FREE(subreq);
+	if (tevent_req_nterror(req, status)) {
+		return;
+	}
+	tevent_req_done(req);
+}
+
+NTSTATUS cli_smb2_set_reparse_point_fnum_recv(struct tevent_req *req)
+{
+        return tevent_req_simple_recv_ntstatus(req);
+}
+
+struct cli_smb2_get_reparse_point_fnum_state {
+	struct cli_state *cli;
+	uint16_t fnum;
+	struct smb2_hnd *ph;
+	DATA_BLOB output_buffer;
+};
+
+static void cli_smb2_get_reparse_point_fnum_done(struct tevent_req *subreq);
+
+struct tevent_req *cli_smb2_get_reparse_point_fnum_send(
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct cli_state *cli,
+				uint16_t fnum)
+{
+	struct tevent_req *req, *subreq;
+	struct cli_smb2_set_reparse_point_fnum_state *state = NULL;
+	NTSTATUS status;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct cli_smb2_get_reparse_point_fnum_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) {
+		tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+		return tevent_req_post(req, ev);
+	}
+
+	state->cli = cli;
+	state->fnum = fnum;
+
+	status = map_fnum_to_smb2_handle(cli, fnum, &state->ph);
+	if (tevent_req_nterror(req, status)) {
+		return tevent_req_post(req, ev);
+	}
+
+	subreq = smb2cli_ioctl_send(state, ev, state->cli->conn,
+			state->cli->timeout,
+			state->cli->smb2.session,
+			state->cli->smb2.tcon,
+			state->ph->fid_persistent, /* in_fid_persistent */
+			state->ph->fid_volatile, /* in_fid_volatile */
+			FSCTL_GET_REPARSE_POINT,
+			0, /* in_max_input_length */
+			NULL,
+			64*1024,
+			NULL,
+			SMB2_IOCTL_FLAG_IS_FSCTL);
+
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq,
+				cli_smb2_get_reparse_point_fnum_done,
+				req);
+
+	return req;
+}
+
+static void cli_smb2_get_reparse_point_fnum_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct cli_smb2_get_reparse_point_fnum_state *state = tevent_req_data(
+		req, struct cli_smb2_get_reparse_point_fnum_state);
+	NTSTATUS status;
+
+	status = smb2cli_ioctl_recv(subreq, state,
+				NULL,
+				&state->output_buffer);
+	TALLOC_FREE(subreq);
+	if (tevent_req_nterror(req, status)) {
+		state->cli->raw_status = status;
+		return;
+	}
+	tevent_req_done(req);
+}
+
+NTSTATUS cli_smb2_get_reparse_point_fnum_recv(struct tevent_req *req,
+				TALLOC_CTX *mem_ctx,
+				DATA_BLOB *output)
+{
+	struct cli_smb2_get_reparse_point_fnum_state *state = tevent_req_data(
+		req, struct cli_smb2_get_reparse_point_fnum_state);
+
+	if (tevent_req_is_nterror(req, &state->cli->raw_status)) {
+		tevent_req_received(req);
+		return state->cli->raw_status;
+	}
+	*output = data_blob_dup_talloc(mem_ctx, state->output_buffer);
+	if (output->data == NULL) {
+		tevent_req_received(req);
+		return NT_STATUS_NO_MEMORY;
+	}
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
diff --git a/source3/libsmb/cli_smb2_fnum.h b/source3/libsmb/cli_smb2_fnum.h
index 3d9b6eb..0ceddd0 100644
--- a/source3/libsmb/cli_smb2_fnum.h
+++ b/source3/libsmb/cli_smb2_fnum.h
@@ -242,4 +242,21 @@ NTSTATUS cli_smb2_notify(struct cli_state *cli, uint16_t fnum,
 			 bool recursive, TALLOC_CTX *mem_ctx,
 			 struct notify_change **pchanges,
 			 uint32_t *pnum_changes);
+struct tevent_req *cli_smb2_set_reparse_point_fnum_send(
+			TALLOC_CTX *mem_ctx,
+			struct tevent_context *ev,
+			struct cli_state *cli,
+			uint16_t fnum,
+			DATA_BLOB in_buf);
+NTSTATUS cli_smb2_set_reparse_point_fnum_recv(struct tevent_req *req);
+
+struct tevent_req *cli_smb2_get_reparse_point_fnum_send(
+			TALLOC_CTX *mem_ctx,
+			struct tevent_context *ev,
+			struct cli_state *cli,
+			uint16_t fnum);
+NTSTATUS cli_smb2_get_reparse_point_fnum_recv(struct tevent_req *req,
+			TALLOC_CTX *mem_ctx,
+			DATA_BLOB *output);
+
 #endif /* __SMB2CLI_FNUM_H__ */
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index e942b27..5f6e98c 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -2770,22 +2770,22 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
  Close a file.
 ****************************************************************************/
 
-struct cli_close_state {
+struct cli_smb1_close_state {
 	uint16_t vwv[3];
 };
 
-static void cli_close_done(struct tevent_req *subreq);
+static void cli_smb1_close_done(struct tevent_req *subreq);
 
-struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
+struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
 				struct tevent_context *ev,
 				struct cli_state *cli,
 				uint16_t fnum,
 				struct tevent_req **psubreq)
 {
 	struct tevent_req *req, *subreq;
-	struct cli_close_state *state;
+	struct cli_smb1_close_state *state;
 
-	req = tevent_req_create(mem_ctx, &state, struct cli_close_state);
+	req = tevent_req_create(mem_ctx, &state, struct cli_smb1_close_state);
 	if (req == NULL) {
 		return NULL;
 	}
@@ -2799,28 +2799,66 @@ struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
 		TALLOC_FREE(req);
 		return NULL;
 	}
-	tevent_req_set_callback(subreq, cli_close_done, req);
+	tevent_req_set_callback(subreq, cli_smb1_close_done, req);
 	*psubreq = subreq;
 	return req;
 }
 
+static void cli_smb1_close_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	NTSTATUS status;
+
+	status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
+	TALLOC_FREE(subreq);
+	if (tevent_req_nterror(req, status)) {
+		return;
+	}
+	tevent_req_done(req);
+}
+
+struct cli_close_state {
+	int dummy;
+};
+
+static void cli_close_done(struct tevent_req *subreq);
+
 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
 				struct tevent_context *ev,
 				struct cli_state *cli,
 				uint16_t fnum)
 {
 	struct tevent_req *req, *subreq;
+	struct cli_close_state *state;
 	NTSTATUS status;
 
-	req = cli_close_create(mem_ctx, ev, cli, fnum, &subreq);
+	req = tevent_req_create(mem_ctx, &state, struct cli_close_state);
 	if (req == NULL) {
 		return NULL;
 	}
 
-	status = smb1cli_req_chain_submit(&subreq, 1);
-	if (tevent_req_nterror(req, status)) {
-		return tevent_req_post(req, ev);
+	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+		subreq = cli_smb2_close_fnum_send(state,
+						ev,
+						cli,
+						fnum);
+		if (tevent_req_nomem(subreq, req)) {
+			return tevent_req_post(req, ev);
+		}
+	} else {
+		struct tevent_req *ch_req = NULL;
+		subreq = cli_smb1_close_create(state, ev, cli, fnum, &ch_req);
+		if (tevent_req_nomem(subreq, req)) {
+			return tevent_req_post(req, ev);
+		}
+		status = smb1cli_req_chain_submit(&ch_req, 1);
+		if (tevent_req_nterror(req, status)) {
+			return tevent_req_post(req, ev);
+		}
 	}
+
+	tevent_req_set_callback(subreq, cli_close_done, req);
 	return req;
 }
 
@@ -2828,11 +2866,12 @@ static void cli_close_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
-	NTSTATUS status;
+	NTSTATUS status = NT_STATUS_OK;
+	bool err = tevent_req_is_nterror(subreq, &status);
 
-	status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
 	TALLOC_FREE(subreq);
-	if (tevent_req_nterror(req, status)) {
+	if (err) {
+		tevent_req_nterror(req, status);
 		return;
 	}
 	tevent_req_done(req);
@@ -2850,10 +2889,6 @@ NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum)
 	struct tevent_req *req;
 	NTSTATUS status = NT_STATUS_OK;
 
-	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
-		return cli_smb2_close_fnum(cli, fnum);
-	}
-
 	frame = talloc_stackframe();
 
 	if (smbXcli_conn_has_async_calls(cli->conn)) {
diff --git a/source3/libsmb/clisymlink.c b/source3/libsmb/clisymlink.c
index a52f6ff..54435e4 100644
--- a/source3/libsmb/clisymlink.c
+++ b/source3/libsmb/clisymlink.c
@@ -86,8 +86,7 @@ static void cli_symlink_create_done(struct tevent_req *subreq)
 		subreq, struct tevent_req);
 	struct cli_symlink_state *state = tevent_req_data(
 		req, struct cli_symlink_state);
-	uint8_t *data;
-	size_t data_len;
+	DATA_BLOB data;
 	NTSTATUS status;
 
 	status = cli_ntcreate_recv(subreq, &state->fnum, NULL);
@@ -96,24 +95,35 @@ static void cli_symlink_create_done(struct tevent_req *subreq)
 		return;
 	}
 
-	SIVAL(state->setup, 0, FSCTL_SET_REPARSE_POINT);
-	SSVAL(state->setup, 4, state->fnum);
-	SCVAL(state->setup, 6, 1); /* IsFcntl */
-	SCVAL(state->setup, 7, 0); /* IsFlags */
-
 	if (!symlink_reparse_buffer_marshall(
 		    state->link_target, NULL, state->flags, state,
-		    &data, &data_len)) {
+		    &data.data, &data.length)) {
 		tevent_req_oom(req);
 		return;
 	}
 
-	subreq = cli_trans_send(state, state->ev, state->cli, 0, SMBnttrans,
+	if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
+		subreq = cli_smb2_set_reparse_point_fnum_send(state,
+						state->ev,
+						state->cli,
+						state->fnum,
+						data);
+	} else {
+		SIVAL(state->setup, 0, FSCTL_SET_REPARSE_POINT);
+		SSVAL(state->setup, 4, state->fnum);
+		SCVAL(state->setup, 6, 1); /* IsFcntl */
+		SCVAL(state->setup, 7, 0); /* IsFlags */
+
+


-- 
Samba Shared Repository



More information about the samba-cvs mailing list