]> asedeno.scripts.mit.edu Git - PuTTY.git/log
PuTTY.git
8 years agoAllow PROCESS_QUERY_INFORMATION access to our process.
Owen Dunn [Sun, 3 Apr 2016 14:06:44 +0000 (15:06 +0100)]
Allow PROCESS_QUERY_INFORMATION access to our process.

Blocking PROCESS_QUERY_INFORMATION access to the process turned out to
stop screen readers like Microsoft Narrator from reading parts of the
PuTTY window like the System Menu.

8 years agoCompile fix for GTK 3.18: avoid gtk_adjustment_changed().
Simon Tatham [Sun, 3 Apr 2016 09:10:40 +0000 (10:10 +0100)]
Compile fix for GTK 3.18: avoid gtk_adjustment_changed().

That function is deprecated as of 3.18, on the basis that GTK doesn't
need telling any more when the adjustment's owning widget needs
updating. So we just need to condition out the call.

8 years ago64-bit cleanness: fix a couple of format strings in winjump.c.
Simon Tatham [Sat, 2 Apr 2016 13:12:12 +0000 (14:12 +0100)]
64-bit cleanness: fix a couple of format strings in winjump.c.

strcspn() returns a size_t, which is not safe to pass as the parameter
in a printf argument list corresponding to a "*" field width specifier
in the format string, because the latter should be int, which may not
be the same size as size_t.

8 years ago64-bit cleanness: fix integer types in winsftp.c.
Simon Tatham [Sat, 2 Apr 2016 13:11:18 +0000 (14:11 +0100)]
64-bit cleanness: fix integer types in winsftp.c.

We were calling Windows file-handling API functions GetFilesize and
SetFilePointer, each of which returns two halves of a large integer by
writing the high half through a pointer, with pointers to the wrong
integer types. Now we're always passing the exact type defined in the
API, and converting after the fact to our own uint64 type, so this
should avoid any risk of wrong-sized pointers.

8 years ago64-bit cleanness: use INT_PTR/UINT_PTR where appropriate.
Simon Tatham [Sat, 2 Apr 2016 13:10:27 +0000 (14:10 +0100)]
64-bit cleanness: use INT_PTR/UINT_PTR where appropriate.

These integer types are correct for the id/handle parameter to
AppendMenu / InsertMenu / DeleteMenu, and also for the return type of
dialog box procedures.

8 years agoWindows: condition setprocessacl() on lack of -DNO_SECURITY.
Simon Tatham [Sat, 2 Apr 2016 12:48:20 +0000 (13:48 +0100)]
Windows: condition setprocessacl() on lack of -DNO_SECURITY.

We also have the special-purpose -DUNPROTECT to disable just the ACL
changes, but if you want to compile without any Windows security API
support at all (e.g. experimentally building against winelib) then
it's easier not to have to specify both defines separately.

8 years agoWindows: compile with /D_CRT_SECURE_NO_WARNINGS.
Simon Tatham [Sat, 2 Apr 2016 08:21:55 +0000 (09:21 +0100)]
Windows: compile with /D_CRT_SECURE_NO_WARNINGS.

With all due respect to Microsoft, a cross-platform program simply
cannot switch to using MS's assorted 'secure' versions of standard C
functions if it wants to continue compiling on platforms other than
Windows. So I might as well squash the warnings, so that any other
more interesting compiler warnings can avoid being swamped in the
mess.

8 years agoStop supporting fallback between SSH versions.
Jacob Nevins [Mon, 28 Mar 2016 19:23:57 +0000 (20:23 +0100)]
Stop supporting fallback between SSH versions.

The UI now only has "1" and "2" options for SSH protocol version, which
behave like the old "1 only" and "2 only" options; old
SSH-N-with-fallback settings are interpreted as SSH-N-only.

This prevents any attempt at a protocol downgrade attack.
Most users should see no difference; those poor souls who still have to
work with SSH-1 equipment now have to explicitly opt in.

8 years agoProvide a separate post-install README for MSI.
Simon Tatham [Sat, 2 Apr 2016 07:22:12 +0000 (08:22 +0100)]
Provide a separate post-install README for MSI.

The old README.txt instructed you to manually update PATH if you
wanted to run pscp from a command prompt. But the MSI installer can do
that automatically, so the wording needs tweaks. And now that we're
actually launching README (at least optionally) from the installer UI,
it's more important to not make it look silly.

8 years agoMSI installer: offer to display the README file after install.
Simon Tatham [Sat, 2 Apr 2016 07:00:25 +0000 (08:00 +0100)]
MSI installer: offer to display the README file after install.

This is a thing that the Inno Setup installer did, and that I didn't
get round to replicating when I rushed out the initial MSI in a hurry.

I've checked that this doesn't prevent unattended installation by
administrators: running 'msiexec /q /i putty-whatever.msi' as
administrator still installs silently after this change, without
popping up the README unexpectedly on anyone's desktop as a side
effect.

(I _think_ - but I'm still a long way from an MSI expert - that that's
because /q turns off the whole UI part of the MSI system, and the
loading of README is actually triggered by the transition away from
the final UI dialog box, which we now never visit in the first place.)

8 years agoMSI installer: turn the desktop icon off by default.
Simon Tatham [Sat, 2 Apr 2016 07:00:17 +0000 (08:00 +0100)]
MSI installer: turn the desktop icon off by default.

I rushed out the MSI in too much of a hurry to sort out this kind of
thing, but now we've got leisure to reconsider, I think it's better
behaviour not to clutter everyone's desktops unless specifically asked
to.

8 years agoWarn about short RSA/DSA keys in PuTTYgen.
Simon Tatham [Sat, 2 Apr 2016 07:00:37 +0000 (08:00 +0100)]
Warn about short RSA/DSA keys in PuTTYgen.

It's only a warning; Windows PuTTYgen puts it up as a message box, and
will still generate the key if you click yes, and Unix PuTTYgen just
prints the warning and gets on with generation anyway. But it might
help encourage people to move away from 1024-bit keys, if they're
still using them.

8 years agoExtend ACL-restriction to all Windows tools.
Simon Tatham [Sat, 2 Apr 2016 07:00:07 +0000 (08:00 +0100)]
Extend ACL-restriction to all Windows tools.

Protecting our processes from outside interference need not be limited
to just PuTTY: there's no reason why the other SSH-speaking tools
shouldn't have the same treatment (PSFTP, PSCP, Plink), and PuTTYgen
and Pageant which handle private key material.

8 years agoFix a potential time-wraparound issue in pinger.c.
Simon Tatham [Fri, 1 Apr 2016 12:27:03 +0000 (13:27 +0100)]
Fix a potential time-wraparound issue in pinger.c.

A compiler warning drew my attention to the fact that 'next' in
pinger_schedule() was an int, not the unsigned long it should have
been. And looking at the code that handles it, it was also taking no
care with integer wraparound when checking whether an existing
scheduled ping should be moved forward.

So now I do something a bit more robust, by remembering what time it
_was_ when we set pinger->next, and checking if the new time value
falls in the interval between those two times.

8 years agoAdd a missing #include.
Simon Tatham [Fri, 1 Apr 2016 12:14:38 +0000 (13:14 +0100)]
Add a missing #include.

winshare.c uses make_private_security_descriptor(), but wasn't
including winsecur.h where it's declared.

8 years agocmdgen: refuse to generate RSA/DSA keys under 256 bits.
Simon Tatham [Wed, 30 Mar 2016 10:41:11 +0000 (11:41 +0100)]
cmdgen: refuse to generate RSA/DSA keys under 256 bits.

This replicates the existing error message in Windows PuTTYgen, on the
basis that keys smaller than that will actually fail to work with our
signing code.

8 years agoCleanup: rename Windows PuTTYgen's key generation function.
Simon Tatham [Wed, 30 Mar 2016 10:28:59 +0000 (11:28 +0100)]
Cleanup: rename Windows PuTTYgen's key generation function.

It's been a generation function for keys in general for yonks, not
just RSA keys specifically.

8 years agoAdd a file of extra bignum tests.
Simon Tatham [Wed, 30 Mar 2016 07:45:21 +0000 (08:45 +0100)]
Add a file of extra bignum tests.

I generated these as a by-product of using afl-fuzz on the testbn
executable. I'd hoped it would find interesting bugs in the bignum
code itself, but in fact it mostly found bugs in the parsing code in
the test main(). However, even so, it did produce a list of tests
which reach as much of the code as afl-fuzz was able to, and that
seems like a useful thing to save.

Also, of course, just having a place to put explicitly specified
bignum tests is a good thing anyway, because then we can put
regression tests on the end of it every time we fix bugs.

8 years agocmdgen: rescue test suite from bit rot.
Simon Tatham [Wed, 30 Mar 2016 07:25:25 +0000 (08:25 +0100)]
cmdgen: rescue test suite from bit rot.

cmdgen.c has contained code for ages to build a test main() if you
compile with -DTEST_CMDGEN. But it's painful to do so manually, since
you've still got to link in all the same supporting objects, and also
nobody can have actually done that for a while because the stub test
code hasn't been kept up to date with changes in the internal APIs
(specifically prompt_t).

Now we have the ability to include our test programs in Recipe as [UT]
or [XT] so as to leave them out of 'make install', that seems like a
useful thing to do with cmdgen's test suite. So here's a Recipe change
that builds it as 'cgtest', plus fixes for compiler warnings and bit
rot. Pleasantly, the test suite still _passes_ after those are fixed.

8 years agocmdgen: option to specify the random number device to use.
Simon Tatham [Wed, 30 Mar 2016 07:17:03 +0000 (08:17 +0100)]
cmdgen: option to specify the random number device to use.

E.g. you might pass '--random-device=/dev/urandom'.

Mostly because I got sick of waiting for /dev/random to finish
blocking while I was trying to generate throwaway keys for testing bug
fixes in cmdgen itself. But it might also be useful on systems that
call their random device by a different name that we haven't
encountered.

(Since cmdgen also reads the saved PuTTY random seed file, setting
this option to /dev/zero will not render key generation deterministic.
It's tempting to provide _some_ way to do that, for testing purposes
and clearly marked as dangerous of course, but I think it would take
more faff than this.)

8 years agoRework window geometry to avoid using geometry_widget.
Simon Tatham [Tue, 29 Mar 2016 12:42:54 +0000 (13:42 +0100)]
Rework window geometry to avoid using geometry_widget.

Partly this is because the geometry_widget functionality is going away
in a later version of GTK3, so sooner or later we'll need not to be
using it anyway. But also, it turns out that GTK 3's geometry
calculations have the unfortunate effect of setting the window's base
and min heights to values that are not congruent mod height_increment
(because the former is the value we gave, but the latter is based on
the minimum height of the scrollbar), which confuses at least one
window manager (xfwm4) and causes the window to be created one row too
small.

So I've redone all the geometry computations my own way, based on the
knowledge that the only widgets visible in the top-level window are
the drawing area and the scrollbar and I know how both of those
behave, and taking care to keep base_height and min_height congruent
to avoid that xfwm4 bug.

8 years agoMore modern examples of ports we don't have.
Jacob Nevins [Mon, 28 Mar 2016 18:16:14 +0000 (19:16 +0100)]
More modern examples of ports we don't have.

8 years agoRemove call for help with a Windows 3 port.
Jacob Nevins [Mon, 28 Mar 2016 18:15:14 +0000 (19:15 +0100)]
Remove call for help with a Windows 3 port.

I think that in fact we would not welcome this at this point in time.

8 years agoWe will soon have Pageant for Unix.
Jacob Nevins [Mon, 28 Mar 2016 18:16:34 +0000 (19:16 +0100)]
We will soon have Pageant for Unix.

8 years agoTweaks re Mac elsewhere in FAQ after bb6dd98.
Jacob Nevins [Mon, 28 Mar 2016 18:09:11 +0000 (19:09 +0100)]
Tweaks re Mac elsewhere in FAQ after bb6dd98.

8 years agoTweak Unix bits of FAQ after 776a31b.
Jacob Nevins [Mon, 28 Mar 2016 18:13:50 +0000 (19:13 +0100)]
Tweak Unix bits of FAQ after 776a31b.

8 years agoFix punctuation.
Jacob Nevins [Mon, 28 Mar 2016 16:24:23 +0000 (17:24 +0100)]
Fix punctuation.

8 years agoRemove the warning about Unix PuTTY being Linux-specific.
Simon Tatham [Sun, 27 Mar 2016 19:25:59 +0000 (20:25 +0100)]
Remove the warning about Unix PuTTY being Linux-specific.

Since I've been building it on OS X recently, I think it's fair to say
it can now cope with reasonable variation in pty APIs and the like.

8 years agoUpdate Visual Studio versions in README.
Simon Tatham [Sun, 27 Mar 2016 19:25:09 +0000 (20:25 +0100)]
Update Visual Studio versions in README.

VC6 is hopefully long gone, and I've recently been testing on more
up-to-date versions.

8 years agoMention the Secure Contact Key on the Feedback page.
Simon Tatham [Sun, 27 Mar 2016 19:18:21 +0000 (20:18 +0100)]
Mention the Secure Contact Key on the Feedback page.

Both in a new section about reporting vulnerabilities, and in the
section about large attachments (since some large attachments will
surely contain confidential information from the sender).

8 years agoUpdate docs and FAQ for current DSA policy.
Simon Tatham [Sun, 27 Mar 2016 19:10:56 +0000 (20:10 +0100)]
Update docs and FAQ for current DSA policy.

I think the deterministic DSA system we've been using for ages can now
be considered proven in use, not to mention the fact that RFC 6979 and
the Ed25519 spec both give variants on the same idea. So I've removed
the 'don't use DSA if you can avoid it' warning.

8 years agoDecide on a position for ChaCha20-Poly1305.
Simon Tatham [Sun, 27 Mar 2016 19:07:53 +0000 (20:07 +0100)]
Decide on a position for ChaCha20-Poly1305.

Previously, due to confusion, it was placed either at the end of the
list or at the start, depending on whether the user had any saved
configuration at all. Now we get to choose a sensible place for it in
the list, and for the moment I think second place behind AES is
reasonable.

8 years agoFix relative positioning between two new elements in gprefs().
Simon Tatham [Sun, 27 Mar 2016 19:06:33 +0000 (20:06 +0100)]
Fix relative positioning between two new elements in gprefs().

It was only prepared to position a new element relative to an existing
one if the latter was specified in the saved configuration, not if the
latter was another element new to this run of gprefs(). This wasn't
deliberate at all: it was just due to me failing to update the 'seen'
bitmap in the loop adding new elements.

8 years agoSpecial host key warning when a better key exists.
Simon Tatham [Sun, 27 Mar 2016 17:08:49 +0000 (18:08 +0100)]
Special host key warning when a better key exists.

If you're connecting to a new server and it _only_ provides host key
types you've configured to be below the warning threshold, it's OK to
give the standard askalg() message. But if you've newly demoted a host
key type and now reconnect to some server for which that type was the
best key you had cached, the askalg() wording isn't really appropriate
(it's not that the key we've settled on is the first type _supported
by the server_, it's that it's the first type _cached by us_), and
also it's potentially helpful to list the better algorithms so that
the user can pick one to cross-certify.

8 years agoFix assertion failure in host keys log message.
Simon Tatham [Sun, 27 Mar 2016 13:59:18 +0000 (14:59 +0100)]
Fix assertion failure in host keys log message.

When Jacob introduced this message in d0d3c47a0, he was right to
assume that hostkey_algs[] and ssh->uncert_hostkeys[] were sorted in
the same order. Unfortunately, he became wrong less than an hour later
when I committed d06098622. Now we avoid making any such assumption.

8 years agoOmit the conf_launchable check in pterm Duplicate Session.
Simon Tatham [Sun, 27 Mar 2016 13:10:06 +0000 (14:10 +0100)]
Omit the conf_launchable check in pterm Duplicate Session.

It won't return true, because pterm's use of conf is a bit nonstandard
(it doesn't really bother about the protocol field, and has no use for
either host names _or_ serial port filenames). Was affecting both
gtkapp and gtkmain based builds.

8 years agoExamples in man pages for '-fn' option.
Jacob Nevins [Sun, 27 Mar 2016 10:33:21 +0000 (11:33 +0100)]
Examples in man pages for '-fn' option.

I was confused by '-fn Monospace' not working (it needs a font size).

8 years agoMissed a host key doc cross-reference.
Jacob Nevins [Sun, 27 Mar 2016 09:57:25 +0000 (10:57 +0100)]
Missed a host key doc cross-reference.

Also, fix a mangled sentence.

8 years agoFix log message about alternate host keys.
Jacob Nevins [Sat, 26 Mar 2016 18:40:16 +0000 (18:40 +0000)]
Fix log message about alternate host keys.

Since we got a dynamic preference order, it's been bailing out at a
random point, and listing keys we wouldn't use.
(It would still be nice to only mention keys that we'd actually use, but
that's now quite fiddly.)

8 years agoCross-reference all the host key docs.
Jacob Nevins [Sat, 26 Mar 2016 17:38:49 +0000 (17:38 +0000)]
Cross-reference all the host key docs.

And tweak some of the words a bit.

8 years agoSupport sh/csh syntax switching for Unix Pageant.
Simon Tatham [Fri, 25 Mar 2016 16:43:59 +0000 (16:43 +0000)]
Support sh/csh syntax switching for Unix Pageant.

8 years agoAdd some missing 'const' in ssh.c arrays.
Simon Tatham [Fri, 25 Mar 2016 16:22:57 +0000 (16:22 +0000)]
Add some missing 'const' in ssh.c arrays.

I noticed this in passing while tinkering with the hostkey_algs array:
these arrays are full of pointers-to-const, but are not also
themselves declared const, which they should have been all along.

8 years agoConfigurable preference list for SSH host key types.
Simon Tatham [Fri, 25 Mar 2016 15:56:31 +0000 (15:56 +0000)]
Configurable preference list for SSH host key types.

Now we actually have enough of them to worry about, and especially
since some of the types we support are approved by organisations that
people might make their own decisions about whether to trust, it seems
worth having a config list for host keys the same way we have one for
kex types and ciphers.

To make room for this, I've created an SSH > Host Keys config panel,
and moved the existing host-key related configuration (manually
specified fingerprints) into there from the Kex panel.

8 years agoDocument host key cross-certification.
Jacob Nevins [Fri, 25 Mar 2016 15:42:42 +0000 (15:42 +0000)]
Document host key cross-certification.

8 years agoLog when we avoid using an unknown host key.
Jacob Nevins [Fri, 25 Mar 2016 15:37:16 +0000 (15:37 +0000)]
Log when we avoid using an unknown host key.

Intended as a hint that users may want to use the "Cache new host key type"
special command.

8 years agoLogical host name: minor rewording.
Jacob Nevins [Fri, 25 Mar 2016 10:40:03 +0000 (10:40 +0000)]
Logical host name: minor rewording.

8 years agoDemote SSH bypass-auth option; downplay in docs.
Jacob Nevins [Fri, 25 Mar 2016 13:10:00 +0000 (13:10 +0000)]
Demote SSH bypass-auth option; downplay in docs.

It's too esoteric to be the first thing on the Auth panel; I've never
heard of any SSH server that supports it in the decade since I
implemented it. The only Google hits are lost souls mistakenly believing
they need it for passwordless public-key login and the like.

8 years agoEmphasise that agent forwarding exposes all keys.
Jacob Nevins [Fri, 25 Mar 2016 00:18:18 +0000 (00:18 +0000)]
Emphasise that agent forwarding exposes all keys.

(A bit.)

8 years agoDocs: character sets are awful.
Jacob Nevins [Fri, 25 Mar 2016 00:13:06 +0000 (00:13 +0000)]
Docs: character sets are awful.

8 years agoCross-reference Event Log and logfile docs.
Jacob Nevins [Fri, 25 Mar 2016 00:11:13 +0000 (00:11 +0000)]
Cross-reference Event Log and logfile docs.

8 years agoSupport Ed25519 in kh2reg.py.
Simon Tatham [Fri, 25 Mar 2016 09:55:46 +0000 (09:55 +0000)]
Support Ed25519 in kh2reg.py.

8 years agoMake Makefile.gtk default to GTK 3.
Simon Tatham [Fri, 25 Mar 2016 09:11:01 +0000 (09:11 +0000)]
Make Makefile.gtk default to GTK 3.

8 years agoFix Makefile.gtk in the wake of the new [XT] program type.
Simon Tatham [Fri, 25 Mar 2016 09:10:50 +0000 (09:10 +0000)]
Fix Makefile.gtk in the wake of the new [XT] program type.

It's not the recommended makefile any more, but it's not too hard
to keep it working for the moment.

8 years agoDelete the old 'macosx' directory completely.
Simon Tatham [Fri, 25 Mar 2016 09:06:03 +0000 (09:06 +0000)]
Delete the old 'macosx' directory completely.

The current state of the OS X GTK port is looking more or less
plausible - it's not finished, of course, but then neither was the old
native Cocoa port. So I'm inclined to advertise it as *the* unfinished
OS X port: it's the one I intend to keep working on, and it's the one
I'd prefer people offered us help with if they're going to offer.

Hence, leaving the old macosx directory around is just confusing; that
directory is long-unmaintained, probably doesn't even compile, and its
only effect will be to mislead people into thinking it's still
relevant. I'm unilaterally deleting it; of course we can always
recover it from source control history if it's ever necessary to do
so.

8 years agoRewrite the FAQ entry about the MacOS port.
Simon Tatham [Fri, 25 Mar 2016 08:46:34 +0000 (08:46 +0000)]
Rewrite the FAQ entry about the MacOS port.

8 years agoFix display of ECC keys in the Windows Pageant list box.
Simon Tatham [Fri, 25 Mar 2016 08:36:29 +0000 (08:36 +0000)]
Fix display of ECC keys in the Windows Pageant list box.

This is an absolutely horrible piece of code, relying not only on font
metrics but also on an observed correlation between the length of a
key algorithm name and whether or not it needs a separate key size
displayed. But it'll do for the moment, and it's less effort than
writing a custom piece of Windows API code to display the list box
entries in a properly robust way :-(

8 years agoPolish up the PuTTYgen user interface for ECC key types.
Simon Tatham [Fri, 25 Mar 2016 07:53:06 +0000 (07:53 +0000)]
Polish up the PuTTYgen user interface for ECC key types.

Jacob pointed out that a free-text field for entering a key size in
bits is all very well for key types where we actually _can_ generate a
key to a size of your choice, but less useful for key types where
there are only three (or one) legal values for the field, especially
if we don't _say_ what they are.

So I've revamped the UI a bit: now, in ECDSA mode, you get a dropdown
list selector showing the available elliptic curves (and they're even
named, rather than just given by bit count), and in ED25519 mode even
that disappears. The curve selector for ECDSA and the bits selector
for RSA/DSA are independent controls, so each one remembers its last
known value even while temporarily hidden in favour of the other.

The actual generation function still expects a bit count rather than
an actual curve or algorithm ID, so the easiest way to actually
arrange to populate the drop-down list was to have an array of bit
counts exposed by sshecc.c. That's a bit ugly, but there we go.

One small functional change: if you enter an absurdly low value into
the RSA/DSA bit count box (under 256), PuTTYgen used to give a warning
and reset it to 256. Now it resets it to the default key length of
2048, basically because I was touching that code anyway to change a
variable name and just couldn't bring myself to leave it in a state
where it intentionally chose such an utterly useless key size. Of
course this doesn't prevent generation of 256-bit keys if someone
still really wants one - it just means they don't get one selected as
the result of a typo.

8 years agoNote in vt100.txt when it can be expected to work.
Jacob Nevins [Thu, 24 Mar 2016 23:46:10 +0000 (23:46 +0000)]
Note in vt100.txt when it can be expected to work.

8 years agoGTK 3 fake dialog action area: fix margins and spacing.
Simon Tatham [Thu, 24 Mar 2016 07:19:09 +0000 (07:19 +0000)]
GTK 3 fake dialog action area: fix margins and spacing.

The About box is where it showed up most obviously that I'd hastily
bunged a GtkBox inside another GtkBox without considering their
margins: the 'action area' had twice the margin it should have had and
the rightmost button didn't align with the right edge of the rest of
the window contents.

Easily fixed by giving the inner hbox margin 0 (fixing the right align
and the excessive space around all the buttons), and using the
'spacing' property of GtkBox to ensure multiple buttons in it are
nicely separated without having to take care over that in the client
code that adds them.

8 years agoAdd a TODO list to gtkapp.c.
Simon Tatham [Wed, 23 Mar 2016 22:17:09 +0000 (22:17 +0000)]
Add a TODO list to gtkapp.c.

This lists all the things I currently know to be wrong with the OS X
work. There are quite a few of them, but I doubt I've thought of them
all.

8 years agoAdd '.DS_Store' to .gitignore.
Simon Tatham [Wed, 23 Mar 2016 22:16:20 +0000 (22:16 +0000)]
Add '.DS_Store' to .gitignore.

This is a file that generally seems to turn up when you start using OS
X Finder to interact with directories - which is more likely now that
we're building OS X app bundles into this source tree.

8 years agoCreate OS X application bundles for PuTTY and pterm.
Simon Tatham [Wed, 23 Mar 2016 22:14:13 +0000 (22:14 +0000)]
Create OS X application bundles for PuTTY and pterm.

This commit adds two .plist files, which go in the app bundles; two
.bundle files, which are input to gtk-mac-bundler and explain to it
how to _create_ the bundles; and a piece of manual addition to
Makefile.am that actually runs gtk-mac-bundler after building the
gtkapp.c based binaries and the OSX launcher. The latter is
conditionalised on configuring --with-quartz (unlike the binaries
themselves, which you can build on other platforms too, though they
won't do much that's useful).

8 years agoNew program 'osxlaunch', to use as an OS X bundle launcher.
Simon Tatham [Wed, 23 Mar 2016 22:13:30 +0000 (22:13 +0000)]
New program 'osxlaunch', to use as an OS X bundle launcher.

The big problem with making an OS X application out of a GTK program
is that it won't start unless DYLD_LIBRARY_PATH and several other
environment variables point at all the GTK machinery. So your app
bundle has to contain two programs: a launcher to set up that
environment, and then the real main program that the launcher execs
once it's done so.

But in our case, we also need pterm to start subprocesses _without_
all that stuff in the environment - so our launcher has to be more
complicated than the usual one, because it's also got to save every
detail of how the environment was when it started up. So this is the
launcher program I'm going to use. Comments in the header explain in
more detail how it'll work.

Also in this commit, I add the other end of the same machinery to
gtkapp.c and uxpty.c: the former catches an extra command-line
argument that the launcher used to indicate how it had munged the
environment, and stores it in a global variable where the latter can
pick it up after fork() and use to actually undo the munging.

8 years agoNew front end to PuTTY/pterm, as a GtkApplication.
Simon Tatham [Wed, 23 Mar 2016 22:22:30 +0000 (22:22 +0000)]
New front end to PuTTY/pterm, as a GtkApplication.

When it's finished, this will be the backbone of the OS X GTK port:
using a GtkApplication automatically gives us a properly OS X
integrated menu bar.

Using this source file in place of gtkmain.c turns the usual Unix
single-session-per-process PuTTY or pterm into the multi-session-per-
process OS X style one.

Things like Duplicate Session can be done much more simply here - we
just grab the Conf * from the source window and launch a new window
using it, with no fiddly interprocess work needed.

This is still experimental and has a lot of holes, but it's usable
enough to test and improve.

8 years agoDelegate GTK window creation to gtkmain.c.
Simon Tatham [Wed, 23 Mar 2016 22:03:46 +0000 (22:03 +0000)]
Delegate GTK window creation to gtkmain.c.

This is a weird thing to have to do, but it is necessary: the OS X
PuTTY will need its top-level windows to be instances of a thing
called GtkApplicationWindow, rather than plain GtkWindow. Hence, the
actual creation of windows needs to be somewhere that isn't
centralised between the two kinds of front end.

8 years agoMake an OS X icon for pterm as well as PuTTY.
Simon Tatham [Wed, 23 Mar 2016 22:02:46 +0000 (22:02 +0000)]
Make an OS X icon for pterm as well as PuTTY.

8 years agoNew program type [XT] in Recipe.
Simon Tatham [Wed, 23 Mar 2016 22:01:10 +0000 (22:01 +0000)]
New program type [XT] in Recipe.

This is to [X] what [UT] is to [U]: that is, it's a program linked
against the GTK libraries, but one which doesn't become part of the
'make install' set. I'll use this for the individual binaries that
will go in the OS X application bundles, and then have another
makefile rule pick those up in turn.

8 years agoMake gtkmain.c contain the actual main().
Simon Tatham [Wed, 23 Mar 2016 21:58:40 +0000 (21:58 +0000)]
Make gtkmain.c contain the actual main().

Instead of main() living in uxputty.c and uxpterm.c, and doing a
little bit of setup before calling the larger pt_main() in gtkmain.c,
I've now turned things backwards: the big function in gtkmain.c *is*
main(), and the small pieces of preliminary setup in uxputty.c and
uxpterm.c are now a function called setup() which is called from
there. This will allow me to reuse the rest of ux{putty,pterm}.c, i.e.
the assorted top-level bits and pieces that distinguish PuTTY from
pterm, in the upcoming OS X application that will have its own main().

8 years agoUse NetPBM .pam as an intermediate format in the icon makefile.
Simon Tatham [Wed, 23 Mar 2016 06:41:27 +0000 (06:41 +0000)]
Use NetPBM .pam as an intermediate format in the icon makefile.

mkicon.py now outputs .pam by hand, rather than using ImageMagick to
go straight to .png. For most purposes the main makefile then uses
ImageMagick anyway, to convert those .pams straight to the .pngs that
the rest of the scripts were expecting. But one script that doesn't do
that is macicon.py, which builds the MacOS .icns file by directly
reading those .pam files back in.

This allows the 'make icns' target in the icons directory to build
from a clean checkout on vanilla MacOS, without requiring a user to
install ImageMagick or any other non-core Python image handling
module.

(I could probably take this change at least a little bit further. I
don't see any reason why icon.pl - generating the Windows .ico files -
couldn't read the .pam files directly, about as easily as macicon.py
did, if anyone had a use case for building the Windows icons in the
presence of Python and Perl but in the absence of ImageMagick. But the
.png files are directly useful outputs for Unix, so _some_ PNG-writing
will have to remain here.)

8 years agoDivide the whole of gtkwin.c into three parts.
Simon Tatham [Tue, 22 Mar 2016 21:24:30 +0000 (21:24 +0000)]
Divide the whole of gtkwin.c into three parts.

This lays further groundwork for the OS X GTK3 port, which is going to
have to deal with multiple sessions sharing the same process. gtkwin.c
was a bit too monolithic for this, since it included some
process-global runtime state (timers, toplevel callbacks), some
process startup stuff (gtk_init, gtk_main, argv processing) and some
per-session-window stuff.

The per-session stuff remains in gtkwin.c, with the top-level function
now being new_session_window() taking a Conf. The new gtkmain.c
contains the outer skeleton of pt_main(), handling argv processing and
one-off startup stuff like setlocale; and the new gtkcomm.c contains
the pieces of PuTTY infrastructure like timers and uxsel that are
shared between multiple sessions rather than reinstantiated per
session, which have been rewritten to use global variables rather than
fields in 'inst' (since it's now clear to me that they'll have to
apply to all the insts in existence at once).

There are still some lurking assumptions of one-session-per-process,
e.g. the use of gtk_main_quit when a session finishes, and the fact
that the config box insists on running as a separate invocation of
gtk_main so that one session's preliminary config box can't coexist
with another session already active. But this should make it possible
to at least write an OS X app good enough to start testing with, even
if it doesn't get everything quite right yet.

This change is almost entirely rearranging existing code, so it
shouldn't be seriously destabilising. But two noticeable actual
changes have happened, both pleasantly simplifying:

Firstly, the global-variables rewrite of gtkcomm.c has allowed the
post_main edifice to become a great deal simpler. Most of its
complexity was about remembering what 'inst' it had to call back to,
and in fact the right answer is that it shouldn't be calling back to
one at all. So now the post_main() called by gtkdlg.c has become the
same function as the old inst_post_main() that actually did the work,
instead of the two having to be connected by a piece of ugly plumbing.

Secondly, a piece of code that's vanished completely in this
refactoring is the temporary blocking of SIGCHLD around most of the
session setup code. This turns out to have been introduced in 2002,
_before_ I switched to using the intra-process signal pipe strategy
for SIGCHLD handling in 2003. So I now expect that we should be robust
in any case against receiving SIGCHLD at an inconvenient moment, and
hence there's no need to block it.

8 years agokh2reg.py: remove accidental hard tabs.
Jacob Nevins [Tue, 22 Mar 2016 00:43:30 +0000 (00:43 +0000)]
kh2reg.py: remove accidental hard tabs.

8 years agoPartial update of kh2reg.py for new formats.
Jacob Nevins [Tue, 22 Mar 2016 00:36:19 +0000 (00:36 +0000)]
Partial update of kh2reg.py for new formats.

Only ECDSA so far, because ed25519 requires real maths to deal with the
compressed point format.

8 years agoMSI-related updates to .gitignore.
Simon Tatham [Mon, 21 Mar 2016 19:07:40 +0000 (19:07 +0000)]
MSI-related updates to .gitignore.

8 years agoUpdate the specials menu as keys are cross-certified.
Simon Tatham [Mon, 21 Mar 2016 19:05:32 +0000 (19:05 +0000)]
Update the specials menu as keys are cross-certified.

If you've just certified a key, you want it to vanish from the menu
immediately, of course.

8 years agoAhem. Cross-certify the key the user actually asked for.
Simon Tatham [Mon, 21 Mar 2016 18:59:01 +0000 (18:59 +0000)]
Ahem. Cross-certify the key the user actually asked for.

I got momentarily confused between whether the special code
(TS_LOCALSTART+i) meant the ith entry in the variable
uncert_hostkeys[] array, or the ith entry in the fixed hostkey_algs[]
array. Now I think everything agrees on it being the latter.

8 years agoAdd manual cross-certification of new host keys.
Simon Tatham [Mon, 21 Mar 2016 07:25:31 +0000 (07:25 +0000)]
Add manual cross-certification of new host keys.

If a server offers host key algorithms that we don't have a stored key
for, they will now appear in a submenu of the Special Commands menu.
Selecting one will force a repeat key exchange with that key, and if
it succeeds, will add the new host key to the cache. The idea is that
the new key sent by the server is protected by the crypto established
in the previous key exchange, so this is just as safe as typing some
command like 'ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub' at the
server prompt and transcribing the results manually.

This allows switching over to newer host key algorithms if the client
has begun to support them (e.g. people using PuTTY's new ECC
functionality for the first time), or if the server has acquired a new
key (e.g. due to a server OS upgrade).

At the moment, it's only available manually, for a single host key
type at a time. Automating it is potentially controversial for
security policy reasons (what if someone doesn't agree this is what
they want in their host key cache, or doesn't want to switch over to
using whichever of the keys PuTTY would now put top of the list?), for
code plumbing reasons (chaining several of these rekeys might be more
annoying than doing one at a time) and for CPU usage reasons (rekeys
are expensive), but even so, it might turn out to be a good idea in
future.

8 years agoAdd TS_LOCALSTART for session-specific 'Telnet' specials.
Simon Tatham [Mon, 21 Mar 2016 06:54:26 +0000 (06:54 +0000)]
Add TS_LOCALSTART for session-specific 'Telnet' specials.

Now I can invent codes that vary per session.

8 years agoAllocate the SSH specials list dynamically.
Simon Tatham [Mon, 21 Mar 2016 06:50:50 +0000 (06:50 +0000)]
Allocate the SSH specials list dynamically.

The last list we returned is now stored in the main Ssh structure
rather than being a static array in ssh_get_specials.

The main point of this is that I want to start adding more dynamic
things to it, for which I can't predict the array's max length in
advance.

But also this fixes a conceptual wrongness, in that if a process had
more than one Ssh instance in it then their specials arrays would have
taken turns occupying the old static array, and although the current
single-threaded client code in the GUI front ends wouldn't have minded
(it would have read out the contents just once immediately after
get_specials returned), it still feels as if it was a bug waiting to
happen.

8 years agoFix goof in Pango bidi suppression.
Simon Tatham [Sun, 20 Mar 2016 20:04:26 +0000 (20:04 +0000)]
Fix goof in Pango bidi suppression.

When we're displaying bidirectionally active text (that is, text that
the Unicode bidi algorithm will fiddle with), we need to suppress
Pango's bidi because we've already done our own. We were doing this by
calling is_rtl() on each character, and if it returned true,
displaying just that character in a separate Pango call.

Except that, ahem, we were only doing this if the _first_ character
encountered during a scan of the display buffer was rtl-sensitive. If
the first one was fine but a subsequent one was rtl-sensitive, then
that one would just get shoved into the buffer we'd already started.

Running pterm -fn 'client:Monospace 12' and displaying
testdata/utf8.txt now works again.

8 years agoFix blatant segfault in x11_font_has_glyph.
Simon Tatham [Sun, 20 Mar 2016 19:55:22 +0000 (19:55 +0000)]
Fix blatant segfault in x11_font_has_glyph.

When I cut it in half so I could fetch the XCharStruct for a given
character, I forgot that the remaining half should check whether it
had got NULL from the XCharStruct finder. Ahem.

8 years agoGTK3: give I/O events lower priority than window redraws.
Simon Tatham [Sun, 20 Mar 2016 19:44:23 +0000 (19:44 +0000)]
GTK3: give I/O events lower priority than window redraws.

If you run something like 'seq 2000000000' in a GTK3 pterm, the window
never actually updates, because pterm always considers reading more
data from the pty to have higher priority than delivering the "draw"
event. Using g_io_add_watch_full instead of g_io_add_watch allows us
to explicitly lower the priority of the I/O sources, so that window
redraws will take precedence.

8 years agoIgnore X11 BadMatch errors during cut buffer setup.
Simon Tatham [Sun, 20 Mar 2016 18:16:43 +0000 (18:16 +0000)]
Ignore X11 BadMatch errors during cut buffer setup.

This is quite a pain, since it involves inventing an entire new piece
of infrastructure to install a custom Xlib error handler and give it a
queue of things to do. But it fixes a bug in which Unix pterm/PuTTY
crash out at startup if one of the root window's CUT_BUFFERn
properties contains something of a type other than STRING - in
particular, UTF8_STRING is not unheard-of.

For example, run
  xprop -root -format CUT_BUFFER3 8u -set CUT_BUFFER3 "thingy"
and then pterm without this fix would have crashed.

8 years agoFix downloading of variable-pitch X font glyphs.
Simon Tatham [Sun, 20 Mar 2016 17:39:43 +0000 (17:39 +0000)]
Fix downloading of variable-pitch X font glyphs.

I had completely forgotten, when rendering each glyph to a server-side
pixmap and downloading its contents, to only look at the part of the
pixmap that XDrawImageString would have overwritten, as specified by
the metrics in the XCharStruct. Now 'pterm -fn server:variable'
doesn't randomly make up bitmap nonsense outside each character's
bounding rectangle.

8 years agoSet an icon for the MSI package's entry in Add/Remove Programs.
Simon Tatham [Sun, 20 Mar 2016 16:01:36 +0000 (16:01 +0000)]
Set an icon for the MSI package's entry in Add/Remove Programs.

It would be nicer if we could also make this show up as the icon for
the .msi file itself when viewed in Explorer, but apparently nothing
can change that. But at least this still gives us _some_ use for the
cardboard-box icon :-)

8 years agoUpdate README for Gtk3.
Jacob Nevins [Sat, 19 Mar 2016 20:05:03 +0000 (20:05 +0000)]
Update README for Gtk3.

8 years agoDocument pageant interoperability with OpenSSH etc
Jacob Nevins [Sat, 19 Mar 2016 22:55:17 +0000 (22:55 +0000)]
Document pageant interoperability with OpenSSH etc

8 years agoClarify Unix Pageant passphrase prompting docs.
Jacob Nevins [Sat, 19 Mar 2016 22:33:50 +0000 (22:33 +0000)]
Clarify Unix Pageant passphrase prompting docs.

Terminal prompting takes precedence over GUI prompting, so explicitly
state that in the docs.

8 years agoUse more modern example keys in Pageant docs.
Jacob Nevins [Sat, 19 Mar 2016 20:04:20 +0000 (20:04 +0000)]
Use more modern example keys in Pageant docs.

8 years agoFix typo in pageant(1).
Jacob Nevins [Sat, 19 Mar 2016 22:54:51 +0000 (22:54 +0000)]
Fix typo in pageant(1).

8 years agoDocument that -i etc now accept public key files.
Jacob Nevins [Sat, 19 Mar 2016 20:24:51 +0000 (20:24 +0000)]
Document that -i etc now accept public key files.

(This was added in 4204a53.)

8 years agoFix punctuation in public key docs.
Jacob Nevins [Sat, 19 Mar 2016 19:41:31 +0000 (19:41 +0000)]
Fix punctuation in public key docs.

8 years agoFix typo in comment.
Jacob Nevins [Sat, 19 Mar 2016 19:41:53 +0000 (19:41 +0000)]
Fix typo in comment.

8 years agoAdd command-line passphrase-file options to command-line PuTTYgen.
Simon Tatham [Thu, 17 Mar 2016 18:42:46 +0000 (18:42 +0000)]
Add command-line passphrase-file options to command-line PuTTYgen.

Patch due to Colin Watson.

Putting the passphrase in a file avoids exposing it to 'ps' which can
print out every process's command line, while at the same time not
being as platform-specific as the approach of providing an fd number
(since cmdgen.c is in principle a potential cross-platform PuTTYgen,
not just a Unix one, which is why it's not in the 'unix' directory).

Of course it introduces its own risks if someone can read the file
from your disk after you delete it; probably the best approach to
avoiding this, if possible, is to point the option at a file on an
in-memory tmpfs type file system. Or better still, use bash-style
/dev/fd options such as

  puttygen --new-passphrase <(echo -n "my passphrase") [options]

Failing that, try a secure file-wipe utility, as the man page change
mentions.

(And a use case not to be overlooked, of course, is the one where you
actually want to generate an unprotected key - in which case, just
pass /dev/null as the filename.)

8 years agoNew Windows installer system, using WiX to build an MSI.
Simon Tatham [Wed, 9 Mar 2016 20:44:19 +0000 (20:44 +0000)]
New Windows installer system, using WiX to build an MSI.

Mostly this is a reaction to the reports of Inno Setup having a DLL
hijacking vulnerability. But also, the new installer has several other
nice features that our Inno Setup one didn't provide: it can put the
PuTTY install directory on PATH automatically, and it supports
completely automatic and silent install/uninstall via 'msiexec /q'
which should make it easier for sysadmins to roll out installation in
large organisations. Also, it just seems like good sense to be using
Windows's own native packaging system (or closest equivalent) rather
than going it alone.

(And on the developer side, I have to say I like the fact that WiX
lets me pass in the version number as a set of command-line #define-
equivalents, whereas for Inno Setup I had to have Buildscr apply Perl
rewriting to the source file.)

For the moment, I'm still building the old Inno Setup installer
alongside this one, but I expect to retire it once the WiX one has
survived in the wild for a while and proven itself more or less
stable.

I've found both MSI and WiX to be confusing and difficult
technologies, so this installer has some noticeable pieces missing
(e.g. retrospective reconfiguration of the installed feature set, and
per-user vs systemwide installation) simply because I couldn't get
them to work. I've commented the new installer source code heavily, in
the hope that a passing WiX expert can give me a hand!

8 years agoUse bob's new 'with' system in the build script.
Simon Tatham [Sat, 5 Mar 2016 22:23:34 +0000 (22:23 +0000)]
Use bob's new 'with' system in the build script.

Now the dust from 0.67 has settled, I can do this without getting my
git branches hopelessly confused :-)

8 years agoMerge branch 'pre-0.67'
Simon Tatham [Mon, 29 Feb 2016 19:59:59 +0000 (19:59 +0000)]
Merge branch 'pre-0.67'

8 years agoUpdate version number for 0.67 release. 0.67
Simon Tatham [Mon, 29 Feb 2016 19:59:59 +0000 (19:59 +0000)]
Update version number for 0.67 release.

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 agoRemove spurious -shareexists reference in Plink docs.
Simon Tatham [Sat, 27 Feb 2016 09:17:27 +0000 (09:17 +0000)]
Remove spurious -shareexists reference in Plink docs.

That option does exist, but only on master; it was not in the 0.66
release. It turned up by mistake when I updated the documentation copy
of the Plink online help while preparing the 0.66 release, because I
ran plink from the wrong branch.

The new release automation should stop that kind of mistake from
happening in future.

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)