]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Revert "s3: locking: Move two leases functions into a new file."
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Jul 2017 06:49:30 +0000 (08:49 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 12 Jul 2017 06:50:47 +0000 (08:50 +0200)
This reverts commit 419f5cca88fa31d723f4bfe243d72398d4445801.

This should not have been in 4-4-test, see
https://bugzilla.samba.org/show_bug.cgi?id=12628#c6
v4-4-test is in the security fixes only mode.

This also introduces a regression that's fixed in v4-5 and higer only,
see https://bugzilla.samba.org/show_bug.cgi?id=12798

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/locking/leases_util.c [deleted file]
source3/locking/proto.h
source3/smbd/files.c
source3/smbd/oplock.c
source3/smbd/proto.h
source3/wscript_build

diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c
deleted file mode 100644 (file)
index cb307c8..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-   Lease utility functions
-
-   Copyright (C) Jeremy Allison 2017.
-   Copyright (C) Stefan (metze) Metzmacher 2017.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define DBGC_CLASS DBGC_LOCKING
-#include "includes.h"
-#include "../librpc/gen_ndr/open_files.h"
-#include "locking/proto.h"
-
-uint32_t map_oplock_to_lease_type(uint16_t op_type)
-{
-       uint32_t ret;
-
-       switch(op_type) {
-       case BATCH_OPLOCK:
-       case BATCH_OPLOCK|EXCLUSIVE_OPLOCK:
-               ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE;
-               break;
-       case EXCLUSIVE_OPLOCK:
-               ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE;
-               break;
-       case LEVEL_II_OPLOCK:
-               ret = SMB2_LEASE_READ;
-               break;
-       default:
-               ret = SMB2_LEASE_NONE;
-               break;
-       }
-       return ret;
-}
-
-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);
-}
index 4fc8da8ad24b8ac9afcefb7d518c4571cb72c720..8ff1c7cd632b465a6b618c34d50a638d3d4c4b15 100644 (file)
@@ -247,8 +247,4 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
                                const struct lock_struct *plocks,
                                int num_locks);
 
-/* The following definitions come from locking/leases_util.c */
-uint32_t map_oplock_to_lease_type(uint16_t op_type);
-uint32_t fsp_lease_type(struct files_struct *fsp);
-
 #endif /* _LOCKING_PROTO_H_ */
index ada8bfc0fac4e25df5a9beb6f42728678d41e7a9..8fefddddfa0c8dbebe30d72cf8b5ebcf3c131b45 100644 (file)
@@ -773,3 +773,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);
+}
index f94d9cc78885feef10a47a83e07c6ce6d896a8ee..56b4499bff486375148b30a82d1c798b97033f96 100644 (file)
@@ -149,6 +149,28 @@ static void downgrade_file_oplock(files_struct *fsp)
        TALLOC_FREE(fsp->oplock_timeout);
 }
 
+uint32_t map_oplock_to_lease_type(uint16_t op_type)
+{
+       uint32_t ret;
+
+       switch(op_type) {
+       case BATCH_OPLOCK:
+       case BATCH_OPLOCK|EXCLUSIVE_OPLOCK:
+               ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE;
+               break;
+       case EXCLUSIVE_OPLOCK:
+               ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE;
+               break;
+       case LEVEL_II_OPLOCK:
+               ret = SMB2_LEASE_READ;
+               break;
+       default:
+               ret = SMB2_LEASE_NONE;
+               break;
+       }
+       return ret;
+}
+
 uint32_t get_lease_type(const struct share_mode_data *d,
                        const struct share_mode_entry *e)
 {
index 9103e6eb1bfff995ec8b33adfd0b2ae6e0648d3c..44a2daaf52328f744302b5ef7dc7b09e74662741 100644 (file)
@@ -395,6 +395,7 @@ NTSTATUS file_name_hash(connection_struct *conn,
 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
                           const struct smb_filename *smb_fname_in);
 const struct GUID *fsp_client_guid(const files_struct *fsp);
+uint32_t fsp_lease_type(struct files_struct *fsp);
 
 /* The following definitions come from smbd/ipc.c  */
 
@@ -677,6 +678,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
 
 /* The following definitions come from smbd/oplock.c  */
 
+uint32_t map_oplock_to_lease_type(uint16_t op_type);
 uint32_t get_lease_type(const struct share_mode_data *d,
                        const struct share_mode_entry *e);
 bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck);
index 2bd684e7d7f0a006ebae66084b88a8106651cb30..dabe262be9deb41e939ec19e1e47a3fed0347957 100755 (executable)
@@ -625,7 +625,6 @@ bld.SAMBA3_LIBRARY('smbd_base',
                    RPC_SERVICE
                    NDR_SMBXSRV
                    LEASES_DB
-                  LEASES_UTIL
                    LIBASYS
                    sysquotas
                    NDR_SMB_ACL
@@ -647,7 +646,6 @@ bld.SAMBA3_SUBSYSTEM('LOCKING',
                     tdb
                     talloc
                     LEASES_DB
-                   LEASES_UTIL
                     NDR_OPEN_FILES
                     FNAME_UTIL''')
 
@@ -655,10 +653,6 @@ bld.SAMBA3_SUBSYSTEM('LEASES_DB',
                     source='locking/leases_db.c',
                     deps='NDR_LEASES_DB')
 
-bld.SAMBA3_SUBSYSTEM('LEASES_UTIL',
-                    source='locking/leases_util.c',
-                    deps='NDR_OPEN_FILES')
-
 if bld.CONFIG_GET("WITH_PROFILE"):
     bld.SAMBA3_SUBSYSTEM('PROFILE',
                          source='profile/profile.c',