[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Wed Apr 29 08:09:02 UTC 2020
The branch, master has been updated
via dc280f88bec samba-tool: fetch "no such subcommand" error and print error message
via ae5cb7346bf librpc: Provide clearer debug messages for malformed DCE/RPC bind
from c7a4578d064 s3: pass DCE RPC handle type to create_policy_hnd
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit dc280f88becc6679cd95bf8914f80812358338cc
Author: Björn Baumbach <bb at sernet.de>
Date: Tue Apr 28 17:09:56 2020 +0200
samba-tool: fetch "no such subcommand" error and print error message
This patch especially improves the case where extra arguments are used.
Without this patch just the attributes are mentioned as invalid, if
samba-tool is called with an invalid/unknown subcommand.
Example without this patch:
# samba-tool sites list --all
Usage: samba-tool sites <subcommand>
samba-tool sites: error: no such option: --all
This can be deceptive for users. Is looks like the "list" command
does not provide a "--all" option.
Example with this patch:
# samba-tool sites list --all
samba-tool sites: no such subcommand: list
Usage: samba-tool sites <subcommand>
(...)
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Apr 29 08:08:21 UTC 2020 on sn-devel-184
commit ae5cb7346bf6f7759c88d7df6a5c1bd7965ee284
Author: Andrew Bartlett <abartlet at samba.org>
Date: Fri Apr 24 11:04:00 2020 +1200
librpc: Provide clearer debug messages for malformed DCE/RPC bind
REF: https://lists.samba.org/archive/samba/2020-April/229334.html
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
-----------------------------------------------------------------------
Summary of changes:
librpc/rpc/dcerpc_util.c | 37 +++++++++++++++++++++++++++++--------
python/samba/netcmd/__init__.py | 3 +++
2 files changed, 32 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
index f7596cb1ac1..cf6cb942b1c 100644
--- a/librpc/rpc/dcerpc_util.c
+++ b/librpc/rpc/dcerpc_util.c
@@ -357,20 +357,41 @@ NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
}
if (data_and_pad < auth->auth_pad_length) {
- DEBUG(1, (__location__ ": ERROR: pad length mismatch. "
- "Calculated %u got %u\n",
- (unsigned)data_and_pad,
- (unsigned)auth->auth_pad_length));
+ DBG_WARNING(__location__ ": ERROR: pad length too long. "
+ "Calculated %u (pkt_trailer->length=%u - auth_length=%u) "
+ "was less than auth_pad_length=%u\n",
+ (unsigned)data_and_pad,
+ (unsigned)pkt_trailer->length,
+ (unsigned)auth_length,
+ (unsigned)auth->auth_pad_length);
+ talloc_free(ndr);
+ ZERO_STRUCTP(auth);
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (auth_data_only && data_and_pad > auth->auth_pad_length) {
+ DBG_WARNING(__location__ ": ERROR: auth_data_only pad length mismatch. "
+ "Client sent a longer BIND packet than expected by %u bytes "
+ "(pkt_trailer->length=%u - auth_length=%u) "
+ "= %u auth_pad_length=%u\n",
+ (unsigned)data_and_pad - (unsigned)auth->auth_pad_length,
+ (unsigned)pkt_trailer->length,
+ (unsigned)auth_length,
+ (unsigned)data_and_pad,
+ (unsigned)auth->auth_pad_length);
talloc_free(ndr);
ZERO_STRUCTP(auth);
return NT_STATUS_RPC_PROTOCOL_ERROR;
}
if (auth_data_only && data_and_pad != auth->auth_pad_length) {
- DEBUG(1, (__location__ ": ERROR: pad length mismatch. "
- "Calculated %u got %u\n",
- (unsigned)data_and_pad,
- (unsigned)auth->auth_pad_length));
+ DBG_WARNING(__location__ ": ERROR: auth_data_only pad length mismatch. "
+ "Calculated %u (pkt_trailer->length=%u - auth_length=%u) "
+ "but auth_pad_length=%u\n",
+ (unsigned)data_and_pad,
+ (unsigned)pkt_trailer->length,
+ (unsigned)auth_length,
+ (unsigned)auth->auth_pad_length);
talloc_free(ndr);
ZERO_STRUCTP(auth);
return NT_STATUS_RPC_PROTOCOL_ERROR;
diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py
index 57df46343e9..620e3751e7f 100644
--- a/python/samba/netcmd/__init__.py
+++ b/python/samba/netcmd/__init__.py
@@ -234,6 +234,9 @@ class SuperCommand(Command):
if subcommand in self.subcommands:
return self.subcommands[subcommand]._run(
"%s %s" % (myname, subcommand), *args)
+ elif subcommand not in [ '--help', 'help', None ]:
+ print("%s: no such subcommand: %s\n" % (myname, subcommand))
+ args = []
if subcommand == 'help':
# pass the request down
--
Samba Shared Repository
More information about the samba-cvs
mailing list