diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2019-08-21 18:09:50 -0400 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-08-27 17:44:24 -0400 |
commit | f2aee329a68f5a907bcff11a109dfe17c0b41aeb (patch) | |
tree | 5ffbf6011e20969aa94ae5253ca3993e69d2b0a3 /fs/cifs | |
parent | a55aa89aab90fae7c815b0551b07be37db359d76 (diff) |
cifs: set domainName when a domain-key is used in multiuser
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>
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 1795e80cbdf7..9d2576f31689 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2981,6 +2981,7 @@ static int | |||
2981 | cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) | 2981 | cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) |
2982 | { | 2982 | { |
2983 | int rc = 0; | 2983 | int rc = 0; |
2984 | int is_domain = 0; | ||
2984 | const char *delim, *payload; | 2985 | const char *delim, *payload; |
2985 | char *desc; | 2986 | char *desc; |
2986 | ssize_t len; | 2987 | ssize_t len; |
@@ -3028,6 +3029,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) | |||
3028 | rc = PTR_ERR(key); | 3029 | rc = PTR_ERR(key); |
3029 | goto out_err; | 3030 | goto out_err; |
3030 | } | 3031 | } |
3032 | is_domain = 1; | ||
3031 | } | 3033 | } |
3032 | 3034 | ||
3033 | down_read(&key->sem); | 3035 | down_read(&key->sem); |
@@ -3085,6 +3087,26 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) | |||
3085 | goto out_key_put; | 3087 | goto out_key_put; |
3086 | } | 3088 | } |
3087 | 3089 | ||
3090 | /* | ||
3091 | * If we have a domain key then we must set the domainName in the | ||
3092 | * for the request. | ||
3093 | */ | ||
3094 | if (is_domain && ses->domainName) { | ||
3095 | vol->domainname = kstrndup(ses->domainName, | ||
3096 | strlen(ses->domainName), | ||
3097 | GFP_KERNEL); | ||
3098 | if (!vol->domainname) { | ||
3099 | cifs_dbg(FYI, "Unable to allocate %zd bytes for " | ||
3100 | "domain\n", len); | ||
3101 | rc = -ENOMEM; | ||
3102 | kfree(vol->username); | ||
3103 | vol->username = NULL; | ||
3104 | kfree(vol->password); | ||
3105 | vol->password = NULL; | ||
3106 | goto out_key_put; | ||
3107 | } | ||
3108 | } | ||
3109 | |||
3088 | out_key_put: | 3110 | out_key_put: |
3089 | up_read(&key->sem); | 3111 | up_read(&key->sem); |
3090 | key_put(key); | 3112 | key_put(key); |