summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-01-16 18:04:11 +0100
committerGünther Deschner <gd@samba.org>2009-02-04 22:49:51 +0100
commit858116d54e61f2d86757aecce3afba147434c7fc (patch)
tree5d06b5e182fd42920e5b937c9b8e814390ce0464 /source4/torture
parent64e3a90530e4231fc9725652535a4881b149228a (diff)
downloadsamba-858116d54e61f2d86757aecce3afba147434c7fc.tar.gz
samba-858116d54e61f2d86757aecce3afba147434c7fc.tar.bz2
samba-858116d54e61f2d86757aecce3afba147434c7fc.zip
s4-smbtorture: in eventlog readlog test, print all records in a buffer.
Guenther
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/eventlog.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index d5bc4e6501..2fd9d923f1 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -125,9 +125,10 @@ static bool test_ReadEventLog(struct torture_context *tctx,
while (1) {
DATA_BLOB blob;
- struct eventlog_Record rec;
- struct ndr_pull *ndr;
+ struct EVENTLOGRECORD rec;
enum ndr_err_code ndr_err;
+ uint32_t size = 0;
+ uint32_t pos = 0;
/* Read first for number of bytes in record */
@@ -140,6 +141,7 @@ static bool test_ReadEventLog(struct torture_context *tctx,
status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r);
if (NT_STATUS_EQUAL(r.out.result, NT_STATUS_END_OF_FILE)) {
+ /* FIXME: still need to decode then */
break;
}
@@ -156,17 +158,32 @@ static bool test_ReadEventLog(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status, "ReadEventLog failed");
/* Decode a user-marshalled record */
+ size = IVAL(r.out.data, pos);
- blob.length = *r.out.sent_size;
- blob.data = talloc_steal(tctx, r.out.data);
+ while (size > 0) {
- ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx));
+ blob = data_blob_const(r.out.data + pos, size);
+ dump_data(0, blob.data, blob.length);
- ndr_err = ndr_pull_eventlog_Record(
- ndr, NDR_SCALARS|NDR_BUFFERS, &rec);
- status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_pull_struct_blob_all(&blob, tctx,
+ lp_iconv_convenience(tctx->lp_ctx), &rec,
+ (ndr_pull_flags_fn_t)ndr_pull_EVENTLOGRECORD);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ torture_assert_ntstatus_ok(tctx, status,
+ "ReadEventLog failed parsing event log record");
+ }
- NDR_PRINT_DEBUG(eventlog_Record, &rec);
+ NDR_PRINT_DEBUG(EVENTLOGRECORD, &rec);
+
+ pos += size;
+
+ if (pos + 4 > *r.out.sent_size) {
+ break;
+ }
+
+ size = IVAL(r.out.data, pos);
+ }
torture_assert_ntstatus_ok(tctx, status,
"ReadEventLog failed parsing event log record");