1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-04 04:52:47 -05:00

Integrate unfix.org's IPv6 patches up to level 10, with rather a lot

of polishing to bring them to what I think should in principle be
release quality. Unlike the unfix.org patches themselves, this
checkin enables IPv6 by default; if you want to leave it out, you
have to build with COMPAT=-DNO_IPV6.

I have tested that this compiles on Visual C 7 (so the nightlies
_should_ acquire IPv6 support without missing a beat), but since I
don't have IPv6 set up myself I haven't actually tested that it
_works_. It still seems to make correct IPv4 connections, but that's
all I've been able to verify for myself. Further testing is needed.

[originally from svn r5047]
[this svn revision also touched putty-wishlist]
This commit is contained in:
Simon Tatham
2004-12-30 16:45:11 +00:00
parent 7573f3733f
commit 6daf6faede
30 changed files with 583 additions and 309 deletions

32
pscp.c
View File

@ -321,6 +321,17 @@ static void do_cmd(char *host, char *user, char *cmd)
if (host == NULL || host[0] == '\0')
bump("Empty host name");
/*
* Remove fiddly bits of address: remove a colon suffix, and
* the square brackets around an IPv6 literal address.
*/
if (host[0] == '[') {
host++;
host[strcspn(host, "]")] = '\0';
} else {
host[strcspn(host, ":")] = '\0';
}
/*
* If we haven't loaded session details already (e.g., from -load),
* try looking for a session called "host".
@ -381,11 +392,6 @@ static void do_cmd(char *host, char *user, char *cmd)
}
}
/*
* Trim a colon suffix off the hostname if it's there.
*/
cfg.host[strcspn(cfg.host, ":")] = '\0';
/*
* Remove any remaining whitespace from the hostname.
*/
@ -533,6 +539,19 @@ static void print_stats(char *name, unsigned long size, unsigned long done,
*/
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
empty. We also ignore a colon as second character because
of filenames like f:myfile.txt. */
@ -1928,7 +1947,7 @@ static void toremote(int argc, char *argv[])
*targ++ = '\0';
if (*targ == '\0')
targ = ".";
/* Substitute "." for emtpy target */
/* Substitute "." for empty target */
/* Separate host and username */
user = host;
@ -2129,6 +2148,7 @@ static void usage(void)
printf(" -l user connect with specified username\n");
printf(" -pw passw login with specified password\n");
printf(" -1 -2 force use of particular SSH protocol version\n");
printf(" -4 -6 force use of IPv4 or IPv6\n");
printf(" -C enable compression\n");
printf(" -i key private key file for authentication\n");
printf(" -batch disable all interactive prompts\n");