The Samba-Bugzilla – Attachment 15624 Details for
Bug 14176
NT_STATUS_ACCESS_DENIED becomes EINVAL when using SMB2 in SMBC_opendir_ctx
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.11.next, 4.10.next.
0001-s3-libsmb-Ensure-return-from-net_share_enum_rpc-sets.patch (text/plain), 3.73 KB, created by
Jeremy Allison
on 2019-11-18 17:45:56 UTC
(
hide
)
Description:
git-am fix for 4.11.next, 4.10.next.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2019-11-18 17:45:56 UTC
Size:
3.73 KB
patch
obsolete
>From f17bbf423765c4af3df9ecacb611c98faf41109d Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 31 Oct 2019 14:38:35 -0700 >Subject: [PATCH] s3: libsmb: Ensure return from net_share_enum_rpc() sets > cli->raw_status on error. > >Convert net_share_enum_rpc() to return an NTSTATUS and ensure the >status is set correctly on error so SMBC_errno() can return it. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14176 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> > >Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> >Autobuild-Date(master): Tue Nov 5 12:36:48 UTC 2019 on sn-devel-184 > >(cherry picked from commit ff47cc661d432a9337ade9a232a4f49164652812) >--- > source3/libsmb/libsmb_dir.c | 33 ++++++++++++++++++++++----------- > 1 file changed, 22 insertions(+), 11 deletions(-) > >diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c >index ab20a127c49..14bfcdec6a7 100644 >--- a/source3/libsmb/libsmb_dir.c >+++ b/source3/libsmb/libsmb_dir.c >@@ -350,7 +350,7 @@ dir_list_fn(const char *mnt, > return NT_STATUS_OK; > } > >-static int >+static NTSTATUS > net_share_enum_rpc(struct cli_state *cli, > void (*fn)(const char *name, > uint32_t type, >@@ -377,7 +377,7 @@ net_share_enum_rpc(struct cli_state *cli, > &pipe_hnd); > if (!NT_STATUS_IS_OK(nt_status)) { > DEBUG(1, ("net_share_enum_rpc pipe open fail!\n")); >- return -1; >+ goto done; > } > > ZERO_STRUCT(info_ctr); >@@ -400,18 +400,18 @@ net_share_enum_rpc(struct cli_state *cli, > /* Was it successful? */ > if (!NT_STATUS_IS_OK(nt_status)) { > /* Nope. Go clean up. */ >- result = ntstatus_to_werror(nt_status); > goto done; > } > > if (!W_ERROR_IS_OK(result)) { > /* Nope. Go clean up. */ >+ nt_status = werror_to_ntstatus(result); > goto done; > } > > if (total_entries == 0) { > /* Nope. Go clean up. */ >- result = WERR_GEN_FAILURE; >+ nt_status = NT_STATUS_NOT_FOUND; > goto done; > } > >@@ -436,7 +436,7 @@ done: > TALLOC_FREE(pipe_hnd); > > /* Tell 'em if it worked */ >- return W_ERROR_IS_OK(result) ? 0 : -1; >+ return nt_status; > } > > >@@ -825,7 +825,7 @@ SMBC_opendir_ctx(SMBCCTX *context, > } > } else if (srv || > (resolve_name(server, &rem_ss, 0x20, false))) { >- int rc; >+ NTSTATUS status; > > /* > * If we hadn't found the server, get one now >@@ -852,27 +852,38 @@ SMBC_opendir_ctx(SMBCCTX *context, > > /* List the shares ... */ > >- rc = net_share_enum_rpc(srv->cli, >+ status = net_share_enum_rpc(srv->cli, > list_fn, > (void *)dir); >- if (rc != 0 && >+ if (!NT_STATUS_IS_OK(status) && > smbXcli_conn_protocol(srv->cli->conn) <= > PROTOCOL_NT1) { > /* > * Only call cli_RNetShareEnum() > * on SMB1 connections, not SMB2+. > */ >- rc = cli_RNetShareEnum(srv->cli, >+ int rc = cli_RNetShareEnum(srv->cli, > list_fn, > (void *)dir); >+ if (rc != 0) { >+ status = cli_nt_error(srv->cli); >+ } else { >+ status = NT_STATUS_OK; >+ } > } >- if (rc != 0) { >- errno = cli_errno(srv->cli); >+ if (!NT_STATUS_IS_OK(status)) { >+ /* >+ * Set cli->raw_status so SMBC_errno() >+ * will correctly return the error. >+ */ >+ srv->cli->raw_status = status; > if (dir != NULL) { > SAFE_FREE(dir->fname); > SAFE_FREE(dir); > } > TALLOC_FREE(frame); >+ errno = map_errno_from_nt_status( >+ status); > return NULL; > } > } else { >-- >2.24.0.432.g9d3f5f5b63-goog >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
asn
:
review+
Actions:
View
Attachments on
bug 14176
:
15585
|
15586
|
15594
| 15624