From d1683ac06012fce15e146db0d79c01a0eb3aaf60 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 16 Mar 2011 14:04:36 -0400 Subject: [PATCH] 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 --- mount/mount.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/mount/mount.c b/mount/mount.c index f7a41b3..493f8cc 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -203,15 +203,6 @@ static void ConvertUnixSlashes( *pos = TEXT('\\'); } -static LPTSTR FindEndOfServer( - IN LPTSTR pRemoteName) -{ - LPTSTR pos = pRemoteName; - while (*pos && *pos != TEXT(':')) - pos++; - return pos; -} - static DWORD ParseRemoteName( IN LPTSTR pRemoteName, IN OUT PMOUNT_OPTION_LIST pOptions, @@ -222,10 +213,10 @@ static DWORD ParseRemoteName( LPTSTR pEnd; ConvertUnixSlashes(pRemoteName); - pEnd = FindEndOfServer(pRemoteName); /* 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. ") TEXT("Expected 'hostname:\\path'.\n")); result = ERROR_BAD_ARGUMENTS;