Skip to content

Commit

Permalink
cifs: make error on lack of a unc= option more explicit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Layton authored and Steve French committed Dec 5, 2012
1 parent d3d1fce commit e5e69ab
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
goto cifs_parse_mount_err;
}
#endif
if (!vol->UNC) {
cERROR(1, "CIFS mount error: No UNC path (e.g. -o "
"unc=\\\\192.168.1.100\\public) specified");
goto cifs_parse_mount_err;
}

if (vol->UNCip == NULL)
vol->UNCip = &vol->UNC[2];
Expand Down Expand Up @@ -2070,17 +2075,6 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
rc = -EINVAL;
goto out_err;
}
} else if (volume_info->UNCip) {
/* BB using ip addr as tcp_ses name to connect to the
DFS root below */
cERROR(1, "Connecting to DFS root not implemented yet");
rc = -EINVAL;
goto out_err;
} else /* which tcp_sess DFS root would we conect to */ {
cERROR(1, "CIFS mount error: No UNC path (e.g. -o "
"unc=//192.168.1.100/public) specified");
rc = -EINVAL;
goto out_err;
}

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

volume_info = mnt_data->vol;

if (!volume_info->UNCip || !volume_info->UNC)
goto out;

rc = cifs_fill_sockaddr((struct sockaddr *)&addr,
volume_info->UNCip,
strlen(volume_info->UNCip),
Expand Down

0 comments on commit e5e69ab

Please sign in to comment.