mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
ndrdump: Use human-readable strings for NDR decode errors
These make much more sense than the NTSTATUS values they can be forced to map to. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
b3bdb17a35
commit
816869ecea
@ -193,7 +193,6 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
|
||||
struct ndr_print *ndr_print,
|
||||
const struct ndr_interface_call_pipes *pipes)
|
||||
{
|
||||
NTSTATUS status;
|
||||
enum ndr_err_code ndr_err;
|
||||
uint32_t i;
|
||||
|
||||
@ -221,12 +220,12 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
|
||||
ndr_pull->current_mem_ctx = c;
|
||||
ndr_err = pipes->pipes[i].ndr_pull(ndr_pull, NDR_SCALARS, c);
|
||||
ndr_pull->current_mem_ctx = saved_mem_ctx;
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
|
||||
printf("pull returned %s\n", nt_errstr(status));
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("pull returned %s\n",
|
||||
ndr_map_error2string(ndr_err));
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
talloc_free(c);
|
||||
return status;
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
pipes->pipes[i].ndr_print(ndr_print, n, c);
|
||||
talloc_free(c);
|
||||
@ -467,8 +466,8 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
|
||||
}
|
||||
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
printf("pull for context file returned %s\n", nt_errstr(status));
|
||||
printf("pull for context file returned %s\n",
|
||||
ndr_map_error2string(ndr_err));
|
||||
exit(1);
|
||||
}
|
||||
memcpy(v_st, st, f->struct_size);
|
||||
@ -513,10 +512,9 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
|
||||
ndr_print->depth = 1;
|
||||
|
||||
ndr_err = ndr_pop_dcerpc_sec_verification_trailer(ndr_pull, mem_ctx, &sec_vt);
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
printf("ndr_pop_dcerpc_sec_verification_trailer returned %s\n",
|
||||
nt_errstr(status));
|
||||
ndr_map_error2string(ndr_err));
|
||||
}
|
||||
|
||||
if (sec_vt != NULL && sec_vt->count.count > 0) {
|
||||
@ -543,11 +541,10 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
|
||||
}
|
||||
|
||||
ndr_err = f->ndr_pull(ndr_pull, flags, st);
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
printf("pull returned %s\n",
|
||||
ndr_map_error2string(ndr_err));
|
||||
|
||||
printf("pull returned %s\n", nt_errstr(status));
|
||||
|
||||
if (stop_on_parse_failure && !NT_STATUS_IS_OK(status)) {
|
||||
if (stop_on_parse_failure && !NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
printf("not printing because --stop-on-parse-failure\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -572,11 +569,6 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
|
||||
|
||||
f->ndr_print(ndr_print, format, flags, st);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("dump FAILED\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (flags & NDR_IN) {
|
||||
status = ndrdump_pull_and_print_pipes(format,
|
||||
ndr_pull,
|
||||
@ -631,8 +623,8 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
|
||||
ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
|
||||
ndr_err = f->ndr_pull(ndr_v_pull, flags, v_st);
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
printf("pull returned %s\n", nt_errstr(status));
|
||||
printf("pull returned %s\n",
|
||||
ndr_map_error2string(ndr_err));
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
printf("validate pull FAILED\n");
|
||||
exit(1);
|
||||
|
@ -77,7 +77,7 @@ class NdrDumpTests(BlackboxTestCase):
|
||||
def test_ndrdump_with_binary_struct_name(self):
|
||||
# Prefix of the expected unparsed PAC data (without times, as
|
||||
# these vary by host)
|
||||
expected = '''pull returned NT_STATUS_OK
|
||||
expected = '''pull returned Success
|
||||
PAC_DATA: struct PAC_DATA
|
||||
num_buffers : 0x00000005 (5)
|
||||
version : 0x00000000 (0)
|
||||
@ -96,7 +96,7 @@ class NdrDumpTests(BlackboxTestCase):
|
||||
self.assertTrue(actual.endswith(b"dump OK\n"))
|
||||
|
||||
def test_ndrdump_with_binary_struct_number(self):
|
||||
expected = '''pull returned NT_STATUS_OK
|
||||
expected = '''pull returned Success
|
||||
0 : 33323130-3534-3736-3839-616263646566
|
||||
dump OK
|
||||
'''
|
||||
|
@ -1,4 +1,4 @@
|
||||
pull returned NT_STATUS_OK
|
||||
pull returned Success
|
||||
dns_name_packet: struct dns_name_packet
|
||||
id : 0xecef (60655)
|
||||
operation : 0x2800 (10240)
|
||||
|
Loading…
x
Reference in New Issue
Block a user