s3:smb2_server: add smbd_smb2_send_lease_break() helper function
authorVolker Lendecke <vl@samba.org>
Tue, 28 Oct 2014 22:31:46 +0000 (15:31 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 4 Dec 2014 04:45:09 +0000 (05:45 +0100)
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/globals.h
source3/smbd/smb2_server.c

index c67c3c3e763ef3be4f82c9bbb01e6367af135fa8..d85e68629a6957ef1f885b07718071ef18ba27ce 100644 (file)
@@ -251,6 +251,12 @@ NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn,
                                     struct smbXsrv_tcon *tcon,
                                     struct smbXsrv_open *op,
                                     uint8_t oplock_level);
+NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
+                                   uint16_t new_epoch,
+                                   uint32_t lease_flags,
+                                   struct smb2_lease_key *lease_key,
+                                   uint32_t current_lease_state,
+                                   uint32_t new_lease_state);
 
 NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req,
                                         struct tevent_req *subreq,
index 4a3ea7d4250e814a70e48961142e2f55ddd1e208..3f23e2a797929da6ae5d01fdca518d5c03c6e509 100644 (file)
@@ -2868,6 +2868,29 @@ NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn,
        return smbd_smb2_send_break(xconn, session, tcon, body, sizeof(body));
 }
 
+NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
+                                   uint16_t new_epoch,
+                                   uint32_t lease_flags,
+                                   struct smb2_lease_key *lease_key,
+                                   uint32_t current_lease_state,
+                                   uint32_t new_lease_state)
+{
+       uint8_t body[0x2c];
+
+       SSVAL(body, 0x00, sizeof(body));
+       SSVAL(body, 0x02, new_epoch);
+       SIVAL(body, 0x04, lease_flags);
+       SBVAL(body, 0x08, lease_key->data[0]);
+       SBVAL(body, 0x10, lease_key->data[1]);
+       SIVAL(body, 0x18, current_lease_state);
+       SIVAL(body, 0x1c, new_lease_state);
+       SIVAL(body, 0x20, 0);           /* BreakReason, MUST be 0 */
+       SIVAL(body, 0x24, 0);           /* AccessMaskHint, MUST be 0 */
+       SIVAL(body, 0x28, 0);           /* ShareMaskHint, MUST be 0 */
+
+       return smbd_smb2_send_break(xconn, NULL, NULL, body, sizeof(body));
+}
+
 static bool is_smb2_recvfile_write(struct smbd_smb2_request_read_state *state)
 {
        NTSTATUS status;