]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cifs: support mounting with alternate password to allow password rotation
authorMeetakshi Setiya <msetiya@microsoft.com>
Wed, 30 Oct 2024 09:37:21 +0000 (05:37 -0400)
committerSteve French <stfrench@microsoft.com>
Thu, 28 Nov 2024 15:50:24 +0000 (09:50 -0600)
commitb9aef1b13a0a92aa7058ba235afb24b5b89153ca
tree7bedeabf618eccae2ec51450aa58becce4c988e5
parentc353ee4fb119a2582d0e011f66a76a38f5cf984d
cifs: support mounting with alternate password to allow password rotation

Fixes the case for example where the password specified on mount is a
recently expired password, but password2 is valid.  Without this patch
this mount scenario would fail.

This patch introduces the following changes to support password rotation on
mount:

1. If an existing session is not found and the new session setup results in
EACCES, EKEYEXPIRED or EKEYREVOKED, swap password and password2 (if
available), and retry the mount.

2. To match the new mount with an existing session, add conditions to check
if a) password and password2 of the new mount and the existing session are
the same, or b) password of the new mount is the same as the password2 of
the existing session, and password2 of the new mount is the same as the
password of the existing session.

3. If an existing session is found, but needs reconnect, retry the session
setup after swapping password and password2 (if available), in case the
previous attempt results in EACCES, EKEYEXPIRED or EKEYREVOKED.

Cc: stable@vger.kernel.org
Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/connect.c