diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2021-01-29 06:35:10 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-01-29 06:40:43 +0300 |
commit | 0d4873f9aa4ff8fc1d63a5755395b794d32ce046 (patch) | |
tree | 12b7cb6db5f333643891a8bace6158803ca2b460 /fs/cifs/fs_context.c | |
parent | bd2f0b43c1c864fa653342c5c074bfcd29f10934 (diff) | |
download | linux-0d4873f9aa4ff8fc1d63a5755395b794d32ce046.tar.xz |
cifs: fix dfs domain referrals
The new mount API requires additional changes to how DFS
is handled. Additional testing of DFS uncovered problems
with domain based DFS referrals (a follow on patch addresses
DFS links) which this patch addresses.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/fs_context.c')
-rw-r--r-- | fs/cifs/fs_context.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 27354417e988..5111aadfdb6b 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -401,6 +401,37 @@ cifs_parse_smb_version(char *value, struct smb3_fs_context *ctx, bool is_smb3) return 0; } +int smb3_parse_opt(const char *options, const char *key, char **val) +{ + int rc = -ENOENT; + char *opts, *orig, *p; + + orig = opts = kstrdup(options, GFP_KERNEL); + if (!opts) + return -ENOMEM; + + while ((p = strsep(&opts, ","))) { + char *nval; + + if (!*p) + continue; + if (strncasecmp(p, key, strlen(key))) + continue; + nval = strchr(p, '='); + if (nval) { + if (nval == p) + continue; + *nval++ = 0; + *val = kstrndup(nval, strlen(nval), GFP_KERNEL); + rc = !*val ? -ENOMEM : 0; + goto out; + } + } +out: + kfree(orig); + return rc; +} + /* * Parse a devname into substrings and populate the ctx->UNC and ctx->prepath * fields with the result. Returns 0 on success and an error otherwise |