Commit b8ed9da1 authored by Meetakshi Setiya's avatar Meetakshi Setiya Committed by Steve French
Browse files

cifs: support reconnect with alternate password for SMB1



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.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarMeetakshi Setiya <msetiya@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 5bc55a33
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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) {