diff options
author | Tim Potter <tpot@samba.org> | 2005-08-11 04:04:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:36 -0500 |
commit | c08578c0cb739ca9433edb015e995eda82fdf8d4 (patch) | |
tree | ad6ff1aaf63ed29fdc6e0902c34fc800a0bcd125 | |
parent | d607b4473feef6392364a1f2f7a564d790125899 (diff) | |
download | samba-c08578c0cb739ca9433edb015e995eda82fdf8d4.tar.gz samba-c08578c0cb739ca9433edb015e995eda82fdf8d4.tar.bz2 samba-c08578c0cb739ca9433edb015e995eda82fdf8d4.zip |
r9238: Some test code to do user-unmarshalling of eventlog_Record data.
(This used to be commit d0225f10797eaeeb6d10cf753578703e144ee8dd)
-rw-r--r-- | source4/torture/rpc/eventlog.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index eebf485e5c..576565e247 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -66,6 +66,12 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; while (1) { + DATA_BLOB blob; + struct eventlog_Record rec; + struct ndr_pull *ndr; + + /* Read first for number of bytes in record */ + r.in.number_of_bytes = 0; r.out.data = NULL; @@ -80,6 +86,8 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } + /* Now read the actual record */ + r.in.number_of_bytes = r.out.real_size; r.out.data = talloc_size(mem_ctx, r.in.number_of_bytes); @@ -90,6 +98,24 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } + /* Decode a user-marshalled record */ + + blob.length = r.out.sent_size; + blob.data = talloc_steal(mem_ctx, r.out.data); + + ndr = ndr_pull_init_blob(&blob, mem_ctx); + + status = ndr_pull_eventlog_Record( + ndr, NDR_SCALARS|NDR_BUFFERS, &rec); + + NDR_PRINT_DEBUG(eventlog_Record, &rec); + + if (!NT_STATUS_IS_OK(status)) { + printf("ReadEventLog failed parsing event log record " + "- %s\n", nt_errstr(status)); + return False; + } + r.in.offset++; } |