From 7cf9880d93210144391d1623b16f65048009ab85 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 12 Jul 2006 14:32:21 +0000 Subject: r16981: check the returned values metze (This used to be commit 687776a436ad1028f1128b279a5103aee23ece18) --- source4/torture/smb2/notify.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c index 74cec16b8c..003f6d6cd6 100644 --- a/source4/torture/smb2/notify.c +++ b/source4/torture/smb2/notify.c @@ -43,6 +43,14 @@ goto done; \ }} while (0) +#define CHECK_WIRE_STR(field, value) do { \ + if (!field.s || strcmp(field.s, value)) { \ + printf("(%s) %s [%s] != %s\n", \ + __location__, #field, field.s, value); \ + ret = False; \ + goto done; \ + }} while (0) + #define FNAME "smb2-notify01.dat" static BOOL test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree) @@ -68,6 +76,9 @@ static BOOL test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree) status = smb2_notify_recv(req, mem_ctx, &n); CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VALUE(n.out.num_changes, 1); + CHECK_VALUE(n.out.changes[0].action, NOTIFY_ACTION_REMOVED); + CHECK_WIRE_STR(n.out.changes[0].name, FNAME); /* * if the change response doesn't fit in the buffer @@ -94,10 +105,17 @@ static BOOL test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree) status = smb2_notify_recv(req, mem_ctx, &n); CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VALUE(n.out.num_changes, 3); + CHECK_VALUE(n.out.changes[0].action, NOTIFY_ACTION_REMOVED); + CHECK_WIRE_STR(n.out.changes[0].name, FNAME); + CHECK_VALUE(n.out.changes[1].action, NOTIFY_ACTION_ADDED); + CHECK_WIRE_STR(n.out.changes[1].name, FNAME); + CHECK_VALUE(n.out.changes[2].action, NOTIFY_ACTION_MODIFIED); + CHECK_WIRE_STR(n.out.changes[2].name, FNAME); /* if the first notify returns NOTIFY_ENUM_DIR, all do */ status = smb2_util_close(tree, dh); - CHECK_STATUS(status, NT_STATUS_OK); + CHECK_STATUS(status, NT_STATUS_OK); status = smb2_util_roothandle(tree, &dh); CHECK_STATUS(status, NT_STATUS_OK); -- cgit