Rename the handle-type enumeration values.

Mike Edenfield points out that modern versions of the Windows SDK have
decided that 'INPUT' is a sensible name for an OS data structure
(sigh), and provided a patch to add a disambiguating prefix to
winhandl.c's enum values INPUT, OUTPUT and FOREIGN.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10109 cda61777-01e9-0310-a592-d414129be87e
Generate IDE project files for Visual Studio 2010 and 2012.

Thanks to Mike Edenfield for the initial version of this patch; I've
polished it up a bit (in particular inventing a more overengineered
GUID generation strategy) but most of it is his.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10112 cda61777-01e9-0310-a592-d414129be87e
Remove mention of ASCIICTLS. It hasn't done anything since r673 in 2000.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10113 cda61777-01e9-0310-a592-d414129be87e
It's a new year.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10114 cda61777-01e9-0310-a592-d414129be87e
Fix assertion failure in Unix PuTTYgen exports.

The assertions I added to sshrand.c in r9930 are now justified,
because they were failing when cmdgen was used to convert a key into
either foreign private key file format - both the export functions
require random_byte() for one reason or another, and random_ref()
hadn't been called first.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10117 cda61777-01e9-0310-a592-d414129be87e
New hostname-handling functions in misc.c.

These are intended to make it easier to handle strings of the form
"hostname:port" or other colon-separated things including hostnames
(such as the -L and -R command-line option arguments), even though the
hostname part might be a square-bracketed IPv6 address literal
containing colons that have to _not_ be treated as separating the
top-level string components.

Three of these functions have semantics as much like existing C
library functions as I could make them (host_strchr, host_strrchr,
host_strcspn) so that it wouldn't be too error-prone to replace
existing C functions with them at lots of call sites. The fourth
function (host_strduptrim) just strips square brackets off anything
that looks like an IPv6 literal.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10119 cda61777-01e9-0310-a592-d414129be87e
Use the new host_str* functions to improve IPv6 literal support.

I've gone through everywhere we handle host names / addresses (on
command lines, in PuTTY config, in port forwarding, in X display
names, in host key storage...) and tried to make them handle IPv6
literals sensibly, by using the host_str* functions I introduced in my
previous commit. Generally it's now OK to use a bracketed IPv6 literal
anywhere a hostname might have been valid; in a few cases where no
ambiguity exists (e.g. no :port suffix is permitted anyway)
unbracketed IPv6 literals are also acceptable.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10120 cda61777-01e9-0310-a592-d414129be87e
Avoid misidentifying unbracketed IPv6 literals as host:port.

Both GUI PuTTY front ends have a piece of logic whereby a string is
interpreted as host:port if there's _one_ colon in it, but if there's
more than one colon then it's assumed to be an IPv6 literal with no
trailing port number. This permits the PuTTY command line to take
strings such as 'host', 'host:22' or '[::1]:22', but also cope with a
bare v6 literal such as '::1'.

This logic is also required in the two Plink front ends and in the
processing of CONF_loghost for host key indexing in ssh.c, but was
missing in all those places. Add it.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10121 cda61777-01e9-0310-a592-d414129be87e
Support explicit IPv6 source addresses in Windows port forwarding.

There's been a long-standing FIXME in Windows's sk_newlistener which
says that in IPv6 mode, an explicit source address (e.g. from a
command-line option of the form -L srcaddr:12345:dest:22) is ignored.
Now it's honoured if possible.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10122 cda61777-01e9-0310-a592-d414129be87e
Fix a potential crash in ssh_setup_portfwd.

If we search for a colon by computing ptr + host_strcspn(ptr,":"),
then the resulting pointer is always non-NULL, and the 'not found'
condition is not !p but !*p.

This typo could have caused PuTTY to overrun a string, but not in a
security-bug sense because any such string would have to have been
loaded from the configuration rather than received from a hostile
source.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10123 cda61777-01e9-0310-a592-d414129be87e
Don't unconditionally reset scrollback on certain escape sequences.

Handlers for a number of escape sequences, notably including ESC[J and
the sequences that switch to/from the alternate screen, were
unconditionally resetting the scrollback instead of first checking the
'Reset scrollback on display activity' configuration option. I've
added the missing if statements, so now 'Reset scrollback on display
activity' should actually mean what it says.

For example, this would have inconvenienced an mplayer user, who
wouldn't be able to go up and check their scrollback while mplayer was
repeatedly redisplaying its status line, because mplayer uses ESC[J to
erase each version of the status line before printing the next
version.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10125 cda61777-01e9-0310-a592-d414129be87e
Fix warnings when compiling with -DNO_IPV6.

A user pointed out that 'family' was uninitialised in config.c, and
when I tried test-building with -DNO_IPV6 (and the usual -Werror, of
course) some unused variables showed up in uxnet.c too.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10135 cda61777-01e9-0310-a592-d414129be87e
Revert half of r10135, and re-fix properly.

One of my changes in uxnet.c was outside the NO_IPV6 ifdef, and broke
compilation in the normal mode. Revert all changes in that file and
replace with a reference to the 'step' parameter in the no-IPv6
version of the SOCKADDR_FAMILY macro, so that those warnings are
squelched anyway.


git-svn-id: svn://svn.tartarus.org/sgt/putty@10136 cda61777-01e9-0310-a592-d414129be87e