summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-12-31 04:29:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:10 -0500
commitff5c9a127335a35d5625c500d5cd6b5971fd1e13 (patch)
tree99fc1a1901f5120f4e52f8c98d390938551347e8 /source4/librpc/rpc/dcerpc.c
parente4b7e8cdf1590d8ed9b1f190cad9ee6734ffe4de (diff)
downloadsamba-ff5c9a127335a35d5625c500d5cd6b5971fd1e13.tar.gz
samba-ff5c9a127335a35d5625c500d5cd6b5971fd1e13.tar.bz2
samba-ff5c9a127335a35d5625c500d5cd6b5971fd1e13.zip
r12634: make the [validate] binding string switch also check to see if the
string form of the structure we receive matches the generated form. This has the effect of checking things like value() attributes. (This used to be commit f2e68ec649658976e5bf4887713a92c14850c277)
Diffstat (limited to 'source4/librpc/rpc/dcerpc.c')
-rw-r--r--source4/librpc/rpc/dcerpc.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 0269eb9919..796511ef00 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -1216,17 +1216,20 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c,
bug in either the pull or push side of our code
*/
static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
- TALLOC_CTX *mem_ctx,
+ struct ndr_pull *pull_in,
void *struct_ptr,
size_t struct_size,
ndr_push_flags_fn_t ndr_push,
- ndr_pull_flags_fn_t ndr_pull)
+ ndr_pull_flags_fn_t ndr_pull,
+ ndr_print_function_t ndr_print)
{
void *st;
struct ndr_pull *pull;
struct ndr_push *push;
NTSTATUS status;
DATA_BLOB blob, blob2;
+ TALLOC_CTX *mem_ctx = pull_in;
+ char *s1, *s2;
st = talloc_size(mem_ctx, struct_size);
if (!st) {
@@ -1285,6 +1288,16 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
nt_errstr(status));
}
+ /* this checks the printed forms of the two structures, which effectively
+ tests all of the value() attributes */
+ s1 = ndr_print_function_string(mem_ctx, ndr_print, "VALIDATE",
+ NDR_OUT, struct_ptr);
+ s2 = ndr_print_function_string(mem_ctx, ndr_print, "VALIDATE",
+ NDR_OUT, st);
+ if (strcmp(s1, s2) != 0) {
+ printf("VALIDATE ERROR:\nWIRE:\n%s\n GEN:\n%s\n", s1, s2);
+ }
+
return NT_STATUS_OK;
}
@@ -1415,7 +1428,8 @@ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req)
if (p->conn->flags & DCERPC_DEBUG_VALIDATE_OUT) {
status = dcerpc_ndr_validate_out(p->conn, pull, r, call->struct_size,
- call->ndr_push, call->ndr_pull);
+ call->ndr_push, call->ndr_pull,
+ call->ndr_print);
if (!NT_STATUS_IS_OK(status)) {
dcerpc_log_packet(table, opnum, NDR_OUT,
&response);