s3:smbd: add fsp_lease_type() and get_lease_type() helper functions
[kai/samba-autobuild/.git] / source3 / smbd / files.c
index 71166288a6595e9c97dc0e2821ab03f255b97913..d866d6337c648f010393b6754d60d11d737bb083 100644 (file)
@@ -745,3 +745,11 @@ const struct GUID *fsp_client_guid(const files_struct *fsp)
 {
        return &fsp->conn->sconn->client->connections->smb2.client.guid;
 }
+
+uint32_t fsp_lease_type(struct files_struct *fsp)
+{
+       if (fsp->oplock_type == LEASE_OPLOCK) {
+               return fsp->lease->lease.lease_state;
+       }
+       return map_oplock_to_lease_type(fsp->oplock_type);
+}