mount: fix remote name parsing to allow ipv6 addrs

instead of searching for the first :, use strrchr to find the last

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-03-16 14:04:36 -04:00 committed by unknown
parent 21a4fdd563
commit d1683ac060

View file

@ -203,15 +203,6 @@ static void ConvertUnixSlashes(
*pos = TEXT('\\'); *pos = TEXT('\\');
} }
static LPTSTR FindEndOfServer(
IN LPTSTR pRemoteName)
{
LPTSTR pos = pRemoteName;
while (*pos && *pos != TEXT(':'))
pos++;
return pos;
}
static DWORD ParseRemoteName( static DWORD ParseRemoteName(
IN LPTSTR pRemoteName, IN LPTSTR pRemoteName,
IN OUT PMOUNT_OPTION_LIST pOptions, IN OUT PMOUNT_OPTION_LIST pOptions,
@ -222,10 +213,10 @@ static DWORD ParseRemoteName(
LPTSTR pEnd; LPTSTR pEnd;
ConvertUnixSlashes(pRemoteName); ConvertUnixSlashes(pRemoteName);
pEnd = FindEndOfServer(pRemoteName);
/* fail if the server name doesn't end with :\ */ /* fail if the server name doesn't end with :\ */
if (*pEnd == 0 || pEnd[0] != TEXT(':') || pEnd[1] != TEXT('\\')) { pEnd = _tcsrchr(pRemoteName, TEXT(':'));
if (pEnd == NULL || pEnd[1] != TEXT('\\')) {
_ftprintf(stderr, TEXT("Failed to parse the remote path. ") _ftprintf(stderr, TEXT("Failed to parse the remote path. ")
TEXT("Expected 'hostname:\\path'.\n")); TEXT("Expected 'hostname:\\path'.\n"));
result = ERROR_BAD_ARGUMENTS; result = ERROR_BAD_ARGUMENTS;