Move the -I options for all our source subdirectories out of AM_CFLAGS
and into AM_CPPFLAGS. This is more conceptually sensible according to
my reading of the automake manual, and also has the specific desirable
effect that they move to the front of the command line, ahead of any
'system' type -I options that autoconf might have felt a need for.

A user reported that autoconf had added -I/usr/local/include to their
command line for the sake of a required header file, but their
/usr/local/include also turned out to include a thing called 'proxy.h'
(from libproxy, nothing to do with us) which shadowed our own proxy.h
and caused a build failure. This should fix that.


git-svn-id: svn://svn.tartarus.org/sgt@9736 cda61777-01e9-0310-a592-d414129be87e
Reorganise setup_fonts_ucs so that in case of error it does nothing
and returns its error message as a string, instead of actually
printing it on standard error and exiting. Now we can preserve the
previous error behaviour when we get a nonexistent font name at
startup time, but no longer rudely terminate in mid-session if the
user configures a bogus font name in Change Settings.


git-svn-id: svn://svn.tartarus.org/sgt@9745 cda61777-01e9-0310-a592-d414129be87e
Adjust comments around split_into_argv() to clarify that it's not
*Windows's* command-line splitting rules we're mimicking here; it's
VC7's, and they're not the same as VC10's.


git-svn-id: svn://svn.tartarus.org/sgt@9748 cda61777-01e9-0310-a592-d414129be87e
Patch from Egmont Koblinger to implement two extended variants of
xterm mouse tracking, both supported by the current up-to-date xterm
(288). They take the form of two new DEC terminal modes, 1006 and
1015, which do not in themselves _enable_ mouse tracking but they
modify the escape sequences sent if mouse tracking is enabled in the
usual way.


git-svn-id: svn://svn.tartarus.org/sgt@9752 cda61777-01e9-0310-a592-d414129be87e
Take advantage of PUT_32BIT_MSB_FIRST when constructing sequence numbers
to MAC.


git-svn-id: svn://svn.tartarus.org/sgt@9758 cda61777-01e9-0310-a592-d414129be87e
Add support for HMAC-SHA-256 as an SSH-2 MAC algorithm ("hmac-sha2-256") 
as specified in RFC 6668.  This is not so much because I think it's 
necessary, but because scrypt uses HMAC-SHA-256 and once we've got it we 
may as well use it.

Code very closely derived from the HMAC-SHA-1 code.

Tested against OpenSSH 5.9p1 Debian-5ubuntu1.


git-svn-id: svn://svn.tartarus.org/sgt@9759 cda61777-01e9-0310-a592-d414129be87e
Give a better error message if a PuTTY private key file has a version
number we don't understand. It's nicer to report 'format too new' than
'not a PuTTY key file'.


git-svn-id: svn://svn.tartarus.org/sgt@9763 cda61777-01e9-0310-a592-d414129be87e
Don't forget to check the return values of setuid and friends.


git-svn-id: svn://svn.tartarus.org/sgt@9764 cda61777-01e9-0310-a592-d414129be87e
Remove the half-hearted attempt to make the utmp helper process drop
privileges just before dying of a fatal signal. I'm not sure what I
intended it for in the first place; it certainly isn't doing its job
properly (no setgid), it's causing compiler warnings due to not
checking the setuid return code, and we can't think of any useful
purpose for it.


git-svn-id: svn://svn.tartarus.org/sgt@9766 cda61777-01e9-0310-a592-d414129be87e
Fix a bug in which terminal output received from the session could be
buffered in terminal.c indefinitely and only released when further
output turned up.

Arose because we suppress the call to term_out from term_data if a
drag-select is in progress, but when the drag-select ends we weren't
proactively calling term_out to release the buffered data. So if your
session generated some terminal output while you were in mid-select,
_and had stopped by the time you let go of the mouse button_, then the
output would just sit there until released by the next call to
term_data.


git-svn-id: svn://svn.tartarus.org/sgt@9768 cda61777-01e9-0310-a592-d414129be87e
It's probably well past time for this: change PuTTY's default
character set configuration to UTF-8, on both Windows and Unix, and
reorganise the dropdown lists in the Translation menu so that UTF-8
appears at the top (and Unix's odd "use font encoding" is relegated to
the bottom of the list like the special-purpose oddity it is).


git-svn-id: svn://svn.tartarus.org/sgt@9843 cda61777-01e9-0310-a592-d414129be87e
Update docs for change to UTF-8 by default, and emphasise UTF-8 more generally.


git-svn-id: svn://svn.tartarus.org/sgt@9846 cda61777-01e9-0310-a592-d414129be87e
Fallback for manual setup of GTK 1, if autoconf is run on a system
where the GTK1 detection function AM_PATH_GTK hasn't been provided by
/usr/share/aclocal/gtk.m4 or equivalent.

(Systems without gtk.m4 are becoming more common, but on the other
hand I know at least one person is still using GTK 1 PuTTY since the
0.62 release.)


git-svn-id: svn://svn.tartarus.org/sgt@9868 cda61777-01e9-0310-a592-d414129be87e
A collection of small bug fixes from Chris West, apparently spotted by
Coverity: assorted language-use goofs like freeing the wrong thing or
forgetting to initialise a string on all code paths.


git-svn-id: svn://svn.tartarus.org/sgt@9889 cda61777-01e9-0310-a592-d414129be87e
Clean up handling of the return value from sftp_find_request. In many
places we simply enforce by assertion that it will match the request
we sent out a moment ago: in fact it can also return NULL, so it makes
more sense to report a proper error message if it doesn't return the
expected value, and while we're at it, have that error message
whatever message was helpfully left in fxp_error() by
sftp_find_request when it failed.

To do this, I've written a centralised function in psftp.c called
sftp_wait_for_reply, which is handed a request that's just been sent
out and deals with the mechanics of waiting for its reply, returning
the reply when it arrives, and aborting with a sensible error if
anything else arrives instead. The numerous sites in psftp.c which
called sftp_find_request have all been rewritten to do this instead,
and as a side effect they now look more sensible. The only other uses
of sftp_find_request were in xfer_*load_gotpkt, which had to be
tweaked in its own way.

While I'm here, also fix memory management in sftp_find_request, which
was freeing its input packet on some but not all error return paths.


git-svn-id: svn://svn.tartarus.org/sgt@9894 cda61777-01e9-0310-a592-d414129be87e
Move the SSH-1 servkey and hostkey variables into the coroutine state,
since there is a theoretical code path (via the crReturn loop after
asking an interactive question about a host key or crypto algorithm)
on which we can leave and return to do_ssh1_login between allocating
and freeing those keys.

(In practice it shouldn't come up anyway with any of the current
implementations of the interactive question functions, not to mention
the unlikelihood of anyone non-specialist still using SSH-1, but
better safe than sorry.)


git-svn-id: svn://svn.tartarus.org/sgt@9895 cda61777-01e9-0310-a592-d414129be87e
Add an assortment of extra safety checks.


git-svn-id: svn://svn.tartarus.org/sgt@9896 cda61777-01e9-0310-a592-d414129be87e
Get rid of the fixed-size 'hostname' buffer in every port-forwarded
connection, and replace it with sensible dynamically allocated
storage. While I'm at it, get rid of the disgusting dual use between
storing an actual hostname and storing an incoming SOCKS request; we
now have a separate pointer variable for each.


git-svn-id: svn://svn.tartarus.org/sgt@9903 cda61777-01e9-0310-a592-d414129be87e
Add another missing bounds check in the SSH-1 private key loader.


git-svn-id: svn://svn.tartarus.org/sgt@9904 cda61777-01e9-0310-a592-d414129be87e
Fix a mishandling of error returns from makekey() in the SSH-1 private
key loader.


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