mirror of
https://github.com/samba-team/samba.git
synced 2025-02-24 13:57:43 +03:00
libsmb: Return symlink error struct from smb2cli_create_recv()
Looks larger than it is, this just adds a parameter and while there adapts long lines to README.Coding Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
218baae2d3
commit
0c419b8a20
@ -267,8 +267,14 @@ static void cli_get_unixattr_opened(struct tevent_req *subreq)
|
||||
struct cli_state *cli = state->cli;
|
||||
NTSTATUS status;
|
||||
|
||||
status = smb2cli_create_recv(subreq, &state->fid_persistent,
|
||||
&state->fid_volatile, NULL, NULL, NULL);
|
||||
status = smb2cli_create_recv(
|
||||
subreq,
|
||||
&state->fid_persistent,
|
||||
&state->fid_volatile,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
TALLOC_FREE(subreq);
|
||||
if (tevent_req_nterror(req, status)) {
|
||||
DBG_DEBUG("smb2cli_create_recv returned %s\n",
|
||||
@ -1174,10 +1180,14 @@ static void cli_ll_opendir_done(struct tevent_req *req)
|
||||
req, struct ll_opendir_state);
|
||||
NTSTATUS status;
|
||||
|
||||
status = smb2cli_create_recv(req,
|
||||
&state->dir_state->fid_persistent,
|
||||
&state->dir_state->fid_volatile,
|
||||
NULL, NULL, NULL);
|
||||
status = smb2cli_create_recv(
|
||||
req,
|
||||
&state->dir_state->fid_persistent,
|
||||
&state->dir_state->fid_volatile,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
TALLOC_FREE(req);
|
||||
|
||||
DEBUG(10, ("%s: smbcli_create_recv returned %s\n", __func__,
|
||||
|
@ -336,6 +336,11 @@ static NTSTATUS smb2cli_create_unparsed_unix_len(
|
||||
return NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
}
|
||||
|
||||
if (unparsed_utf16_len == 0) {
|
||||
*_unparsed_unix_len = 0;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
unparsed_utf16 = name_utf16 + name_utf16_len - unparsed_utf16_len;
|
||||
|
||||
ok = convert_string_talloc(
|
||||
@ -352,16 +357,7 @@ static NTSTATUS smb2cli_create_unparsed_unix_len(
|
||||
strerror(errno));
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert_string_talloc() returns a 0-terminated string
|
||||
*/
|
||||
SMB_ASSERT(unparsed_unix_len > 0);
|
||||
SMB_ASSERT(unparsed_unix[unparsed_unix_len-1] == '\0');
|
||||
|
||||
TALLOC_FREE(unparsed_unix);
|
||||
|
||||
*_unparsed_unix_len = (unparsed_unix_len-1);
|
||||
*_unparsed_unix_len = unparsed_unix_len;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
@ -469,7 +465,8 @@ NTSTATUS smb2cli_create_recv(struct tevent_req *req,
|
||||
uint64_t *fid_volatile,
|
||||
struct smb_create_returns *cr,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct smb2_create_blobs *blobs)
|
||||
struct smb2_create_blobs *blobs,
|
||||
struct symlink_reparse_struct **psymlink)
|
||||
{
|
||||
struct smb2cli_create_state *state =
|
||||
tevent_req_data(req,
|
||||
@ -477,6 +474,10 @@ NTSTATUS smb2cli_create_recv(struct tevent_req *req,
|
||||
NTSTATUS status;
|
||||
|
||||
if (tevent_req_is_nterror(req, &status)) {
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK) &&
|
||||
(psymlink != NULL)) {
|
||||
*psymlink = talloc_move(mem_ctx, &state->symlink);
|
||||
}
|
||||
tevent_req_received(req);
|
||||
return status;
|
||||
}
|
||||
@ -510,7 +511,8 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
|
||||
uint64_t *fid_volatile,
|
||||
struct smb_create_returns *cr,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct smb2_create_blobs *ret_blobs)
|
||||
struct smb2_create_blobs *ret_blobs,
|
||||
struct symlink_reparse_struct **psymlink)
|
||||
{
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
struct tevent_context *ev;
|
||||
@ -541,8 +543,14 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
|
||||
if (!tevent_req_poll_ntstatus(req, ev, &status)) {
|
||||
goto fail;
|
||||
}
|
||||
status = smb2cli_create_recv(req, fid_persistent, fid_volatile, cr,
|
||||
mem_ctx, ret_blobs);
|
||||
status = smb2cli_create_recv(
|
||||
req,
|
||||
fid_persistent,
|
||||
fid_volatile,
|
||||
cr,
|
||||
mem_ctx,
|
||||
ret_blobs,
|
||||
psymlink);
|
||||
fail:
|
||||
TALLOC_FREE(frame);
|
||||
return status;
|
||||
|
@ -647,6 +647,8 @@ NTSTATUS smb2cli_tdis(struct smbXcli_conn *conn,
|
||||
struct smbXcli_session *session,
|
||||
struct smbXcli_tcon *tcon);
|
||||
|
||||
struct symlink_reparse_struct;
|
||||
|
||||
struct tevent_req *smb2cli_create_send(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
@ -668,7 +670,8 @@ NTSTATUS smb2cli_create_recv(struct tevent_req *req,
|
||||
uint64_t *fid_volatile,
|
||||
struct smb_create_returns *cr,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct smb2_create_blobs *blobs);
|
||||
struct smb2_create_blobs *blobs,
|
||||
struct symlink_reparse_struct **psymlink);
|
||||
NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
|
||||
uint32_t timeout_msec,
|
||||
struct smbXcli_session *session,
|
||||
@ -686,7 +689,8 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
|
||||
uint64_t *fid_volatile,
|
||||
struct smb_create_returns *cr,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct smb2_create_blobs *ret_blobs);
|
||||
struct smb2_create_blobs *ret_blobs,
|
||||
struct symlink_reparse_struct **psymlink);
|
||||
|
||||
struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
|
@ -280,10 +280,14 @@ static void tstream_smbXcli_np_open_done(struct tevent_req *subreq)
|
||||
if (state->is_smb1) {
|
||||
status = smb1cli_ntcreatex_recv(subreq, &state->fnum);
|
||||
} else {
|
||||
status = smb2cli_create_recv(subreq,
|
||||
&state->fid_persistent,
|
||||
&state->fid_volatile,
|
||||
NULL, NULL, NULL);
|
||||
status = smb2cli_create_recv(
|
||||
subreq,
|
||||
&state->fid_persistent,
|
||||
&state->fid_volatile,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
TALLOC_FREE(subreq);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
@ -343,7 +343,8 @@ static void cli_smb2_create_fnum_done(struct tevent_req *subreq)
|
||||
&h.fid_persistent,
|
||||
&h.fid_volatile, &state->cr,
|
||||
state,
|
||||
&state->out_cblobs);
|
||||
&state->out_cblobs,
|
||||
NULL);
|
||||
TALLOC_FREE(subreq);
|
||||
if (tevent_req_nterror(req, status)) {
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user