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

4455 Коммитов

Автор SHA1 Сообщение Дата
Simon Tatham d0e9630e1c 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.
2015-12-11 18:11:43 +00:00
Simon Tatham 45d5aacbfa 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.
2015-12-06 07:23:59 +00:00
Simon Tatham 1659cf3f14 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.
2015-11-27 23:55:16 +00:00
Owen Dunn 6bea4b2502 Put ASLR and DEP flags back until the nightly build linker is new enough! 2015-11-27 19:55:52 +00:00
Owen Dunn 0f5299e5a8 Move sfree inside if. 2015-11-27 19:52:46 +00:00
Owen Dunn d8fdb49451 Merge branch 'master' of ssh://tartarus.org/putty 2015-11-27 19:44:25 +00:00
Simon Tatham 6c9aa9be32 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!
2015-11-25 18:18:45 +00:00
Owen Dunn 21a37d287c Document UNPROTECT define that disables tightened ACL. 2015-11-24 23:13:03 +00:00
Owen Dunn 8b65fef55c Surround process protection with an #ifndef UNPROTECT 2015-11-24 23:12:33 +00:00
Owen Dunn 0014ffb70c 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
2015-11-24 22:57:46 +00:00
Owen Dunn 48db456801 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.
2015-11-24 22:02:24 +00:00
Simon Tatham 50d73d95da 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.
2015-11-22 23:10:11 +00:00
Simon Tatham e1c2307cdd 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!
2015-11-22 22:50:30 +00:00
Simon Tatham 7c65b9c57a 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.
2015-11-22 15:12:10 +00:00
Simon Tatham 297efff303 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).
2015-11-22 15:11:00 +00:00
Simon Tatham 3d4d4004e8 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.)
2015-11-22 15:11:00 +00:00
Simon Tatham a6e76ae453 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.
2015-11-22 15:11:00 +00:00
Simon Tatham bb66e9870e 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.
2015-11-22 15:11:00 +00:00
Simon Tatham 37cdfdcd51 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.)
2015-11-22 15:10:59 +00:00
Simon Tatham 42334b65b0 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.
2015-11-22 15:10:59 +00:00
Owen Dunn aba7234bc1 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.
2015-11-22 12:04:04 +00:00
Jacob Nevins c4f963ebd7 Document 'Cannot assign requested address' error.
Often it means you tried to connect to port 0.
2015-11-21 12:21:31 +00:00
Simon Tatham 470337d0f2 Convert Buildscr to use the new "do/win" mechanism. 2015-11-17 18:41:52 +00:00
Simon Tatham 3e811b3dff 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...
2015-11-12 19:11:07 +00:00
Simon Tatham f08e2de078 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.
2015-11-12 19:09:36 +00:00
Simon Tatham 5b7833cd47 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.
2015-11-10 19:05:49 +00:00
Simon Tatham 5815d6a65a 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.
2015-11-10 19:05:49 +00:00
Simon Tatham fa7b23ce90 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.
2015-11-10 19:05:49 +00:00
Jacob Nevins a454399ec8 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).
2015-11-08 11:58:45 +00:00
Jacob Nevins 222c134b5f Add fuzzterm to .gitignore. 2015-11-08 11:58:45 +00:00
Simon Tatham b003e5cf53 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.
2015-11-07 20:15:24 +00:00
Simon Tatham f3230c8545 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.
2015-11-07 16:14:28 +00:00
Simon Tatham 3552f37ba5 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.)
2015-11-07 15:15:07 +00:00
Simon Tatham f14382ccce 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.
2015-11-07 14:54:36 +00:00
Simon Tatham fe16b577ef 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 :-)
2015-11-07 14:53:48 +00:00
Simon Tatham 2057f7a9f8 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.
2015-11-07 13:29:53 +00:00
Simon Tatham 503061e569 Post-0.66 release checklist updates.
The one-off reminder to finish the key rollover is now done, so I can
remove it.
2015-11-07 10:12:00 +00:00
Simon Tatham 8fdeb3a95c 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.)
2015-11-07 09:54:05 +00:00
Simon Tatham 07af4ed100 Update version number for 0.66 release. 2015-11-07 09:53:03 +00:00
Simon Tatham 986b8f87be 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.
2015-11-07 09:53:03 +00:00
Simon Tatham 009ab4a20c 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.
2015-11-07 09:14:42 +00:00
Jacob Nevins 7552ddb002 PuTTYgen's default hasn't been 1024 bits since 0.63.
(cherry picked from commit 9f9d72ec58)
2015-10-29 09:27:55 +00:00
Simon Tatham 98c946966b 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 431f8db862)
2015-10-29 09:27:54 +00:00
Simon Tatham 72b659cb72 Add a FAQ for 'checksum mismatch' reports.
The aim is to try to reduce the incidence of the two least helpful
classes of those reports: the ones which have just got mismatched
checksum files, and the ones which don't tell us the information that
would help.

(cherry picked from commit 8ff3b22243)
2015-10-29 09:27:53 +00:00
Ben Harris 6627c1ce13 fuzzterm: record characters being displayed. 2015-10-28 22:08:59 +00:00
Ben Harris 9022dcd5c5 fuzzterm: add some output to allow this to be used for testing.
Not very much, but it might be useful for testing that changes don't
unexpectedly break things.
2015-10-28 22:08:59 +00:00
Ben Harris 7a5cb2838f Emit a distinct error message when the SSH server's host key is invalid.
This also means that FUZZING can just ignore host-key verification
failure while preserving invalid-host-key errors.
2015-10-28 22:08:59 +00:00
Ben Harris 12702cb17e Fix a null-pointer dereference in ecdsa_verifysig.
Bug found with the help of afl-fuzz.
2015-10-28 22:08:59 +00:00
Ben Harris af1460d6e5 Add FUZZING support to ssh.c.
This adds the "none" cipher and MAC, and also disables kex signure
verification and host-key checking.  Since a client like this is
completely insecure, it also rewrites the client version string to
start "ISH", which should make it fail to interoperate with a real SSH
server.  The server version string is still expected to begin "SSH" so
the real packet captures can be used against it.
2015-10-28 22:08:58 +00:00
Ben Harris 5471539a67 Handle packets with no type byte by returning SSH_MSG_UNIMPLEMENTED.
The previous assertion failure is obviously wrong, but RFC 4253 doesn't
explicitly declare them to be a protocol error.  Currently, the incoming
packet isn't logged, which might cause some confusion for log parsers.

Bug found with the help of afl-fuzz.
2015-10-28 22:08:58 +00:00