diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2019-08-22 08:09:50 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-21 07:17:03 +0200 |
commit | 325fa2a6729b74b2806b31725940cb54658515e5 (patch) | |
tree | 9a49252b6705ab1ab1e5d436749edac7ab5b62b2 /fs/cifs | |
parent | 9a74f799b99c7aaad8304c33733f4e02c8c7890d (diff) | |
download | linux-stable-325fa2a6729b74b2806b31725940cb54658515e5.tar.gz linux-stable-325fa2a6729b74b2806b31725940cb54658515e5.tar.bz2 linux-stable-325fa2a6729b74b2806b31725940cb54658515e5.zip |
cifs: set domainName when a domain-key is used in multiuser
[ Upstream commit f2aee329a68f5a907bcff11a109dfe17c0b41aeb ]
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: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 208430bb66fc..75727518b272 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2756,6 +2756,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; @@ -2803,6 +2804,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); @@ -2860,6 +2862,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); |