|
Lines 162-167
const struct fs_parameter_spec smb3_fs_parameters[] = {
Link Here
|
| 162 |
fsparam_string("password", Opt_pass), |
162 |
fsparam_string("password", Opt_pass), |
| 163 |
fsparam_string("ip", Opt_ip), |
163 |
fsparam_string("ip", Opt_ip), |
| 164 |
fsparam_string("addr", Opt_ip), |
164 |
fsparam_string("addr", Opt_ip), |
|
|
165 |
fsparam_string("hostname", Opt_hostname), |
| 165 |
fsparam_string("domain", Opt_domain), |
166 |
fsparam_string("domain", Opt_domain), |
| 166 |
fsparam_string("dom", Opt_domain), |
167 |
fsparam_string("dom", Opt_domain), |
| 167 |
fsparam_string("srcaddr", Opt_srcaddr), |
168 |
fsparam_string("srcaddr", Opt_srcaddr), |
|
Lines 658-673
static int smb3_fs_context_validate(struct fs_context *fc)
Link Here
|
| 658 |
return -ENOENT; |
659 |
return -ENOENT; |
| 659 |
} |
660 |
} |
| 660 |
|
661 |
|
|
|
662 |
if (ctx->got_opt_hostname) { |
| 663 |
kfree(ctx->server_hostname); |
| 664 |
ctx->server_hostname = ctx->opt_hostname; |
| 665 |
pr_notice("changing server hostname to name provided in hostname= option\n"); |
| 666 |
} |
| 667 |
|
| 661 |
if (!ctx->got_ip) { |
668 |
if (!ctx->got_ip) { |
| 662 |
int len; |
669 |
int len; |
| 663 |
const char *slash; |
|
|
| 664 |
|
670 |
|
| 665 |
/* No ip= option specified? Try to get it from UNC */ |
671 |
/* No ip= option specified? Try to get it from server_hostname */ |
| 666 |
/* Use the address part of the UNC. */ |
672 |
/* Use the address part of the UNC parsed into server_hostname or hostname= option if specified. */ |
| 667 |
slash = strchr(&ctx->UNC[2], '\\'); |
673 |
len = strlen(ctx->server_hostname); |
| 668 |
len = slash - &ctx->UNC[2]; |
|
|
| 669 |
if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr, |
674 |
if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr, |
| 670 |
&ctx->UNC[2], len)) { |
675 |
ctx->server_hostname, len)) { |
| 671 |
pr_err("Unable to determine destination address\n"); |
676 |
pr_err("Unable to determine destination address\n"); |
| 672 |
return -EHOSTUNREACH; |
677 |
return -EHOSTUNREACH; |
| 673 |
} |
678 |
} |
|
Lines 1214-1219
static int smb3_fs_context_parse_param(struct fs_context *fc,
Link Here
|
| 1214 |
} |
1219 |
} |
| 1215 |
ctx->got_ip = true; |
1220 |
ctx->got_ip = true; |
| 1216 |
break; |
1221 |
break; |
|
|
1222 |
case Opt_hostname: |
| 1223 |
if (strnlen(param->string, CIFS_NI_MAXHOST) == CIFS_NI_MAXHOST) { |
| 1224 |
pr_warn("host name too long\n"); |
| 1225 |
goto cifs_parse_mount_err; |
| 1226 |
} |
| 1227 |
|
| 1228 |
kfree(ctx->opt_hostname); |
| 1229 |
ctx->opt_hostname = kstrdup(param->string, GFP_KERNEL); |
| 1230 |
if (ctx->opt_hostname == NULL) { |
| 1231 |
cifs_errorf(fc, "OOM when copying hostname string\n"); |
| 1232 |
goto cifs_parse_mount_err; |
| 1233 |
} |
| 1234 |
cifs_dbg(FYI, "Host name set\n"); |
| 1235 |
ctx->got_opt_hostname = true; |
| 1236 |
break; |
| 1217 |
case Opt_domain: |
1237 |
case Opt_domain: |
| 1218 |
if (strnlen(param->string, CIFS_MAX_DOMAINNAME_LEN) |
1238 |
if (strnlen(param->string, CIFS_MAX_DOMAINNAME_LEN) |
| 1219 |
== CIFS_MAX_DOMAINNAME_LEN) { |
1239 |
== CIFS_MAX_DOMAINNAME_LEN) { |