summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-11-28 14:10:26 -0800
committerRalph Boehme <slow@samba.org>2017-12-06 15:02:16 +0100
commitcd0e0b112001e122ef1e4fa3434eda32ffd50e46 (patch)
tree54e056c2a6102d5711bafd4aa46f0e34463569ed /source3/libsmb
parent4581bfe76ce924d170f2dd2b436ca9acc1b8ec37 (diff)
downloadsamba-cd0e0b112001e122ef1e4fa3434eda32ffd50e46.tar.gz
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@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clisymlink.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/source3/libsmb/clisymlink.c b/source3/libsmb/clisymlink.c
index a52f6ff7f6d..202435722c9 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 */
+
+
+ subreq = cli_trans_send(state, state->ev, state->cli, 0,
+ SMBnttrans,
NULL, -1, /* name, fid */
NT_TRANSACT_IOCTL, 0,
state->setup, 4, 0, /* setup */
NULL, 0, 0, /* param */
- data, data_len, 0); /* data */
+ data.data, data.length, 0); /* data */
+ }
+
if (tevent_req_nomem(subreq, req)) {
return;
}
@@ -127,11 +137,16 @@ static void cli_symlink_set_reparse_done(struct tevent_req *subreq)
struct cli_symlink_state *state = tevent_req_data(
req, struct cli_symlink_state);
- state->set_reparse_status = cli_trans_recv(
- subreq, NULL, NULL,
- NULL, 0, NULL, /* rsetup */
- NULL, 0, NULL, /* rparam */
- NULL, 0, NULL); /* rdata */
+ if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
+ state->set_reparse_status =
+ cli_smb2_set_reparse_point_fnum_recv(subreq);
+ } else {
+ state->set_reparse_status = cli_trans_recv(
+ subreq, NULL, NULL,
+ NULL, 0, NULL, /* rsetup */
+ NULL, 0, NULL, /* rparam */
+ NULL, 0, NULL); /* rdata */
+ }
TALLOC_FREE(subreq);
if (NT_STATUS_IS_OK(state->set_reparse_status)) {