diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2019-11-14 13:14:08 +1300 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2019-11-17 22:28:41 +0000 |
commit | 2bb642d98e1c26064907f8f671c1de864f2d8c2f (patch) | |
tree | 335d739c53fa16c1e838afadea70a2f5778bd232 | |
parent | f1fa0d3b9dfef17a5129b53695fa454f1a8b8b68 (diff) | |
download | samba-2bb642d98e1c26064907f8f671c1de864f2d8c2f.tar.gz |
ndrdump: correctly find the public strict by number
We were finding a function that happened to have the same ordinal
number.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14191
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | librpc/tools/ndrdump.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c index 4173f03098d..4f812eeda7a 100644 --- a/librpc/tools/ndrdump.c +++ b/librpc/tools/ndrdump.c @@ -66,6 +66,7 @@ static const struct ndr_interface_call *find_struct( struct ndr_interface_call *out_buffer) { unsigned int i; + const struct ndr_interface_public_struct *public_struct = NULL; if (isdigit(struct_name[0])) { char *eptr = NULL; i = strtoul(struct_name, &eptr, 0); @@ -76,23 +77,25 @@ static const struct ndr_interface_call *find_struct( struct_name); exit(1); } - return &p->calls[i]; - } - for (i=0;i<p->num_public_structs;i++) { - if (strcmp(p->public_structs[i].name, struct_name) == 0) { - break; + public_struct = &p->public_structs[i]; + } else { + for (i=0;i<p->num_public_structs;i++) { + if (strcmp(p->public_structs[i].name, struct_name) == 0) { + break; + } } - } - if (i == p->num_public_structs) { - printf("Public structure '%s' not found\n", struct_name); - exit(1); + if (i == p->num_public_structs) { + printf("Public structure '%s' not found\n", struct_name); + exit(1); + } + public_struct = &p->public_structs[i]; } *out_buffer = (struct ndr_interface_call) { - .name = p->public_structs[i].name, - .struct_size = p->public_structs[i].struct_size, - .ndr_pull = p->public_structs[i].ndr_pull, - .ndr_push = p->public_structs[i].ndr_push, - .ndr_print = p->public_structs[i].ndr_print + .name = public_struct->name, + .struct_size = public_struct->struct_size, + .ndr_pull = public_struct->ndr_pull, + .ndr_push = public_struct->ndr_push, + .ndr_print = public_struct->ndr_print }; return out_buffer; } |