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 5f8e325..8e57639 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 1e915e2..90fde1a 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 1b20781..de46eb3 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 6b1eeb1..3286ddb 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,