summaryrefslogtreecommitdiff
path: root/source4/torture/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-12 14:32:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:06 -0500
commit7cf9880d93210144391d1623b16f65048009ab85 (patch)
treec7f5c9548401769915dd51970f865db24a8d24c3 /source4/torture/smb2
parenta8958391e8fd9ddd996d2d3aff7ddeed3243fc1f (diff)
downloadsamba-7cf9880d93210144391d1623b16f65048009ab85.tar.gz
samba-7cf9880d93210144391d1623b16f65048009ab85.tar.bz2
samba-7cf9880d93210144391d1623b16f65048009ab85.zip
r16981: check the returned values
metze (This used to be commit 687776a436ad1028f1128b279a5103aee23ece18)
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r--source4/torture/smb2/notify.c20
1 files changed, 19 insertions, 1 deletions
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);