View | Details | Raw Unified | Return to bug 53190
Collapse All | Expand All

(-)a/fs/smb/client/fs_context.c (-6 / +26 lines)
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) {
(-)a/fs/smb/client/fs_context.h (+3 lines)
Lines 137-142 enum cifs_param { Link Here
137
	Opt_user,
137
	Opt_user,
138
	Opt_pass,
138
	Opt_pass,
139
	Opt_ip,
139
	Opt_ip,
140
	Opt_hostname,
140
	Opt_domain,
141
	Opt_domain,
141
	Opt_srcaddr,
142
	Opt_srcaddr,
142
	Opt_iocharset,
143
	Opt_iocharset,
Lines 161-166 struct smb3_fs_context { Link Here
161
	bool gid_specified;
162
	bool gid_specified;
162
	bool sloppy;
163
	bool sloppy;
163
	bool got_ip;
164
	bool got_ip;
165
	bool got_opt_hostname;
164
	bool got_version;
166
	bool got_version;
165
	bool got_rsize;
167
	bool got_rsize;
166
	bool got_wsize;
168
	bool got_wsize;
Lines 172-177 struct smb3_fs_context { Link Here
172
	char *domainname;
174
	char *domainname;
173
	char *source;
175
	char *source;
174
	char *server_hostname;
176
	char *server_hostname;
177
	char *opt_hostname;
175
	char *UNC;
178
	char *UNC;
176
	char *nodename;
179
	char *nodename;
177
	char workstation_name[CIFS_MAX_WORKSTATION_LEN];
180
	char workstation_name[CIFS_MAX_WORKSTATION_LEN];

Return to bug 53190