mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Don Heap spotted that our heuristics for dealing with IPv6 literal addresses
in the PSCP command line were bogus, giving "remote to remote not supported" errors with filenames like '[].txt'. Made the heuristic less bogus. [originally from svn r6551]
This commit is contained in:
parent
2e06985445
commit
4475ed6ed9
27
pscp.c
27
pscp.c
@ -546,26 +546,23 @@ static void print_stats(char *name, unsigned long size, unsigned long done,
|
|||||||
*/
|
*/
|
||||||
static char *colon(char *str)
|
static char *colon(char *str)
|
||||||
{
|
{
|
||||||
/* Check and process IPv6 literal addresses
|
|
||||||
* (eg: 'jeroen@[2001:db8::1]:myfile.txt') */
|
|
||||||
char *ipv6 = strchr(str, '[');
|
|
||||||
if (ipv6) {
|
|
||||||
str = strchr(str, ']');
|
|
||||||
if (str) {
|
|
||||||
/* Terminate on the closing bracket */
|
|
||||||
*str++ = '\0';
|
|
||||||
return (str);
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We ignore a leading colon, since the hostname cannot be
|
/* We ignore a leading colon, since the hostname cannot be
|
||||||
empty. We also ignore a colon as second character because
|
empty. We also ignore a colon as second character because
|
||||||
of filenames like f:myfile.txt. */
|
of filenames like f:myfile.txt. */
|
||||||
if (str[0] == '\0' || str[0] == ':' || str[1] == ':')
|
if (str[0] == '\0' || str[0] == ':' ||
|
||||||
|
(str[0] != '[' && str[1] == ':'))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
while (*str != '\0' && *str != ':' && *str != '/' && *str != '\\')
|
while (*str != '\0' && *str != ':' && *str != '/' && *str != '\\') {
|
||||||
|
if (*str == '[') {
|
||||||
|
/* Skip over IPv6 literal addresses
|
||||||
|
* (eg: 'jeroen@[2001:db8::1]:myfile.txt') */
|
||||||
|
char *ipv6_end = strchr(str, ']');
|
||||||
|
if (ipv6_end) {
|
||||||
|
str = ipv6_end;
|
||||||
|
}
|
||||||
|
}
|
||||||
str++;
|
str++;
|
||||||
|
}
|
||||||
if (*str == ':')
|
if (*str == ':')
|
||||||
return (str);
|
return (str);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user