smbd: Simplify downgrade_lease
authorVolker Lendecke <vl@samba.org>
Fri, 14 Sep 2018 14:10:58 +0000 (16:10 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 2 Oct 2018 16:13:20 +0000 (18:13 +0200)
To me, the "additive" SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE is easier to
read than the negated ~SMB2_LEASE_READ.

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

index ded47b2f525745de5898cb327508f0576e10f81d..7ed223ddcfe8bb6f449669d5ba938687287d8efc 100644 (file)
@@ -569,7 +569,7 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
                         l->current_state,
                         l->breaking_to_required);
                l->breaking_to_requested = l->breaking_to_required;
-               if (l->current_state & (~SMB2_LEASE_READ)) {
+               if (l->current_state & (SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE)) {
                        /*
                         * Here we break in steps, as windows does
                         * see the breaking3 and v2_breaking3 tests.
@@ -646,7 +646,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
                        state->new_epoch = l->epoch;
                }
 
-               if (l->current_state & (~SMB2_LEASE_READ)) {
+               if (l->current_state & (SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE)) {
                        state->break_flags =
                                SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
                } else {