Skip to content

Commit e5e69ab

Browse files
jtlaytonsmfrench
authored andcommitted
cifs: make error on lack of a unc= option more explicit
Error out with a clear error message if there is no unc= option. The existing code doesn't handle this in a clear fashion, and the check for a UNCip option with no UNC string is just plain wrong. Later, we'll fix the code to not require a unc= option, but for now we need this to at least clarify why people are getting errors about DFS parsing. With this change we can also get rid of some later NULL pointer checks since we know the UNC and UNCip will never be NULL there. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
1 parent d3d1fce commit e5e69ab

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎fs/cifs/connect.c‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
17991799
goto cifs_parse_mount_err;
18001800
}
18011801
#endif
1802+
if (!vol->UNC) {
1803+
cERROR(1, "CIFS mount error: No UNC path (e.g. -o "
1804+
"unc=\\\\192.168.1.100\\public) specified");
1805+
goto cifs_parse_mount_err;
1806+
}
18021807

18031808
if (vol->UNCip == NULL)
18041809
vol->UNCip = &vol->UNC[2];
@@ -2070,17 +2075,6 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
20702075
rc = -EINVAL;
20712076
goto out_err;
20722077
}
2073-
} else if (volume_info->UNCip) {
2074-
/* BB using ip addr as tcp_ses name to connect to the
2075-
DFS root below */
2076-
cERROR(1, "Connecting to DFS root not implemented yet");
2077-
rc = -EINVAL;
2078-
goto out_err;
2079-
} else /* which tcp_sess DFS root would we conect to */ {
2080-
cERROR(1, "CIFS mount error: No UNC path (e.g. -o "
2081-
"unc=//192.168.1.100/public) specified");
2082-
rc = -EINVAL;
2083-
goto out_err;
20842078
}
20852079

20862080
/* see if we already have a matching tcp_ses */
@@ -2726,9 +2720,6 @@ cifs_match_super(struct super_block *sb, void *data)
27262720

27272721
volume_info = mnt_data->vol;
27282722

2729-
if (!volume_info->UNCip || !volume_info->UNC)
2730-
goto out;
2731-
27322723
rc = cifs_fill_sockaddr((struct sockaddr *)&addr,
27332724
volume_info->UNCip,
27342725
strlen(volume_info->UNCip),

0 commit comments

Comments
 (0)