Граф коммитов

4923 Коммитов

Автор SHA1 Сообщение Дата
Simon Tatham 4d15d46473 Memory leak: free conn->retbuf in uxagentc.c.
While debugging some new code, I ran valgrind in leak-checking mode
and it pointed out a handful of existing memory leaks, which got in the
way of spotting any _new_ leaks I might be introducing :-)

This was one: in the case where an asynchronous agent query on Unix is
aborted, the dynamically allocated buffer holding the response was not
freed.
2017-11-26 11:32:34 +00:00
Simon Tatham 0a0a1c01d7 Additional copyright holders, from the AES-NI work. 2017-10-20 19:14:41 +01:00
Pavel I. Kryukov 2d31305af9 Alternative AES routines, using x86 hardware support.
The new AES routines are compiled into the code on any platform where
the compiler can be made to generate the necessary AES-NI and SSE
instructions. But not every CPU will support those instructions, so
the pure-software routines haven't gone away: both sets of functions
sit side by side in the code, and at key setup time we check the CPUID
bitmap to decide which set to select.

(This reintroduces function pointers into AESContext, replacing the
ones that we managed to remove a few commits ago.)
2017-10-20 19:13:54 +01:00
Pavel I. Kryukov e8be7ea98a AES: 16-byte align the key schedule arrays.
This is going to be important in the next commit, when we start
accessing them using x86 SSE instructions.
2017-10-20 19:13:47 +01:00
Pavel I. Kryukov 0816e2b1a0 AES: fold the core and outer routines together.
The outer routines are the ones which handle the CBC encrypt, CBC
decrypt and SDCTR cipher modes. Previously each of those had to be
able to dispatch to one of the per-block-size core routines, which
made it worth dividing the system up into two layers. But now there's
only one set of core routines, they may as well be inlined into the
outer ones.

Also as part of this commit, the nasty undef/redef of MAKEWORD and
LASTWORD have been removed, and the different macro definitions now
have different macro _names_, to make it clearer which one is used
where.
2017-10-20 19:13:39 +01:00
Pavel I. Kryukov 5592312636 AES: remove support for block sizes other than 128 bits.
They're not really part of AES at all, in that they were part of the
Rijndael design but not part of the subset standardised by NIST. More
relevantly, they're not used by any SSH cipher definition, so they're
just adding complexity to the code which is about to get in the way of
refactoring it.

Removing them means there's only one pair of core encrypt/decrypt
functions, so the 'encrypt' and 'decrypt' function pointer fields can
be completely removed from AESContext.
2017-10-20 19:13:21 +01:00
Simon Tatham 4dfadcfb26 sshaes.c: remove completely unused #define MAX_NK. 2017-10-19 20:01:47 +01:00
Simon Tatham ea54259392 sshaes.c: fix file name in header comment.
Apparently I forgot to edit that when I originally imported this AES
implementation into PuTTY's SSH code from the more generically named
source file in which I'd originally developed it.
2017-10-19 20:00:54 +01:00
Simon Tatham b4e5485caa Add Jeff Smith as a copyright holder. 2017-10-19 18:27:03 +01:00
Jeff Smith 891d909b3d Implement true-colour in write_clip for Windows
This allows text copied from PuTTY to a rich-text program to retain the
true-colour attribute.
2017-10-19 18:25:35 +01:00
Jeff Smith 7bdfdabb5e Update clipping interface for true-colour 2017-10-19 18:25:29 +01:00
Jeff Smith 298b9fd4d4 Setting an 8-bit colour should cancel a 24-bit colour 2017-10-14 07:59:28 +01:00
Simon Tatham 916a2574d5 Make reverse video interact correctly with true colour.
ATTR_REVERSE was being handled in the front ends, and was causing the
foreground and background colours to be switched. (I'm not completely
sure why I made that design decision; it might be purely historical,
but then again, it might also be because reverse video is one effect
on the fg and bg colours that must still be performed even in unusual
frontend-specific situations like display-driven monochrome mode.)

This affected both explicit reverse video enabled using SGR 7, and
also the transient reverse video arising from mouse selection. Thanks
to Markus Gans for reporting the bug in the latter, which when I
investigated it turned out to affect the former as well.
2017-10-08 14:05:12 +01:00
Simon Tatham f353e2219e Turn off true colour on SCO and VT52 colour sequences.
After fixing the previous two bugs, I thought it was probably a good
idea to re-check _everywhere_ in terminal.c where curr_attr is used,
to make sure that if curr_truecolour also needed updating at the same
time then that was being done.
2017-10-08 14:05:12 +01:00
Simon Tatham e3d92df936 Save and restore true-colour state with the cursor.
I spotted this myself while looking through the code in search of the
cause of the background-colour-erase bug: saving and restoring the
cursor via ESC 7 / ESC 8 ought to also save and restore the current
graphics rendition attributes including foreground and background
colour settings, but it was not saving and restoring the new
term->curr_truecolour along with term->curr_attr.

So there's now a term->save_truecolour to keep that in, and also a
term->alt_save_truecolour to take account of the fact that all the
saved cursor state variables get swapped out _again_ when switching
between the main and alternate screens.

(However, there is not a term->alt_truecolour to complete the cross
product, because the _active_ graphics rendition is carried over when
switching between the terminal screens; it's only the _saved_ one from
ESC 7 / ESC 8 that is saved separately. That's consistent with the
behaviour we've had all along for ordinary fg/bg colour selection.)
2017-10-08 14:05:04 +01:00
Simon Tatham 96a088195f Make true colour work with background-colour erase.
Thanks to Markus Gans for reporting this bug.
2017-10-08 13:43:27 +01:00
Simon Tatham 1a718403d4 Support SGR 2 to dim the foreground colour.
I've done this on a 'where possible' basis: in Windows paletted mode
(in case anyone is still using an old enough graphics card to need
that!) I simply haven't bothered, and will completely ignore the dim
flag.
2017-10-05 21:13:58 +01:00
Simon Tatham 4743798400 Support OSC 4 terminal colour-palette queries.
Markus Gans points out that some applications which (not at all
unreasonably) don't trust $TERM to tell them the full capabilities of
their terminal will use the sequence "OSC 4 ; nn ; ? BEL" to ask for
the colour-palette value in position nn, and they may not particularly
care _what_ the results are but they will use them to decide whether
the right number of colour palette entries even exist.
2017-10-05 21:05:03 +01:00
Simon Tatham 262376a054 Make the cursor colour override true colour.
Otherwise, moving the cursor (at least in active, filled-cell mode) on
to a true-coloured character cell causes it to vanish completely
because the cell's colours override the thing that differentiates the
cursor.
2017-10-05 21:05:02 +01:00
Simon Tatham 1adf211d70 Disable true colour on monochrome or paletted displays.
I'm not sure if any X11 monochrome visuals or Windows paletted display
modes are still around, but just in case they are, we shouldn't
attempt true colour on either kind of display.
2017-10-05 21:04:24 +01:00
Simon Tatham 2f9738a282 Make terminal true-colour mode configurable.
I know some users don't like any colour _at all_, and we have a
separate option to turn off xterm-style 256-colour sequences, so it
seems remiss not to have an option to disable true colour as well.
2017-10-05 21:04:23 +01:00
Simon Tatham 6b824713d5 term_mouse: make special treatment of x < 0 more selective.
A mouse drag which manages to reach x < 0 (via SetCapture or
equivalent) was treated as having the coordinates of (x_max, y-1).
This is intended to be useful when the mouse drag is part of ordinary
raster-ordered selection.

But we were leaving that treatment enabled even for mouse actions that
went to xterm mouse tracking mode - thanks to Markus Gans for
reporting that - and when I investigated, I realised that this isn't a
sensible transformation in _rectangular_ selection mode either. Fixed
both.
2017-10-01 21:57:57 +01:00
Simon Tatham f813e9f937 uxnet.c: don't close a socket's fd if it is -1.
This is harmless in principle (you just get EBADF back from close(2)
and ignore it), but it leads to warnings in valgrind.
2017-10-01 21:10:31 +01:00
Simon Tatham 16214ea0f5 Initialise term->curr_truecolour at startup.
Somehow I managed to miss _that_ really obvious bug in the true-
colour patch.
2017-10-01 21:10:31 +01:00
Simon Tatham a4cbd3dfdb Support ESC[38;2;R;G;Bm for 24-bit true colour.
This is a heavily rewritten version of a patch originally by Lorenz
Diener; it was tidied up somewhat by Christian Brabandt, and then
tidied up more by me. The basic idea is to add to the termchar
structure a pair of small structs encoding 24-bit RGB values, each
with a flag indicating whether it's turned on; if it is, it overrides
any other specification of fg or bg colour for that character cell.

I've added a test line to colours.txt containing a few example colours
from /usr/share/X11/rgb.txt. In fact it makes quite a good demo to run
the whole of rgb.txt through this treatment, with a command such as

  perl -pe 's!^\s*(\d+)\s+(\d+)\s+(\d+).*$!\e[38;2;$1;$2;$3m$&\e[m!' rgb.txt
2017-09-30 18:19:44 +01:00
Simon Tatham 581dd7071e Squash the 256-colour test text into fewer lines.
I'm about to want to add more stuff to that file, and it would be nice
to have it still fit on a screen after I do.
2017-09-30 17:31:33 +01:00
Simon Tatham ba4837dae8 Add a -restrict-putty-acl option to Windows Pageant.
This causes PuTTY processes spawned from its system-tray menu to run
with the -restrict-acl option (or rather, the synonymous &R prefix
used by my auto-constructed command lines for easier parsing).

The previous behaviour of Pageant was never to pass -restrict-acl to
PuTTY, even when started with -restrict-acl itself; this is not
actually a silly thing to want to do, because Pageant might well have
more need of -restrict-acl than PuTTY (it stores longer-term and more
powerful secrets) and conversely PuTTY might have more need to _not_
restrict its ACL than Pageant (in that among the things enabled by an
unrestricted ACL are various kinds of accessibility software, which is
more useful on the more user-facing PuTTY than on Pageant).

But for those who want to lock everything down with every security
option possible (even though -restrict-acl is only an ad-hoc
precaution and cannot deliver any hard guarantees), this new option
should fill in the UI gap.
2017-09-20 18:24:34 +01:00
Simon Tatham 4ec2791945 Remove Makefile.bor.
After a conversation this week with a user who tried to use it, it's
clear that Borland C can't build the up-to-date PuTTY without having
to make too many compromises of functionality (unsupported API
details, no 'long long' type), even above the issues that could be
worked round with extra porting ifdefs.
2017-09-13 19:26:28 +01:00
Simon Tatham 4634cd47f7 Avoid zero-length ldisc_send() in terminal.c.
A user reports that a remote window title query, if the window title
is empty or if the option to return it is disabled, fails the
assertion in ldisc_send that I introduced as part of commit c269dd013
to catch any lingering uses of ldisc_send with length 0 that should
have turned into ldisc_echoedit_update. Added a check for len > 0
guarding that ldisc_send call, and likewise at one or two others I
noticed on my way here.

(Probably at some point I should decide that the period of smoking out
lingering old-style ldisc_send(0) calls is over, and declare it safe
to remove that assertion again and get rid of all the cumbersome
safety checks at call sites like these ones. But not quite yet.)
2017-09-05 20:14:33 +01:00
Simon Tatham a459fc58e8 Switch to producing .res files, not .res.o.
I've just upgraded my build process to a version of lld-link
that knows how to read .res, and I think it's a slightly more
commonly found format, so less confusing to encounter.
2017-08-26 15:23:56 +01:00
Simon Tatham 55efbc56a0 Fix filename of the 64-bit MIT Kerberos DLL.
64-bit PuTTY should be loading gssapi64.dll, not gssapi32.dll. (In
contrast to the Windows system API DLLs, such as secur32.dll which is
also mentioned in the same source file; those keep the "32" in their
name whether we're in Win32 or Win64.)
2017-08-04 19:46:21 +01:00
Simon Tatham 0a93b5d9bc Stop ssh2_msg_channel_response using a stale ssh_channel.
When it calls through ocr->handler() to process the response to a
channel request, sometimes that call ends up back in the main SSH-2
authconn coroutine, and sometimes _that_ will call bomb_out(), which
closes the whole SSH connection and frees all the channels - so that
when control returns back up the call stack to
ssh2_msg_channel_response itself which continues working with the
channel it was passed, it's using freed memory and things go badly.

This is the sort of thing I'd _like_ to fix using some kind of
large-scale refactoring along the lines of moving all the actual
free() calls out into top-level callbacks, so that _any_ function
which is holding a pointer to something can rely on that pointer still
being valid after it calls a subroutine. But I haven't worked out all
the details of how that system should work, and doubtless it will turn
out to have problems of its own once I do, so here's a point fix which
simply checks if the whole SSH session has been closed (which is easy
- much easier than checking if that _channel_ structure still exists)
and fixes the immediate bug.

(I think this is the real fix for the problem reported by the user I
mention in commit f0126dd19, because I actually got the details wrong
in the log message for that previous commit: the user's SSH server
wasn't rejecting the _opening_ of the main session channel, it was
rejecting the "shell" channel request, so this code path was the one
being exercised. Still, the other bug was real too, so no harm done!)
2017-07-19 07:28:27 +01:00
Simon Tatham f0126dd198 Set ssh->mainchan->type earlier.
A user reported a nonsensical assertion failure (claiming that
ssh->version != 2) which suggested that a channel had somehow outlived
its parent Ssh in the situation where the opening of the main session
channel is rejected by the server. Checking with valgrind suggested
that things start to go wrong at the point where we free the half-set-
up ssh->mainchan before having filled in its type field, so that the
switch in ssh_channel_close_local() picks an arbitrary wrong action.

I haven't reproduced the same failure the user reported, but with this
change, Unix plink is now valgrind-clean in that failure situation.
2017-07-17 20:57:07 +01:00
Jacob Nevins 25683f0f3d Add a FAQ about servers that don't like IUTF8. 2017-07-12 10:19:23 +01:00
Ion Gaztañaga 309c3dfd95 Add -share -noshare command line option to plink to share SSL connections. 2017-07-08 09:28:20 +01:00
Simon Tatham 0e2955ffbf Add a --no-ftp mode to the release.pl download checks.
chiark's ftp server sometimes randomly refuses downloads. In the case
where this happens at postcheck time, this isn't really
release-blocking (all the files have been test-downloaded by precheck
already, so the main aim at this stage is to check that the 'latest'
symlink points to the right place, and even one or two successful
downloads are good enough to confirm that in practice). So now I can
add --no-ftp to the postcheck command line if that makes my life
easier.
2017-07-08 09:27:57 +01:00
Simon Tatham 7470e3bdaf Stop release.pl --setver failing if Makefile exists.
This should have been part of commit ea0ab1c82; it's part of the
general revamp that we regenerate the autoconf files ourselves in a
clean directory - so we don't depend on them being present, but we
also don't depend on them being _absent_ either.

But when I made that commit my immediate priority was to get --setver
to work from a completely clean checkout, not from one already
littered with cruft, so I didn't check quite as carefully that my
changes fixed the problem in the latter case too :-)
2017-07-08 09:27:57 +01:00
Simon Tatham 3cd10509a5 Update version number for 0.70 release. 2017-07-04 20:29:54 +01:00
Simon Tatham a2b040ee09 Expand the About box.
It wasn't big enough to fit the full buildinfo text, when compiling
with clang-cl which has a bulky compiler identification string.
2017-07-04 19:35:18 +01:00
Simon Tatham 5cac6013b7 Rework the release checklist for current practice.
In recent releases we've taken to making the actual release build (or
rather, candidates for it) ahead of time so that we can do some
slightly more thorough last-minute testing of the exact binaries that
we're going to release to everyone. It's time I actually wrote that
procedure down in the checklist, so that I remember what it is.

In particular, we had the idea that we should not properly GPG-sign
the release until the last moment, and use the presence of a set of
full GPG signatures as a means of distinguishing the real release
build from an RC that accidentally got out into the wild somehow. This
checklist update formalises that too, and documents the method I used
of ensuring the binaries weren't tampered with between RC building and
release signing (by making a signature on just the sha512sums). I also
include in this commit an extra command-line option to sign.sh to make
that preliminary signature step more convenient.
2017-07-03 07:45:40 +01:00
Simon Tatham ea0ab1c821 Simplify running of release.pl --setver.
Previously, it demanded that your checkout was in a state where you
had run autoconf but not configure; so if you previously did have a
Makefile then you had to 'make distclean' to remove it, whereas if you
previously had no generated files at all (e.g. starting from a
completely clean checkout) then you had to run mkfiles.pl and
mkauto.sh to generate 'configure'.

This is obviously confusing, and moreover, the dependence on prior
generated files is fragile and prone to them having been generated
wrong. Adjusted the script so that it uses 'git archive' to get a
clean directory containing only the version-controlled files, and then
runs scripts itself to get that directory into the state it wants.
2017-07-03 07:28:45 +01:00
Simon Tatham 4624115b76 Make -DMINEFIELD show up in Windows buildinfo.
I listed a lot of other build options, but not that one. The release
checklist still recommends doing test builds with it, so it seems
sensible to arrange that you can tell if a build _is_ one of those or
not.
2017-07-03 07:27:05 +01:00
Simon Tatham 4065b0cd78 Merge update of wcwidth.c to Unicode 9. 2017-07-02 09:30:00 +01:00
David Taylor 4241734dde Update wcwidth.c with Unicode 9.0.0 data
In order to maintain compatibility with screen[1], update
wcwidth functions to use Unicode 9.0.0 character database.

Updated intervals extracted from output of [2] from ucd files[3].

The comments at the head of [2] state that the output is unrestricted.
Therefore it is not subject to the GPL as applies to the script itself.

[1] See: https://savannah.gnu.org/bugs/?func=detailitem&item_id=50044
[2] https://raw.githubusercontent.com/GNOME/glib/37d4c2941bd0326b8b6e6bb22c81bd424fcc040b/glib/gen-unicode-tables.pl
[3] http://www.unicode.org/Public/9.0.0/ucd/
2017-07-01 23:25:49 +01:00
Simon Tatham d61897414c Fixes spotted by Coverity.
A lenof() being applied to a non-array, a couple of missing frees on
an error path, and a case in pfd_receive() where we could have gone
round a loop again after freeing the port forwarding structure it was
working on.
2017-06-20 21:17:43 +01:00
Simon Tatham 4696f4a40b Coverity build fixes.
Like every other toolchain I've tried, my Coverity scanning build has
its share of random objections to parts of my Windows API type-
checking system. I do wonder if that bright idea was worth the hassle
- but it would probably cost all the annoyance all over again to back
out now...
2017-06-20 19:02:48 +01:00
Simon Tatham 98cbe6963b Another format-string fix.
Oops - I found this in an editor autosave file after pushing the
previous commit. I meant it to be part of the previous commit. Oh
well, better late than never.
2017-06-20 19:02:13 +01:00
Simon Tatham 34389feaed Merge further cppcheck fixes from Ilya Shipitsin. 2017-06-20 07:08:25 +01:00
Simon Tatham 20e36ae4a2 Fix a collection of type / format string mismatches.
Ilya Shipitsin sent me a list of errors reported by a tool 'cppcheck',
which I hadn't seen before, together with some fixes for things
already taken off that list. This change picks out all the things from
the remaining list that I could quickly identify as actual errors,
which it turns out are all format-string goofs along the lines of
using a %d with an unsigned int, or a %u with a signed int, or (in the
cases in charset/utf8.c) an actual _size_ mismatch which could in
principle have caused trouble on a big-endian target.
2017-06-20 07:05:39 +01:00
Ilya Shipitsin 02043ec5ac resolve (no real impact) issue found by cppcheck:
[windows/winnet.c:589]: (error) Uninitialized variable: err
2017-06-20 09:36:07 +05:00