works on all.
authorStefan Metzmacher <metze@samba.org>
Wed, 16 Jan 2019 16:01:12 +0000 (17:01 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 15 Oct 2019 07:36:38 +0000 (09:36 +0200)
source4/torture/smb2/notify.c

index 9edc19087464fe64ce313ced21425a7f5dc29904..950ee2b83a64e456f714c6dba93d43afbfcb0aac 100644 (file)
@@ -114,7 +114,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(torture, tree, FNAME);
+       status = torture_setup_simple_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -128,6 +128,7 @@ static bool test_valid_request(struct torture_context *torture,
         * NOTIFY_ENUM_DIR is returned.
         */
        n.in.buffer_size        = 0x00000000;
+       n.in.buffer_size        = max_buffer_size;
        req = smb2_notify_send(tree, &n);
 
        while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) {
@@ -136,11 +137,27 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(torture, tree, FNAME);
+       status = smb2_notify_recv(req, torture, &n);
+       //CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
        CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(n.out.num_changes, 1);
+       CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_MODIFIED);
+       CHECK_WIRE_STR(n.out.changes[0].name, FNAME);
 
-       status = smb2_notify_recv(req, torture, &n);
-       CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+//     n.in.buffer_size        = 0x00000000;
+//     req = smb2_notify_send(tree, &n);
+//
+//     while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) {
+//             if (tevent_loop_once(torture->ev) != 0) {
+//                     break;
+//             }
+//     }
+//
+//     status = smb2_notify_recv(req, torture, &n);
+//     CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+
+       status = torture_setup_simple_file(torture, tree, FNAME);
+       CHECK_STATUS(status, NT_STATUS_OK);
 
        /*
         * if the change response fits in the buffer we get
@@ -155,7 +172,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(torture, tree, FNAME);
+       status = torture_setup_simple_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -176,6 +193,7 @@ static bool test_valid_request(struct torture_context *torture,
 
        n.in.recursive          = 0x0000;
        n.in.buffer_size        = 0x00000001;
+       n.in.buffer_size        = max_buffer_size;
        n.in.file.handle        = dh;
        n.in.completion_filter  = FILE_NOTIFY_CHANGE_ALL;
        n.in.unknown            = 0x00000000;
@@ -187,11 +205,15 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(torture, tree, FNAME);
+       status = torture_setup_simple_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
-       CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+       //CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(n.out.num_changes, 1);
+       CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_REMOVED);
+       CHECK_WIRE_STR(n.out.changes[0].name, FNAME);
 
        n.in.buffer_size        = max_buffer_size;
        req = smb2_notify_send(tree, &n);
@@ -201,11 +223,17 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(torture, tree, FNAME);
+       status = torture_setup_simple_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
-       CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+       //CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(n.out.num_changes, 2);
+       CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_ADDED);
+       CHECK_WIRE_STR(n.out.changes[0].name, FNAME);
+       CHECK_VAL(n.out.changes[1].action, NOTIFY_ACTION_MODIFIED);
+       CHECK_WIRE_STR(n.out.changes[1].name, FNAME);
 
        /* if the buffer size is too large, we get invalid parameter */
        n.in.recursive          = 0x0000;