[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250110121113.60210-1-meetakshisetiyaoss@gmail.com>
Date: Fri, 10 Jan 2025 07:10:27 -0500
From: meetakshisetiyaoss@...il.com
To: sfrench@...ba.org,
pc@...guebit.com,
ronniesahlberg@...il.com,
sprasad@...rosoft.com,
nspmangalore@...il.com,
tom@...pey.com,
linux-cifs@...r.kernel.org,
linux-kernel@...r.kernel.org,
samba-technical@...ts.samba.org,
bharathsm.hsk@...il.com,
bharathsm@...rosoft.com
Cc: Meetakshi Setiya <msetiya@...rosoft.com>
Subject: [PATCH] cifs: support reconnect with alternate password for SMB1
From: Meetakshi Setiya <msetiya@...rosoft.com>
SMB1 shares the mount and remount code paths with SMB2/3 and already
supports password rotation in some scenarios. This patch extends the
password rotation support to SMB1 reconnects as well.
Signed-off-by: Meetakshi Setiya <msetiya@...rosoft.com>
---
fs/smb/client/cifssmb.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index bd42a419458e..efdb7bf9bb57 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -152,8 +152,17 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
spin_unlock(&ses->ses_lock);
rc = cifs_negotiate_protocol(0, ses, server);
- if (!rc)
+ if (!rc) {
rc = cifs_setup_session(0, ses, server, ses->local_nls);
+ if ((rc == -EACCES) || (rc == -EHOSTDOWN) || (rc == -EKEYREVOKED)) {
+ /*
+ * Try alternate password for next reconnect if an alternate
+ * password is available.
+ */
+ if (ses->password2)
+ swap(ses->password2, ses->password);
+ }
+ }
/* do we need to reconnect tcon? */
if (rc || !tcon->need_reconnect) {
--
2.46.0.46.g406f326d27
Powered by blists - more mailing lists