Commit 6df2a90f authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Kleber Sacilotto de Souza

cifs: set domainName when a domain-key is used in multiuser

BugLink: https://bugs.launchpad.net/bugs/1845405

[ Upstream commit f2aee329 ]

RHBZ: 1710429

When we use a domain-key to authenticate using multiuser we must also set
the domainnmame for the new volume as it will be used and passed to the server
in the NTLMSSP Domain-name.
Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 65c0ce81
......@@ -2463,6 +2463,7 @@ static int
cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
{
int rc = 0;
int is_domain = 0;
const char *delim, *payload;
char *desc;
ssize_t len;
......@@ -2510,6 +2511,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
rc = PTR_ERR(key);
goto out_err;
}
is_domain = 1;
}
down_read(&key->sem);
......@@ -2567,6 +2569,26 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
goto out_key_put;
}
/*
* If we have a domain key then we must set the domainName in the
* for the request.
*/
if (is_domain && ses->domainName) {
vol->domainname = kstrndup(ses->domainName,
strlen(ses->domainName),
GFP_KERNEL);
if (!vol->domainname) {
cifs_dbg(FYI, "Unable to allocate %zd bytes for "
"domain\n", len);
rc = -ENOMEM;
kfree(vol->username);
vol->username = NULL;
kfree(vol->password);
vol->password = NULL;
goto out_key_put;
}
}
out_key_put:
up_read(&key->sem);
key_put(key);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment