s4-torture: Add handlers to ignore incoming oplock/lease break requests
authorSachin Prabhu <sprabhu@redhat.com>
Sat, 16 Mar 2019 12:25:07 +0000 (12:25 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 19 Apr 2019 17:27:13 +0000 (17:27 +0000)
For use in multichannel oplock break tests. These handers ignore
incoming oplock and lease break requests so that we can test the
oplock/lease break retries on the server.

This is meant for use with samba servers which rely on receiving a reply
from the client before timeout.
Windows servers rely on underlying tcp commands to decide if the oplock
break command was delivered successfully to the client and therefore
cannot be tested with this method.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/smb2/lease_break_handler.c
source4/torture/smb2/lease_break_handler.h
source4/torture/smb2/oplock_break_handler.c
source4/torture/smb2/oplock_break_handler.h

index 5f8e325d63f97a2672410d6ddc76e7011e6cad43..8e576391eb13b62bae69731de32607fd4b31d9be 100644 (file)
@@ -72,6 +72,18 @@ bool torture_lease_handler(struct smb2_transport *transport,
        return true;
 }
 
+/*
+ * A lease break handler which ignores incoming lease break requests
+ * To be used in cases where the client is expected to ignore incoming
+ * lease break requests
+ */
+bool torture_lease_ignore_handler(struct smb2_transport *transport,
+                          const struct smb2_lease_break *lb,
+                          void *private_data)
+{
+       return true;
+}
+
 /*
    Timer handler function notifies the registering function that time is up
 */
index 1e915e27951cd7271aee4c3433d37fabdb1f6579..90fde1a92174d4c48565ea8b73c117d6b7266ad1 100644 (file)
@@ -121,6 +121,9 @@ extern struct lease_break_info lease_break_info;
 bool torture_lease_handler(struct smb2_transport *transport,
                           const struct smb2_lease_break *lb,
                           void *private_data);
+bool torture_lease_ignore_handler(struct smb2_transport *transport,
+                                 const struct smb2_lease_break *lb,
+                                 void *private_data);
 void torture_wait_for_lease_break(struct torture_context *tctx);
 
 static inline void torture_reset_lease_break_info(struct torture_context *tctx,
index 1b20781065840f7525e8222281103056e5a86d9f..de46eb32f2a90e8e8c89c1ad1db5c47b05fd7f6a 100644 (file)
@@ -91,6 +91,16 @@ bool torture_oplock_ack_handler(struct smb2_transport *transport,
        return true;
 }
 
+/**
+ * A oplock break handler designed to ignore incoming break requests.
+ * This is used when incoming oplock break requests need to be ignored
+ */
+bool torture_oplock_ignore_handler(struct smb2_transport *transport,
+                                  const struct smb2_handle *handle,
+                                  uint8_t level, void *private_data)
+{
+       return true;
+}
 
 /*
  * Timer handler function notifies the registering function that time is up
index 6b1eeb14b639979f3de306f3947ac87301854960..3286ddbe443aae0d24b2d022c577ffc071aef0bb 100644 (file)
@@ -40,6 +40,10 @@ bool torture_oplock_ack_handler(struct smb2_transport *transport,
                                const struct smb2_handle *handle,
                                uint8_t level,
                                void *private_data);
+bool torture_oplock_ignore_handler(struct smb2_transport *transport,
+                               const struct smb2_handle *handle,
+                               uint8_t level,
+                               void *private_data);
 void torture_wait_for_oplock_break(struct torture_context *tctx);
 
 static inline void torture_reset_break_info(struct torture_context *tctx,