]> asedeno.scripts.mit.edu Git - PuTTY.git/log
PuTTY.git
8 years agoInaugural merge from branch 'pre-0.67'.
Simon Tatham [Mon, 29 Feb 2016 19:59:37 +0000 (19:59 +0000)]
Inaugural merge from branch 'pre-0.67'.

This is a 'merge -s ours', making no change to master but just
recording an ancestry relationship to make further merges from the
release branch easy.

8 years agoIt's a new year.
Jacob Nevins [Sat, 27 Feb 2016 10:38:48 +0000 (10:38 +0000)]
It's a new year.

(cherry picked from commit cfbe604d068ea8761eeb5da0138e4bef50dd077f)

8 years agoFix strict-aliasing warnings in sk_tcp_peer_info.
Colin Watson [Thu, 28 Jan 2016 21:22:07 +0000 (21:22 +0000)]
Fix strict-aliasing warnings in sk_tcp_peer_info.

GCC 6 emits strict-aliasing warnings here, so use the existing
sockaddr_union arrangements to avoid those.  As a prerequisite for being
able to express sk_tcp_peer_info in terms of sockaddr_union, I fixed up
the union elements to be a bit less odd in the NO_IPV6 case.

(cherry picked from commit c026b48c537250ac03573845ff9da6fd9f45776d)

8 years agoAvoid -Wmisleading-indentation warnings with GCC 6.
Colin Watson [Thu, 28 Jan 2016 21:19:41 +0000 (21:19 +0000)]
Avoid -Wmisleading-indentation warnings with GCC 6.

GCC 6 warns about potentially misleading indentation, such as:

    if (condition) stmt1; stmt2;

Chaining multiple ifs on a single line runs into this warning, even if
it's probably not actually misleading to a human eye, so just add a
couple of newlines to pacify the compiler.

(cherry picked from commit d700c33422926dda1b4af90bf1fcd262b03cfca8)

8 years agoFix a 64-bit-cleanness error in sshcrc's generator.
Simon Tatham [Tue, 26 Jan 2016 22:09:01 +0000 (22:09 +0000)]
Fix a 64-bit-cleanness error in sshcrc's generator.

Not that anyone actually needs to use that conditioned-out main(),
since it only generates the table already present in the same source
file, but since @ch3root's unused-variable patch touched it I tried
compiling it and noticed in passing that I'd also got the wrong printf
format directive for an unsigned long.

(cherry picked from commit 9351a5bfe4b1630227581d77f1aff4ca729ab8c1)

8 years agoRemove some unused variables.
Simon Tatham [Tue, 26 Jan 2016 18:36:26 +0000 (18:36 +0000)]
Remove some unused variables.

Thanks to @ch3root again for this patch.

(cherry picked from commit 70f641f84527fcb5a2ccbff7c8e238003ff2d2f3)

8 years agoAdd the new copy.but to .gitignore.
Simon Tatham [Tue, 22 Dec 2015 13:56:07 +0000 (13:56 +0000)]
Add the new copy.but to .gitignore.

Arrgh, _another_ one I only remember seconds too late!

(cherry picked from commit 51465fac73742602003db2c445109a3526fad16e)

8 years agoAutogenerate licence text in doc subdir from LICENCE.
Simon Tatham [Thu, 25 Feb 2016 20:45:27 +0000 (20:45 +0000)]
Autogenerate licence text in doc subdir from LICENCE.

Now we have licence.pl, it seems to me to make very good sense to have
it generate the Halibut form(s) of the licence and copyright year as
well as the source-code forms.

As a result, I believe _no_ copies of the licence text or copyright
date exist any more except for the master one in LICENCE - so I can
completely remove the checklist section about all the places to update
it, because there's only one. Hooray!

(cherry picked from commit 774d37a0dc79441d6add265a0d360af3e53f8460)

Conflicts:
doc/licence.but

(cherry-picker's note: the conflict was just because the deleted file
didn't have identical contents)

8 years agoStop copying the licence text into C source code.
Simon Tatham [Thu, 25 Feb 2016 20:43:54 +0000 (20:43 +0000)]
Stop copying the licence text into C source code.

Now all the uses of the licence text or the short copyright notice get
it from a new header "licence.h", which in turn is built by a Perl
script licence.pl invoked by mkfiles.pl, using LICENCE itself as the
source.

Hence, I can completely remove a whole section from the list of
licence locations in CHECKLST.txt :-)

(cherry picked from commit 9ddd071ec28050b3be572f25f3ae7d44e46e4039)

Conflicts:
unix/gtkdlg.c
windows/winpgnt.c

(cherry-picker's notes: one conflict was just changed context, the
other was deleting a copy of the licence that wasn't quite the same
between branches)

8 years agoUse readonly edit controls in some Windows dialogs.
Simon Tatham [Thu, 25 Feb 2016 20:42:00 +0000 (20:42 +0000)]
Use readonly edit controls in some Windows dialogs.

This makes the About and Licence boxes copy-and-pasteable, similarly
to what I've just done on Unix.

(But unlike on the Unix side, here I haven't touched the host key
prompt dialog, because that's a standard Windows MessageBox and not
easy to mess around with. Plus, in any case, you can already hit ^C to
copy the whole text out of a MessageBox. Same goes for the PGP
fingerprints dialog.)

As a side effect, several copies of the copyright notice and licence
text have moved from .rc files into C source. I've updated
CHECKLST.txt, but they won't stay there for long.

(cherry picked from commit 2eb952ca31aa13d1f6f429305fbb6f43a9a28c56)

Conflicts:
windows/pageant.rc
windows/puttygen.rc
windows/win_res.rc2

(cherry-picker's notes: the conflict was just because several copies
of the licence text were deleted, and they weren't quite the same
between branches)

8 years agoMake some static text in GTK dialogs selectable.
Simon Tatham [Thu, 25 Feb 2016 20:39:22 +0000 (20:39 +0000)]
Make some static text in GTK dialogs selectable.

I've made the licence text, the About box, and the host key dialog
into GTK selectable edit controls. (The former because it contains a
lot of text; the About box because pasting version numbers into bug
reports is obviously useful; the host key because of the fingerprint.)

(cherry picked from commit 21101c7397e460933635a7bfed813864fc4f88fe)

Conflicts:
unix/gtkdlg.c
unix/unix.h

(cherry-picker's notes: not a trivial resolution, since I had to apply
the equivalent changes in the pre-GTK3-port version of the code)

8 years agoPut back in a missing dynamic-load wrapper on SetSecurityInfo.
Simon Tatham [Sat, 28 Nov 2015 18:31:10 +0000 (18:31 +0000)]
Put back in a missing dynamic-load wrapper on SetSecurityInfo.

We had inadvertently raised the minimum supported Windows version in
the course of restricting PuTTY's ACL.

(cherry picked from commit bf3621f247937b51e983f364377bb408b4cb609b)

8 years agoCode-sign the Windows PuTTY binaries and installer.
Simon Tatham [Fri, 11 Dec 2015 06:47:20 +0000 (06:47 +0000)]
Code-sign the Windows PuTTY binaries and installer.

Or, at least, potentially do so. The build script now has a slot into
which code-signing can be dropped by setting a variable in the bob
configuration to specify an appropriate command line.

The variable will typically need to point at a script wrapping the
actual signing tool, since there are lots of fiddly details
(timestamping countersignature, certificate, private key, etc) not
given on the command lines in this build script, on the basis that
they're local configuration questions for whoever is _running_ this
build script.

(cherry picked from commit d0e9630e1c2f880bb7cb7ae107685bd1a6d189c4)

8 years agoFix a mistaken use of a format string in logevent().
Simon Tatham [Fri, 27 Nov 2015 23:55:16 +0000 (23:55 +0000)]
Fix a mistaken use of a format string in logevent().

logevent() doesn't do printf-style formatting (though the logeventf
wrapper in ssh.c does), so if you need to format a message, it has to
be done separately with dupprintf.

(cherry picked from commit 1659cf3f1455f7e3d9c97a66f90a0cfa914d1ce3)

8 years agoMove sfree inside if.
Owen Dunn [Fri, 27 Nov 2015 19:52:46 +0000 (19:52 +0000)]
Move sfree inside if.

(cherry picked from commit 0f5299e5a86e87068277b19c008ff5eb0f78d022)

8 years agoDocument UNPROTECT define that disables tightened ACL.
Owen Dunn [Tue, 24 Nov 2015 23:13:03 +0000 (23:13 +0000)]
Document UNPROTECT define that disables tightened ACL.

(cherry picked from commit 21a37d287cced473c12d23581fc1a200552ad1e0)

8 years agoSurround process protection with an #ifndef UNPROTECT
Owen Dunn [Tue, 24 Nov 2015 23:12:33 +0000 (23:12 +0000)]
Surround process protection with an #ifndef UNPROTECT

(cherry picked from commit 8b65fef55c688d8a52bd56f426e345671fab0303)

8 years agoMake our process's ACL more restrictive.
Simon Tatham [Thu, 25 Feb 2016 20:30:58 +0000 (20:30 +0000)]
Make our process's ACL more restrictive.

By default Windows processes have wide open ACLs which allow interference
by other processes running as the same user.  Adjust our ACL to make this
a bit harder.

Because it's useful to protect PuTTYtel as well, carve winsecur.c into
advapi functions and wincapi.c for crypt32 functions.

(cherry picked from commit 48db456801cf90369330248075b7e480252696ff)

Conflicts:
Recipe

(cherry-picker's note: the conflict was just some context not looking
quite the same)

8 years agoFix a memory leak in uxproxy.c.
Simon Tatham [Sun, 22 Nov 2015 15:02:14 +0000 (15:02 +0000)]
Fix a memory leak in uxproxy.c.

We set up a pair of bufchains for the standard input and output
exchanged with the proxy process, but forgot to clear them when the
Local_Proxy_Socket is cleaned up.

(cherry picked from commit bb66e9870e1d297de502767031563b8f2334cb1c)

8 years agoMove SID-getting code into a separate function so it can be shared by
Owen Dunn [Sun, 22 Nov 2015 12:04:04 +0000 (12:04 +0000)]
Move SID-getting code into a separate function so it can be shared by
make_private_security_descriptor and a new function protectprocess().

protectprocess() opens the running PuTTY process and adjusts the
Everyone and user access control entries in its ACL to deny a
selection of permissions which malicious processes running as the same
user could use to hijack PuTTY.

(cherry picked from commit aba7234bc167c8c056a9ea4f939a6dcda10e84f3)

8 years agoDocument 'Cannot assign requested address' error.
Jacob Nevins [Sat, 21 Nov 2015 12:21:31 +0000 (12:21 +0000)]
Document 'Cannot assign requested address' error.

Often it means you tried to connect to port 0.

(cherry picked from commit c4f963ebd71dd07b3c6dcade9a2a9a86a7322519)

8 years agoConvert Buildscr to use the new "do/win" mechanism.
Simon Tatham [Tue, 17 Nov 2015 18:41:52 +0000 (18:41 +0000)]
Convert Buildscr to use the new "do/win" mechanism.

(cherry picked from commit 470337d0f2591534221390f50a69f8c9f6fe0558)

8 years agoBig revision to CHECKLST.txt for release.pl and Mason.
Simon Tatham [Thu, 12 Nov 2015 19:11:07 +0000 (19:11 +0000)]
Big revision to CHECKLST.txt for release.pl and Mason.

Half the release checklist has changed recently, what with me
completely reworking the website and also writing all this release
automation. I think these are all the checklist changes needed now the
dust has settled, though of course when I do the next actual release I
expect there'll turn out to be something I missed...

(cherry picked from commit 3e811b3dff506cef03426469fc676a519d531781)

8 years agoFurther release automation.
Simon Tatham [Thu, 12 Nov 2015 19:09:36 +0000 (19:09 +0000)]
Further release automation.

I've added extra modes to release.pl which should automate the more
tedious parts of the deployment phase: uploading the release build to
all the places it needs to go, checking its integrity once it gets
there, verifying that everything can be downloaded again usefully,
checking content-types etc.

The new version should check more thoroughly (it checks the whole FTP
and HTTP download directories, so it will spot errors like failing to
update the FTP 'latest' symlink), and take fewer commands to run.

(cherry picked from commit f08e2de078b9122d4732a94cbbd81ca66cb87eed)

8 years agoFix potential segfaults in reading OpenSSH's ASN.1 key format.
Simon Tatham [Thu, 25 Feb 2016 20:26:33 +0000 (20:26 +0000)]
Fix potential segfaults in reading OpenSSH's ASN.1 key format.

The length coming back from ber_read_id_len might have overflowed, so
treat it as potentially negative. Also, while I'm here, accumulate it
inside ber_read_id_len as an unsigned, so as to avoid undefined
behaviour on integer overflow, and toint() it before return.

Thanks to Hanno Böck for spotting this, with the aid of AFL.

(cherry picked from commit 5b7833cd474a24ec098654dcba8cb9509f3bf2c1)

Conflicts:
import.c

(cherry-picker's note: resolving the conflict involved removing an
entire section of the original commit which fixed ECDSA code not
present on this branch)

8 years agoFix an out-of-bounds read in fgetline().
Simon Tatham [Tue, 10 Nov 2015 18:49:09 +0000 (18:49 +0000)]
Fix an out-of-bounds read in fgetline().

Forgot that a zero-length string might have come back from fgets.

Thanks to Hanno Böck for spotting this, with the aid of AFL.

(cherry picked from commit 5815d6a65af992881f5462097c9320f3a4716e0c)

8 years agoFix a segfault in parsing OpenSSH private key files.
Simon Tatham [Thu, 25 Feb 2016 20:22:23 +0000 (20:22 +0000)]
Fix a segfault in parsing OpenSSH private key files.

The initial test for a line ending with "PRIVATE KEY-----" failed to
take into account the possibility that the line might be shorter than
that. Fixed by introducing a new library function strendswith(), and
strstartswith() for good measure, and using that.

Thanks to Hanno Böck for spotting this, with the aid of AFL.

(cherry picked from commit fa7b23ce9025daba08e86bb934fc430099792b9a)

Conflicts:
misc.c
misc.h

(cherry-picker's note: the conflicts were only due to other functions
introduced on trunk just next to the ones introduced by this commit)

8 years agoRationalise and document log options somewhat.
Jacob Nevins [Sun, 8 Nov 2015 11:57:39 +0000 (11:57 +0000)]
Rationalise and document log options somewhat.

TOOLTYPE_NONNETWORK (i.e. pterm) already has "-log" (as does Unix
PuTTY), so there's no sense suppressing the synonym "-sessionlog".

Undocumented lacunae that remain:

plink accepts -sessionlog, but does nothing with it. Arguably it should.

puttytel accepts -sshlog/-sshrawlog (and happily logs e.g. Telnet
negotiation, as does PuTTY proper).

(cherry picked from commit a454399ec8d841e627d9d5e05ac977536e776754)

Conflicts:
unix/uxplink.c
windows/winplink.c

(cherry-picker's notes: the conflict was only contextual, in the Plink
help output)

8 years agoMore post-release checklist updates, and a new script.
Simon Tatham [Sat, 7 Nov 2015 15:59:00 +0000 (15:59 +0000)]
More post-release checklist updates, and a new script.

I've added a few sample shell commands in the upload procedure (mostly
so that I don't have to faff about remembering how rsync trailing
slashes work every time), and also written a script called
'release.pl', which automates the updating of the version number in
all the various places it needs to be done and also ensures the PSCP
and Plink transcripts in the docs will match the release itself.

(cherry picked from commit f3230c85457cc3d13c46e8ea91c9748dcd0054af)

8 years agoOne small post-release checklist tweak.
Simon Tatham [Sat, 7 Nov 2015 15:15:07 +0000 (15:15 +0000)]
One small post-release checklist tweak.

I spotted that I've been checking that old-style Windows Help files
were delivered with content-type "application/octet-stream", but not
also checking the same thing about the marginally newer .CHM ones. (Or
at least not writing it down in the wishlist; I think I did actually
check on at least one occasion.)

(cherry picked from commit 3552f37ba5eab32247e44af96fa7a41994268159)

8 years agoPost-0.66 release checklist updates.
Simon Tatham [Sat, 7 Nov 2015 10:12:00 +0000 (10:12 +0000)]
Post-0.66 release checklist updates.

The one-off reminder to finish the key rollover is now done, so I can
remove it.

(cherry picked from commit 503061e569af091b9c31f75e5e17c6f39a70f72f)

8 years agobignum_set_bit: Don't abort if asked to clear an inaccessible bit
Ben Harris [Sun, 11 Oct 2015 08:27:55 +0000 (09:27 +0100)]
bignum_set_bit: Don't abort if asked to clear an inaccessible bit

All those bits are clear anyway.

Bug found with the help of afl-fuzz.

(cherry picked from commit 4f340599029715d863b84bdfc0407f582114a23c)

8 years agoIt's a new year.
Jacob Nevins [Sat, 27 Feb 2016 10:38:48 +0000 (10:38 +0000)]
It's a new year.

8 years agoFix strict-aliasing warnings in sk_tcp_peer_info.
Colin Watson [Thu, 28 Jan 2016 21:22:07 +0000 (21:22 +0000)]
Fix strict-aliasing warnings in sk_tcp_peer_info.

GCC 6 emits strict-aliasing warnings here, so use the existing
sockaddr_union arrangements to avoid those.  As a prerequisite for being
able to express sk_tcp_peer_info in terms of sockaddr_union, I fixed up
the union elements to be a bit less odd in the NO_IPV6 case.

8 years agoAvoid -Wmisleading-indentation warnings with GCC 6.
Colin Watson [Thu, 28 Jan 2016 21:19:41 +0000 (21:19 +0000)]
Avoid -Wmisleading-indentation warnings with GCC 6.

GCC 6 warns about potentially misleading indentation, such as:

    if (condition) stmt1; stmt2;

Chaining multiple ifs on a single line runs into this warning, even if
it's probably not actually misleading to a human eye, so just add a
couple of newlines to pacify the compiler.

8 years agoFix a 64-bit-cleanness error in sshcrc's generator.
Simon Tatham [Tue, 26 Jan 2016 22:09:01 +0000 (22:09 +0000)]
Fix a 64-bit-cleanness error in sshcrc's generator.

Not that anyone actually needs to use that conditioned-out main(),
since it only generates the table already present in the same source
file, but since @ch3root's unused-variable patch touched it I tried
compiling it and noticed in passing that I'd also got the wrong printf
format directive for an unsigned long.

8 years agoRemove some unused variables.
Simon Tatham [Tue, 26 Jan 2016 18:36:26 +0000 (18:36 +0000)]
Remove some unused variables.

Thanks to @ch3root again for this patch.

8 years agoReplace an ad-hoc buffer-clearing loop with smemclr.
Simon Tatham [Mon, 25 Jan 2016 19:24:41 +0000 (19:24 +0000)]
Replace an ad-hoc buffer-clearing loop with smemclr.

Thanks to @ch3root on Twitter for spotting it, and thanks to Chris
Emerson for bothering to let me know. I must have missed this when I
code-reviewed the ECC contribution.

8 years agoAdd the new copy.but to .gitignore.
Simon Tatham [Tue, 22 Dec 2015 13:56:07 +0000 (13:56 +0000)]
Add the new copy.but to .gitignore.

Arrgh, _another_ one I only remember seconds too late!

8 years agoAutogenerate licence text in doc subdir from LICENCE.
Simon Tatham [Tue, 22 Dec 2015 11:18:48 +0000 (11:18 +0000)]
Autogenerate licence text in doc subdir from LICENCE.

Now we have licence.pl, it seems to me to make very good sense to have
it generate the Halibut form(s) of the licence and copyright year as
well as the source-code forms.

As a result, I believe _no_ copies of the licence text or copyright
date exist any more except for the master one in LICENCE - so I can
completely remove the checklist section about all the places to update
it, because there's only one. Hooray!

8 years agoStop copying the licence text into C source code.
Simon Tatham [Tue, 22 Dec 2015 12:43:31 +0000 (12:43 +0000)]
Stop copying the licence text into C source code.

Now all the uses of the licence text or the short copyright notice get
it from a new header "licence.h", which in turn is built by a Perl
script licence.pl invoked by mkfiles.pl, using LICENCE itself as the
source.

Hence, I can completely remove a whole section from the list of
licence locations in CHECKLST.txt :-)

8 years agoUse readonly edit controls in some Windows dialogs.
Simon Tatham [Tue, 22 Dec 2015 10:18:48 +0000 (10:18 +0000)]
Use readonly edit controls in some Windows dialogs.

This makes the About and Licence boxes copy-and-pasteable, similarly
to what I've just done on Unix.

(But unlike on the Unix side, here I haven't touched the host key
prompt dialog, because that's a standard Windows MessageBox and not
easy to mess around with. Plus, in any case, you can already hit ^C to
copy the whole text out of a MessageBox. Same goes for the PGP
fingerprints dialog.)

As a side effect, several copies of the copyright notice and licence
text have moved from .rc files into C source. I've updated
CHECKLST.txt, but they won't stay there for long.

8 years agoMake some static text in GTK dialogs selectable.
Simon Tatham [Tue, 22 Dec 2015 12:32:48 +0000 (12:32 +0000)]
Make some static text in GTK dialogs selectable.

I've made the licence text, the About box, and the host key dialog
into GTK selectable edit controls. (The former because it contains a
lot of text; the About box because pasting version numbers into bug
reports is obviously useful; the host key because of the fingerprint.)

8 years agoUse the proper snprintf function if compiling with VS2015.
Simon Tatham [Sat, 19 Dec 2015 10:07:11 +0000 (10:07 +0000)]
Use the proper snprintf function if compiling with VS2015.

Proper snprintf is finally supported as of the latest Visual Studio,
and has better semantics for my purposes than the old MS-specific
_snprintf. (Specifically, if its output doesn't fit the buffer, it
returns the full size it _would_ have wanted, so that you can then
immediately allocate that much space, and don't have to keep going
round a loop increasing the buffer size until you find the answer.)

8 years agoAdd the new testbn binary to .gitignore.
Simon Tatham [Tue, 22 Dec 2015 11:20:09 +0000 (11:20 +0000)]
Add the new testbn binary to .gitignore.

One of these days I'll think of a way of not forgetting this every
time...

8 years agoFix build breakage on Unix.
Simon Tatham [Thu, 17 Dec 2015 09:06:53 +0000 (09:06 +0000)]
Fix build breakage on Unix.

Occurred as a side effect of commit 198bca233, in which I wrote a Perl
loop of the form 'foreach $srcdir (@srcdirs)' inside which I modified
$srcdir - forgetting the Perl gotcha that if you do that, $srcdir
temporarily aliases the actual array element, so you end up modifying
the array you iterated over. Hence, a set of transformations intended
to convert the source directory list into a special form for the nmake
batch-mode inference rule syntax in particular ended up back in
@srcdirs to be reflected in unrelated makefiles output later in the
run.

8 years agoIntroduce a BUILDDIR parameter in Makefile.vc.
Simon Tatham [Wed, 16 Dec 2015 18:20:30 +0000 (18:20 +0000)]
Introduce a BUILDDIR parameter in Makefile.vc.

Now you can run a command like "nmake /f Makefile.vc BUILDDIR=foo\",
which will cause all the generated files to appear in a subdirectory
of putty\windows. This is immediately useful for testing multiple
build configurations against each other by hand; later on I hope it
will also be a convenient way to run multiple build configurations in
the proper bob build.

8 years agoPut back in a missing dynamic-load wrapper on SetSecurityInfo.
Simon Tatham [Sat, 28 Nov 2015 18:31:10 +0000 (18:31 +0000)]
Put back in a missing dynamic-load wrapper on SetSecurityInfo.

We had inadvertently raised the minimum supported Windows version in
the course of restricting PuTTY's ACL.

8 years agoSwitch Makefile.vc to using batch-mode inference rules.
Simon Tatham [Wed, 16 Dec 2015 18:27:32 +0000 (18:27 +0000)]
Switch Makefile.vc to using batch-mode inference rules.

This enables it to combine the compilation of multiple source files
into a single 'cl' command with multiple input file arguments, which
speeds up the build noticeably.

(I think nmake could be doing a lot more to improve this - for a
start, I haven't found any way to let it aggregate compilations of
source files in more than one directory, and also, it seems to me that
it really ought to be able to reduce down to just _one_ invocation of
cl by choosing the best topological sort of its build operations,
whereas in fact it looks as if it's sorting the operations _before_
doing the aggregation. But even so, it's a big improvement on the
previous build time.)

8 years agoUse nmake's inline file creation to automate .rsp files.
Simon Tatham [Sun, 29 Nov 2015 08:39:50 +0000 (08:39 +0000)]
Use nmake's inline file creation to automate .rsp files.

This is noticeably faster than a sequence of 'echo' commands, because
the file gets created all in one go. The most natural approach to this
job would also hide the file's contents, but doing it this way with a
'type' command lets me see the file on nmake's standard output, so
that the build log should still contain everything useful for
debugging build problems.

8 years agoReport the bignum word size in testbn.
Simon Tatham [Sun, 29 Nov 2015 12:04:10 +0000 (12:04 +0000)]
Report the bignum word size in testbn.

I've found in the last day or two that the first thing I want to do
after any successful run of testbn is to check whether I was running
it with the right compile settings - so I should have made it easier
to find that out to begin with! Better late than never.

8 years agoPromote 'testbn' to a binary built by the makefiles.
Simon Tatham [Wed, 16 Dec 2015 14:40:00 +0000 (14:40 +0000)]
Promote 'testbn' to a binary built by the makefiles.

This makes it easier to compile in multiple debugging modes, or on
Windows, without having to constantly paste annoying test-compile
commands out of comments in sshbn.c.

The new binary is compiled into the build directory, but not shipped
by 'make install', just like fuzzterm. Unlike fuzzterm, though, testbn
is also compiled on Windows, for which we didn't already have a
mechanism for building unshipped binaries; I've done the very simplest
thing for the moment, of providing a target in Makefile.vc to delete
them.

In order to comply with the PuTTY makefile system's constraint of
never compiling the same object multiple times with different ifdefs,
I've also moved testbn's main() out into its own source file.

8 years agoAdd a case to sshbn.h for 64-bit Visual Studio.
Simon Tatham [Wed, 16 Dec 2015 14:12:36 +0000 (14:12 +0000)]
Add a case to sshbn.h for 64-bit Visual Studio.

This commit fulfills the promise of the previous one: now one of the
branches of sshbn.h's big ifdef _doesn't_ define a BignumDblInt, and
instead provides implementations of the primitive arithmetic macros in
terms of Visual Studio's x86-64 compiler intrinsics. So now, when this
codebase is compiled with 64-bit VS, it can use a 64-bit BignumInt and
everything still seems to work.

8 years agoRelegate BignumDblInt to an implementation detail of sshbn.h.
Simon Tatham [Wed, 16 Dec 2015 14:12:26 +0000 (14:12 +0000)]
Relegate BignumDblInt to an implementation detail of sshbn.h.

As I mentioned in the previous commit, I'm going to want PuTTY to be
able to run sensibly when compiled with 64-bit Visual Studio,
including handling bignums in 64-bit chunks for speed. Unfortunately,
64-bit VS does not provide any type we can use as BignumDblInt in that
situation (unlike 64-bit gcc and clang, which give us __uint128_t).
The only facilities it provides are compiler intrinsics to access an
add-with-carry operation and a 64x64->128 multiplication (the latter
delivering its product in two separate 64-bit output chunks).

Hence, here's a substantial rework of the bignum code to make it
implement everything in terms of _those_ primitives, rather than
depending throughout on having BignumDblInt available to use ad-hoc.
BignumDblInt does still exist, for the moment, but now it's an
internal implementation detail of sshbn.h, only declared inside a new
set of macros implementing arithmetic primitives, and not accessible
to any code outside sshbn.h (which confirms that I really did catch
all uses of it and remove them).

The resulting code is surprisingly nice-looking, actually. You'd
expect more hassle and roundabout circumlocutions when you drop down
to using a more basic set of primitive operations, but actually, in
many cases it's turned out shorter to write things in terms of the new
BignumADC and BignumMUL macros - because almost all my uses of
BignumDblInt were implementing those operations anyway, taking several
lines at a time, and now they can do each thing in just one line.

The biggest headache was Poly1305: I wasn't able to find any sensible
way to adapt the existing Python script that generates the various
per-int-size implementations of arithmetic mod 2^130-5, and so I had
to rewrite it from scratch instead, with nothing in common with the
old version beyond a handful of comments. But even that seems to have
worked out nicely: the new version has much more legible descriptions
of the high-level algorithms, by virtue of having a 'Multiprecision'
type which wraps up the division into words, and yet Multiprecision's
range analysis allows it to automatically drop out special cases such
as multiplication by 5 being much easier than multiplication by
another multi-word integer.

8 years agoRewrite the core divide function to not use DIVMOD_WORD.
Simon Tatham [Sun, 13 Dec 2015 14:46:43 +0000 (14:46 +0000)]
Rewrite the core divide function to not use DIVMOD_WORD.

DIVMOD_WORD is a portability hazard, because implementing it requires
either a way to get direct access to the x86 DIV instruction or
equivalent (be it inline assembler or a compiler intrinsic), or else
an integer type we can use as BignumDblInt. But I'm starting to think
about porting to 64-bit Visual Studio with a 64-bit BignumInt, and in
that situation neither of those options will be available.

I could write a piece of _out_-of-line x86-64 assembler in a separate
source file and put a function call in DIVMOD_WORD, but instead I've
decided to solve the problem in a more futureproof way: remove
DIVMOD_WORD totally and write a division function that doesn't need it
at all, solving not only today's porting headache but all future ones
in this area.

The new implementation works by precomputing (a good enough
approximation to) the leading word of the reciprocal of the modulus,
and then getting each word of quotient by multiplying by that
reciprocal, where we previously used DIVMOD_WORD to divide by the
leading word of the actual modulus. The reciprocal itself is computed
outside internal_mod() and passed in as a parameter, allowing me to
save time by only computing it once when I'm about to do a modpow.

To some extent this complicates the implementation: the advantage of
DIVMOD_WORD was that it yielded a full word q of quotient every time
it was used, so the subtraction of q*m from the input could be done in
a nicely word-aligned way. But the reciprocal multiply approach yields
_almost_ a full word of quotient, because you have to make the
reciprocal a bit short to avoid overflow at multiplication time. For a
start, this means we have to do fractionally more iterations of the
main loop; but more painfully, we can no longer depend on the
subtraction of q*m at every step being word-aligned, and instead we
have to be prepared to do it at any bit shift.

But the flip side is that once we've implemented that, the rest of the
algorithm becomes a lot less full of horrible special cases: in
particular, we can now completely throw away the horribleness at all
the call sites where we shift the modulus up by a fractional word to
set its top bit, and then have to do a little dance to get the last
few bits of quotient involving a second call to internal_mod.

So there are points both for and against the new implementation in
simplicity terms; but I think on balance it's more comprehensible than
the old one, and a quick timing test suggests it also ends up a touch
faster overall - the new testbn gets through the output of
testdata/bignum.py in 4.034s where the old one took 4.392s.

8 years agoAdd direct tests of division/modulus to testbn.
Simon Tatham [Sun, 13 Dec 2015 14:46:43 +0000 (14:46 +0000)]
Add direct tests of division/modulus to testbn.

I'm about to rewrite the division code, so it'll be useful to have a
way to test it directly, particularly one which exercises difficult
cases such as extreme values of the leading word and remainders just
above and below zero.

8 years agoFix copy-and-paste error in testbn main program.
Simon Tatham [Sun, 13 Dec 2015 14:46:42 +0000 (14:46 +0000)]
Fix copy-and-paste error in testbn main program.

I called a 'pow' test line 'mul' in an error message.

8 years agoCode-sign the Windows PuTTY binaries and installer.
Simon Tatham [Fri, 11 Dec 2015 06:47:20 +0000 (06:47 +0000)]
Code-sign the Windows PuTTY binaries and installer.

Or, at least, potentially do so. The build script now has a slot into
which code-signing can be dropped by setting a variable in the bob
configuration to specify an appropriate command line.

The variable will typically need to point at a script wrapping the
actual signing tool, since there are lots of fiddly details
(timestamping countersignature, certificate, private key, etc) not
given on the command lines in this build script, on the basis that
they're local configuration questions for whoever is _running_ this
build script.

8 years agoSet "entry-text-column" on our combo boxes.
Simon Tatham [Sun, 6 Dec 2015 07:23:59 +0000 (07:23 +0000)]
Set "entry-text-column" on our combo boxes.

When we provide an editable text box with a drop-down list of useful
preset values, such as the one full of character sets in the
Translation panel, we implement it on GTK 2.4+ as a GtkComboBox
pointing at a two-column GtkListStore, in which the second column is
the actual text (the first being a numeric id). Therefore, we need to
set the "entry-text-column" property to tell GtkComboBox which of
those columns to look in for the value corresponding to the edit-box
text.

Thanks to Robert de Bath for spotting the problem and tracing it as
far as commit 5fa22495c. That commit replaced a widget construction
call via gtk_combo_box_entry_new_with_model() with one using the newer
gtk_combo_box_new_with_model_and_entry(), overlooking the fact that
the former provided the text column number as a parameter, and the
latter didn't.

8 years agoFix a mistaken use of a format string in logevent().
Simon Tatham [Fri, 27 Nov 2015 23:55:16 +0000 (23:55 +0000)]
Fix a mistaken use of a format string in logevent().

logevent() doesn't do printf-style formatting (though the logeventf
wrapper in ssh.c does), so if you need to format a message, it has to
be done separately with dupprintf.

8 years agoPut ASLR and DEP flags back until the nightly build linker is new enough!
Owen Dunn [Fri, 27 Nov 2015 19:55:52 +0000 (19:55 +0000)]
Put ASLR and DEP flags back until the nightly build linker is new enough!

8 years agoMove sfree inside if.
Owen Dunn [Fri, 27 Nov 2015 19:52:46 +0000 (19:52 +0000)]
Move sfree inside if.

8 years agoMerge branch 'master' of ssh://tartarus.org/putty
Owen Dunn [Fri, 27 Nov 2015 19:44:25 +0000 (19:44 +0000)]
Merge branch 'master' of ssh://tartarus.org/putty

8 years agoAvoid passing -1 as an fd to uxsel_set().
Simon Tatham [Wed, 25 Nov 2015 18:18:45 +0000 (18:18 +0000)]
Avoid passing -1 as an fd to uxsel_set().

I'd missed out an if statement in the Unix proxy stderr code
introduced by commit 297efff30, causing ret->cmd_err to be passed to
uxsel_set even when it was -1 (which happened in the non-GUI tools).
Unfortunately, putting a negative fd into the uxsel tree has really
bad effects, because the first_fd / next_fd interface returns a
negative number to signal end-of-list - and since the uxsel tree is
sorted by fd, that happens _immediately_.

Added the missing if statement, and also an assertion to make sure we
never pass -1 to uxsel_set by mistake again!

8 years agoDocument UNPROTECT define that disables tightened ACL.
Owen Dunn [Tue, 24 Nov 2015 23:13:03 +0000 (23:13 +0000)]
Document UNPROTECT define that disables tightened ACL.

8 years agoSurround process protection with an #ifndef UNPROTECT
Owen Dunn [Tue, 24 Nov 2015 23:12:33 +0000 (23:12 +0000)]
Surround process protection with an #ifndef UNPROTECT

8 years agoEnable DEP and ASLR flags on VC++ linker command line
Owen Dunn [Tue, 24 Nov 2015 22:57:46 +0000 (22:57 +0000)]
Enable DEP and ASLR flags on VC++ linker command line

/dynamicbase and /nxcompat on the VC linker command line should
enable DEP and ASLR according to this MSDN article.
https://msdn.microsoft.com/en-us/library/bb430720.aspx

8 years agoMake our process's ACL more restrictive.
Owen Dunn [Tue, 24 Nov 2015 22:02:24 +0000 (22:02 +0000)]
Make our process's ACL more restrictive.

By default Windows processes have wide open ACLs which allow interference
by other processes running as the same user.  Adjust our ACL to make this
a bit harder.

Because it's useful to protect PuTTYtel as well, carve winsecur.c into
advapi functions and wincapi.c for crypt32 functions.

8 years agoImplement align_label_left for GTK 3.[14,16).
Simon Tatham [Sun, 22 Nov 2015 21:47:21 +0000 (21:47 +0000)]
Implement align_label_left for GTK 3.[14,16).

gtk_misc_set_alignment was deprecated in GTK 3.14. But my replacement
code using gtk_label_set_xalign doesn't work there, because that
function wasn't introduced until GTK 3.16, so there are two minor
versions in the middle where a third strategy is needed.

8 years agoFix a paste error in new make_handle_socket prototype.
Simon Tatham [Sun, 22 Nov 2015 22:50:30 +0000 (22:50 +0000)]
Fix a paste error in new make_handle_socket prototype.

Thanks to Colin Harrison for spotting it very quickly. No thanks to
Visual Studio for only giving me a _warning_ when I prototyped a
function with four parameters and called it with five!

8 years agoOption to log proxy setup diagnostics to the terminal.
Simon Tatham [Sun, 22 Nov 2015 14:33:28 +0000 (14:33 +0000)]
Option to log proxy setup diagnostics to the terminal.

It has three settings: on, off, and 'only until session starts'. The
idea of the last one is that if you use something like 'ssh -v' as
your proxy command, you probably wanted to see the initial SSH
connection-setup messages while you were waiting to see if the
connection would be set up successfully at all, but probably _didn't_
want a slew of diagnostics from rekeys disrupting your terminal in
mid-emacs once the session had got properly under way.

Default is off, to avoid startling people used to the old behaviour. I
wonder if I should have set it more aggressively, though.

8 years agoIn GUI PuTTY, log standard error from local proxy commands.
Simon Tatham [Sun, 22 Nov 2015 11:50:37 +0000 (11:50 +0000)]
In GUI PuTTY, log standard error from local proxy commands.

On both Unix and Windows, we now redirect the local proxy command's
standard error into a third pipe; data received from that pipe is
broken up at newlines and logged in the Event Log. So if the proxy
command emits any error messages in the course of failing to connect
to something, you now have a fighting chance of finding out what went
wrong.

This feature is disabled in command-line tools like PSFTP and Plink,
on the basis that in that situation it seems more likely that the user
would expect standard-error output to go to the ordinary standard
error in the ordinary way. Only GUI PuTTY catches it and logs it like
this, because it either doesn't have a standard error at all (on
Windows) or is likely to be pointing it at some completely unhelpful
session log file (under X).

8 years agoLog the setup of proxied network connections.
Simon Tatham [Sun, 22 Nov 2015 12:15:52 +0000 (12:15 +0000)]
Log the setup of proxied network connections.

I've defined a new value for the 'int type' parameter passed to
plug_log(), which proxy sockets will use to pass their backend
information on how the setup of their proxied connections are going.
I've implemented support for the new type code in all _nontrivial_
plug log functions (which, conveniently, are precisely the ones I just
refactored into backend_socket_log); the ones which just throw all
their log data away anyway will do that to the new code as well.

We use the new type code to log the DNS lookup and connection setup
for connecting to a networked proxy, and also to log the exact command
string sent down Telnet proxy connections (so the user can easily
debug mistakes in the configured format string) and the exact command
executed when spawning a local proxy process. (The latter was already
supported on Windows by a bodgy logging call taking advantage of
Windows in particular having no front end pointer; I've converted that
into a sensible use of the new plug_log facility, and done the same
thing on Unix.)

8 years agoFactor out the back ends' plug log functions.
Simon Tatham [Sun, 22 Nov 2015 11:49:14 +0000 (11:49 +0000)]
Factor out the back ends' plug log functions.

I'm about to want to make a change to all those functions at once, and
since they're almost identical, it seemed easiest to pull them out
into a common helper. The new source file be_misc.c is intended to
contain helper code common to all network back ends (crypto and
non-crypto, in particular), and initially it contains a
backend_socket_log() function which is the common part of ssh_log(),
telnet_log(), rlogin_log() etc.

8 years agoFix a memory leak in uxproxy.c.
Simon Tatham [Sun, 22 Nov 2015 15:02:14 +0000 (15:02 +0000)]
Fix a memory leak in uxproxy.c.

We set up a pair of bufchains for the standard input and output
exchanged with the proxy process, but forgot to clear them when the
Local_Proxy_Socket is cleaned up.

8 years agoTell the truth about DNS lookups in the Event Log.
Simon Tatham [Sun, 22 Nov 2015 09:58:14 +0000 (09:58 +0000)]
Tell the truth about DNS lookups in the Event Log.

We've always had the back-end code unconditionally print 'Looking up
host' before calling name_lookup. But name_lookup doesn't always do an
actual lookup - in cases where the connection will be proxied and
we're configured to let the proxy do the DNS for us, it just calls
sk_nonamelookup to return a dummy SockAddr with the unresolved name
still in it. It's better to print a message that varies depending on
whether we're _really_ doing DNS or not, e.g. so that people can tell
the difference between DNS failure and proxy misconfiguration.

Hence, those log messages are now generated inside name_lookup(),
which takes a couple of extra parameters for the purpose - a frontend
pointer to pass to logevent(), and a reason string so that it can say
what the hostname it's (optionally) looking up is going to be used
for. (The latter is intended for possible use in logging subsidiary
lookups for port forwarding, though  the moment I haven't changed
the current setup where those connection setups aren't logged in
detail - we just pass NULL in that situation.)

8 years agoRemove unused SSL declarations from network.h.
Simon Tatham [Sun, 22 Nov 2015 12:06:54 +0000 (12:06 +0000)]
Remove unused SSL declarations from network.h.

There was a very old plan to flesh this out into an implementation of
SSLified Telnet, back when it looked as if that might be the winning
option for encrypted remote login. But SSH won, so that random junk in
network.h has been sitting around for decades doing nothing useful.

8 years agoMove SID-getting code into a separate function so it can be shared by
Owen Dunn [Sun, 22 Nov 2015 12:04:04 +0000 (12:04 +0000)]
Move SID-getting code into a separate function so it can be shared by
make_private_security_descriptor and a new function protectprocess().

protectprocess() opens the running PuTTY process and adjusts the
Everyone and user access control entries in its ACL to deny a
selection of permissions which malicious processes running as the same
user could use to hijack PuTTY.

8 years agoDocument 'Cannot assign requested address' error.
Jacob Nevins [Sat, 21 Nov 2015 12:21:31 +0000 (12:21 +0000)]
Document 'Cannot assign requested address' error.

Often it means you tried to connect to port 0.

8 years agoConvert Buildscr to use the new "do/win" mechanism.
Simon Tatham [Tue, 17 Nov 2015 18:41:52 +0000 (18:41 +0000)]
Convert Buildscr to use the new "do/win" mechanism.

8 years agoBig revision to CHECKLST.txt for release.pl and Mason.
Simon Tatham [Thu, 12 Nov 2015 19:11:07 +0000 (19:11 +0000)]
Big revision to CHECKLST.txt for release.pl and Mason.

Half the release checklist has changed recently, what with me
completely reworking the website and also writing all this release
automation. I think these are all the checklist changes needed now the
dust has settled, though of course when I do the next actual release I
expect there'll turn out to be something I missed...

8 years agoFurther release automation.
Simon Tatham [Thu, 12 Nov 2015 19:09:36 +0000 (19:09 +0000)]
Further release automation.

I've added extra modes to release.pl which should automate the more
tedious parts of the deployment phase: uploading the release build to
all the places it needs to go, checking its integrity once it gets
there, verifying that everything can be downloaded again usefully,
checking content-types etc.

The new version should check more thoroughly (it checks the whole FTP
and HTTP download directories, so it will spot errors like failing to
update the FTP 'latest' symlink), and take fewer commands to run.

8 years agoFix potential segfaults in reading OpenSSH's ASN.1 key format.
Simon Tatham [Tue, 10 Nov 2015 18:49:51 +0000 (18:49 +0000)]
Fix potential segfaults in reading OpenSSH's ASN.1 key format.

The length coming back from ber_read_id_len might have overflowed, so
treat it as potentially negative. Also, while I'm here, accumulate it
inside ber_read_id_len as an unsigned, so as to avoid undefined
behaviour on integer overflow, and toint() it before return.

Thanks to Hanno Böck for spotting this, with the aid of AFL.

8 years agoFix an out-of-bounds read in fgetline().
Simon Tatham [Tue, 10 Nov 2015 18:49:09 +0000 (18:49 +0000)]
Fix an out-of-bounds read in fgetline().

Forgot that a zero-length string might have come back from fgets.

Thanks to Hanno Böck for spotting this, with the aid of AFL.

8 years agoFix a segfault in parsing OpenSSH private key files.
Simon Tatham [Tue, 10 Nov 2015 18:47:55 +0000 (18:47 +0000)]
Fix a segfault in parsing OpenSSH private key files.

The initial test for a line ending with "PRIVATE KEY-----" failed to
take into account the possibility that the line might be shorter than
that. Fixed by introducing a new library function strendswith(), and
strstartswith() for good measure, and using that.

Thanks to Hanno Böck for spotting this, with the aid of AFL.

8 years agoRationalise and document log options somewhat.
Jacob Nevins [Sun, 8 Nov 2015 11:57:39 +0000 (11:57 +0000)]
Rationalise and document log options somewhat.

TOOLTYPE_NONNETWORK (i.e. pterm) already has "-log" (as does Unix
PuTTY), so there's no sense suppressing the synonym "-sessionlog".

Undocumented lacunae that remain:

plink accepts -sessionlog, but does nothing with it. Arguably it should.

puttytel accepts -sshlog/-sshrawlog (and happily logs e.g. Telnet
negotiation, as does PuTTY proper).

8 years agoAdd fuzzterm to .gitignore.
Jacob Nevins [Sun, 8 Nov 2015 11:58:27 +0000 (11:58 +0000)]
Add fuzzterm to .gitignore.

8 years agoFix an SSH-breaking bug from the fuzzing merge.
Simon Tatham [Sat, 7 Nov 2015 20:15:24 +0000 (20:15 +0000)]
Fix an SSH-breaking bug from the fuzzing merge.

When we set ssh->sc{cipher,mac} to s->sc{cipher,mac}_tobe
conditionally, we should be conditionalising on the values we're
_reading_, not the ones we're about to overwrite.

Thanks to Colin Harrison for this patch.

8 years agoMore post-release checklist updates, and a new script.
Simon Tatham [Sat, 7 Nov 2015 15:59:00 +0000 (15:59 +0000)]
More post-release checklist updates, and a new script.

I've added a few sample shell commands in the upload procedure (mostly
so that I don't have to faff about remembering how rsync trailing
slashes work every time), and also written a script called
'release.pl', which automates the updating of the version number in
all the various places it needs to be done and also ensures the PSCP
and Plink transcripts in the docs will match the release itself.

8 years agoOne small post-release checklist tweak.
Simon Tatham [Sat, 7 Nov 2015 15:15:07 +0000 (15:15 +0000)]
One small post-release checklist tweak.

I spotted that I've been checking that old-style Windows Help files
were delivered with content-type "application/octet-stream", but not
also checking the same thing about the marginally newer .CHM ones. (Or
at least not writing it down in the wishlist; I think I did actually
check on at least one occasion.)

8 years agoMake 'make install' ignore the new 'fuzzterm' binary.
Simon Tatham [Sat, 7 Nov 2015 14:45:20 +0000 (14:45 +0000)]
Make 'make install' ignore the new 'fuzzterm' binary.

It's for regression testing and fuzzing, so there's no use for it if
you're not a developer working on the source.

Leaving it out of the 'make install' target in Makefile.gtk is no
trouble because that's already handled manually in Recipe by inserting
a giant hairy Makefile fragment to do the installation. But
Makefile.am was just setting bin_PROGRAMS to the full set of binaries
built, so for that one, I had to invent a new Recipe program category
[UT] which moves a particular binary into noinst_PROGRAMS.

While I was at it, I've retired the [M] program category, which has
been lying around unused since Ben's old Mac OS pre-X port.

8 years agoFix a build failure coming from the fuzzing branch.
Simon Tatham [Sat, 7 Nov 2015 13:34:14 +0000 (13:34 +0000)]
Fix a build failure coming from the fuzzing branch.

Apparently if you maintain a branch for a long time where you only
compile with a non-default ifdef enabled, it becomes possible to not
notice a typo you left in the default branch :-)

8 years agoMerge Ben's branch on which he's been fuzzing PuTTY.
Simon Tatham [Sat, 7 Nov 2015 13:29:53 +0000 (13:29 +0000)]
Merge Ben's branch on which he's been fuzzing PuTTY.

This includes fixes arising from the fuzzing, and also changes to make
the code compile into usefully fuzzable forms.

8 years agoPost-0.66 release checklist updates.
Simon Tatham [Sat, 7 Nov 2015 10:12:00 +0000 (10:12 +0000)]
Post-0.66 release checklist updates.

The one-off reminder to finish the key rollover is now done, so I can
remove it.

8 years agoMerge tag '0.66'
Simon Tatham [Sat, 7 Nov 2015 09:54:05 +0000 (09:54 +0000)]
Merge tag '0.66'

This brings in the rest of the 0.66 branch, including some changes new
on master.

Conflicts:
        doc/plink.but
        sshrsa.c

(The conflicts were both trivial: in one, the addition of an extra
parameter to rsa2_newkey on master happened on the line next to 0.66's
addition of a check for NULL return value, and in the other, I'd got
the version number in the plink -h transcript messed up on master.)

8 years agoUpdate version number for 0.66 release. 0.66
Simon Tatham [Sat, 7 Nov 2015 09:08:21 +0000 (09:08 +0000)]
Update version number for 0.66 release.

8 years agoDocument the new session-logging command line options.
Simon Tatham [Sat, 7 Nov 2015 09:51:24 +0000 (09:51 +0000)]
Document the new session-logging command line options.

If I'm going to announce them as a feature in 0.66, it would be
embarrassing to forget to mention them in the documentation.

8 years agoInitial 'merge -s ours' from 0.66 release branch.
Simon Tatham [Sat, 7 Nov 2015 09:14:42 +0000 (09:14 +0000)]
Initial 'merge -s ours' from 0.66 release branch.

Everything up to here on the release branch is cherry-picks from
master anyway, and some of their cherry-picked forms conflict with the
current state of master due to further work, so here I'm just
recording an ancestry relation to indicate that there's nothing up to
here on 0.66 that master hasn't got.

8 years agoPuTTYgen's default hasn't been 1024 bits since 0.63.
Jacob Nevins [Thu, 22 Oct 2015 00:46:28 +0000 (01:46 +0100)]
PuTTYgen's default hasn't been 1024 bits since 0.63.

(cherry picked from commit 9f9d72ec58642e91b4f93ee4405a8086ee2fb2f0)

8 years agoFix winhandl.c's failure to ever free a foreign handle.
Simon Tatham [Fri, 25 Sep 2015 15:03:47 +0000 (16:03 +0100)]
Fix winhandl.c's failure to ever free a foreign handle.

Handles managed by winhandl.c have a 'busy' flag, which is used to
mean two things: (a) is a subthread currently blocked on this handle
so various operations in the main thread have to be deferred until it
finishes? And (b) is this handle currently one that should be returned
to the main loop to be waited for?

For HT_INPUT and HT_OUTPUT, those things are either both true or both
false, so a single flag covering both of them is fine. But HT_FOREIGN
handles have the property that they should always be waited for in the
main loop, but no subthread is blocked on them. The latter means that
operations done on them in the main thread should not be deferred; the
only such operation is cleaning them up in handle_free().

handle_free() was failing to spot this, and was deferring freeing
HT_FOREIGN handles until their subthread terminated - which of course
never happened. As a result, when a named pipe server was closed, its
actual Windows event object got destroyed, but winhandl.c still kept
passing it back to the main thread, leading to a tight loop because
MsgWaitForMultipleObjects would return ERROR_INVALID_HANDLE and never
block.

(cherry picked from commit 431f8db86278836adbe63dba7d1ab25fb94b616d)