Cygwin: mount: allow any valid character in UNC paths
The current code only allows server and share names to
start with ASCII chars [a-zA-Z0-9],, which is not correct.
Rather, check for a valid share character.
Fixes: 1fd5e000ac
("import winsup-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
17ad18afc6
commit
33e4340d44
|
@ -42,11 +42,20 @@ bool NO_COPY mount_info::got_usr_bin;
|
||||||
bool NO_COPY mount_info::got_usr_lib;
|
bool NO_COPY mount_info::got_usr_lib;
|
||||||
int NO_COPY mount_info::root_idx = -1;
|
int NO_COPY mount_info::root_idx = -1;
|
||||||
|
|
||||||
/* is_unc_share: Return non-zero if PATH begins with //server/share
|
/* is_native_path: Return non-zero if PATH starts with \??\[a-zA-Z] or
|
||||||
|
with \\?\[a-zA-Z] or with \\.\[a-zA-Z].
|
||||||
|
|
||||||
|
is_unc_share: Return non-zero if PATH begins with //server/share
|
||||||
or with one of the native prefixes //./ or //?/
|
or with one of the native prefixes //./ or //?/
|
||||||
|
|
||||||
This function is only used to test for valid input strings.
|
This function is only used to test for valid input strings.
|
||||||
The later normalization drops the native prefixes. */
|
The later normalization drops the native prefixes. */
|
||||||
|
|
||||||
|
/* list of invalid chars in UNC filenames. These are a few more than
|
||||||
|
for "normal" filenames. */
|
||||||
|
const char _invalid_char[] = "\"/\\[]:|<>+=;,?*";
|
||||||
|
#define valid_share_char(_c) (strchr (_invalid_char, (_c)) == NULL)
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
is_native_path (const char *path)
|
is_native_path (const char *path)
|
||||||
{
|
{
|
||||||
|
@ -63,9 +72,9 @@ is_unc_share (const char *path)
|
||||||
const char *p;
|
const char *p;
|
||||||
return (isdirsep (path[0])
|
return (isdirsep (path[0])
|
||||||
&& isdirsep (path[1])
|
&& isdirsep (path[1])
|
||||||
&& isalnum (path[2])
|
&& valid_share_char (path[2])
|
||||||
&& ((p = strpbrk (path + 3, "\\/")) != NULL)
|
&& ((p = strpbrk (path + 3, "\\/")) != NULL)
|
||||||
&& isalnum (p[1]));
|
&& valid_share_char (p[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if src_path is a valid, internally supported device name.
|
/* Return true if src_path is a valid, internally supported device name.
|
||||||
|
|
|
@ -3,3 +3,6 @@ Bug Fixes
|
||||||
|
|
||||||
Fix a problem that fsync returns EINVAL for block device.
|
Fix a problem that fsync returns EINVAL for block device.
|
||||||
Addresses: https://cygwin.com/pipermail/cygwin/2023-January/252916.html
|
Addresses: https://cygwin.com/pipermail/cygwin/2023-January/252916.html
|
||||||
|
|
||||||
|
Don't reject valid server and share names when mounting.
|
||||||
|
Addresses: https://cygwin.com/pipermail/cygwin/2023-January/252928.html
|
||||||
|
|
Loading…
Reference in New Issue