Skip to content
Snippets Groups Projects
  1. Sep 19, 2021
  2. Jul 10, 2021
  3. Jul 03, 2021
    • Simon Tatham's avatar
      Avoid crash in MIT Kerberos for Windows on session restart. · d599e3e6
      Simon Tatham authored
      A user reports that if you have MIT KfW loaded, and your PuTTY session
      terminates without the PuTTY process exiting, and you select 'Restart
      Session' from the menu, then a crash occurs inside the Kerberos
      library itself. Scuttlebutt on the Internet suggested this might be to
      do with unloading and then reloading the DLL within the process
      lifetime, which indeed we were doing.
      
      Now we avoid doing that for the KfW library in particular, by keeping
      a tree234 of module handles marked 'never unload this'.
      
      This is a workaround at best, but it seems to stop the problem
      happening in my own tests.
      
      (cherry picked from commit 058e390a)
      d599e3e6
    • Simon Tatham's avatar
      Close all thread handles returned from CreateThread. · ea45d7dc
      Simon Tatham authored
      If you don't, they are permanently leaked. A user points out that this
      is particularly bad in Pageant, with the new named-pipe-based IPC,
      since it will spawn an input and output I/O thread per named pipe
      connection, leading to two handles being leaked every time.
      
      (cherry picked from commit c714dfc9)
      ea45d7dc
    • Simon Tatham's avatar
      Restore missing screen updates from scrollbar buttons. · 22d7888b
      Simon Tatham authored
      In commit f69cf86a, I added a call to term_update that happens
      when we receive WM_VSCROLL / SB_THUMBPOSITION in the subsidiary
      message loop that Windows creates during the handling of WM_SYSCOMMAND
      / SC_VSCROLL. The effect was that interactive dragging of the
      scrollbar now redraws the window at every step, whereas previously it
      didn't.
      
      A user just pointed out that if you click on one of the scrollbar end
      buttons and hold it down until it begins emulating key repeat, the
      same bug occurs: the window isn't redrawn until you release the mouse
      button and the subsidiary message loop ends.
      
      This commit extends the previous fix to cover all of the WM_VSCROLL
      subtypes, instead of just SB_THUMBPOSITION and SB_THUMBTRACK. Redraws
      while holding down those scrollbar buttons now work again.
      
      (cherry picked from commit 2029aa55)
      22d7888b
  4. Jun 23, 2021
    • Simon Tatham's avatar
      New option to reject 'trivial' success of userauth. · 1dc5659a
      Simon Tatham authored
      Suggested by Manfred Kaiser, who also wrote most of this patch
      (although outlying parts, like documentation and SSH-1 support, are by
      me).
      
      This is a second line of defence against the kind of spoofing attacks
      in which a malicious or compromised SSH server rushes the client
      through the userauth phase of SSH without actually requiring any auth
      inputs (passwords or signatures or whatever), and then at the start of
      the connection phase it presents something like a spoof prompt,
      intended to be taken for part of userauth by the user but in fact with
      some more sinister purpose.
      
      Our existing line of defence against this is the trust sigil system,
      and as far as I know, that's still working. This option allows a bit of
      extra defence in depth: if you don't expect your SSH server to
      trivially accept authentication in the first place, then enabling this
      option will cause PuTTY to disconnect if it unexpectedly does so,
      without the user having to spot the presence or absence of a fiddly
      little sigil anywhere.
      
      Several types of authentication count as 'trivial'. The obvious one is
      the SSH-2 "none" method, which clients always try first so that the
      failure message will tell them what else they can try, and which a
      server can instead accept in order to authenticate you unconditionally.
      But there are two other ways to do it that we know of: one is to run
      keyboard-interactive authentication and send an empty INFO_REQUEST
      packet containing no actual prompts for the user, and another even
      weirder one is to send USERAUTH_SUCCESS in response to the user's
      preliminary *offer* of a public key (instead of sending the usual PK_OK
      to request an actual signature from the key).
      
      This new option detects all of those, by clearing the 'is_trivial_auth'
      flag only when we send some kind of substantive authentication response
      (be it a password, a k-i prompt response, a signature, or a GSSAPI
      token). So even if there's a further path through the userauth maze we
      haven't spotted, that somehow avoids sending anything substantive, this
      strategy should still pick it up.
      
      (cherry picked from commit 5f5c710c)
      1dc5659a
  5. Jun 13, 2021
  6. Jun 12, 2021
    • Simon Tatham's avatar
      Fix Arm crypto build failure on clang post-12. · 8f3a0ea6
      Simon Tatham authored
      I had manually defined the ACLE feature macro __ARM_FEATURE_CRYPTO
      before including arm_neon.h, in the expectation that it would turn on
      the AES, SHA-1 and SHA-256 intrinsics. But up-to-date clang has now
      separated those intrinsics from each other, and guarded them by two
      more specific feature macros, one for AES and one for the two SHAs. So
      just defining __ARM_FEATURE_CRYPTO isn't good enough any more, and my
      attempts to use crypto intrinsics in the following functions provoke a
      compile error.
      
      The fix is to define the appropriate new feature macro by hand
      (leaving the old definition in place for earlier clang versions).
      
      This fix is only needed on the release branch, of course: on main,
      we've already done the reorganisation that avoids the need to manually
      define ACLE feature macros at all, because the accelerated crypto code
      is compiled in separate objects using command-line compile flags in
      the way that the toolchain normally expects.
      8f3a0ea6
    • Simon Tatham's avatar
      Fix tight loop on reading truncated key files. · fd3f05d2
      Simon Tatham authored
      In commit 9cc586e6 I changed the low-level key-file reading
      routines like read_header and read_body so that they read from a
      BinarySource via get_byte(), rather than from a FILE * via fgetc. But
      I forgot that the two functions don't signal end-of-file the same way,
      so testing the return value of get_byte() against EOF is pointless and
      will never match, and conversely, real EOF won't be spotted unless you
      also examine the error indicator in the BinarySource.
      
      As a result, a key file that ends without a trailing newline will
      cause a tight loop in one of those low-level read routines.
      
      (cherry picked from commit d008d235)
      fd3f05d2
    • Jacob Nevins's avatar
      Fix changing colours in Change Settings. · ff53c671
      Jacob Nevins authored
      Since ca9cd983, changing colour config mid-session had no effect
      (until the palette was reset for some other reason). Now it does take
      effect immediately (provided that the palette has not been overridden by
      escape sequence -- this is new with ca9cd983).
      
      This changes the semantics of palette_reset(): the only important
      parameter when doing that is whether we keep escape sequence overrides
      -- there's no harm in re-fetching config and platform colours whether or
      not they've changed -- so that's what the parameter becomes (with a
      sense that doesn't require changing the call sites). The other part of
      this change is actually remembering to trigger this when the
      configuration is changed.
      
      (cherry picked from commit 1e726c94)
      ff53c671
    • Simon Tatham's avatar
      cmdgen: add missing null pointer check in --dump mode. · 27a04d96
      Simon Tatham authored
      A user pointed out that once we've identified the key algorithm from
      an apparent public-key blob, we call ssh_key_new_pub on the blob data
      and assume it will succeed. But there are plenty of ways it could
      still fail, and ssh_key_new_pub could return NULL.
      
      (cherry picked from commit 0c21eb44)
      27a04d96
    • Simon Tatham's avatar
      Close agent named-pipe handles when queries complete. · 11b89407
      Simon Tatham authored
      I was cleaning up the 'struct handle', but not the underlying HANDLE.
      As a result, any PuTTY process that makes a request to Pageant keeps
      the named pipe connection open until the end of the process's
      lifetime.
      
      (cherry picked from commit 6e69223d)
      11b89407
    • Simon Tatham's avatar
      Fix confusion between invalid Windows HANDLE values. · 6976bf60
      Simon Tatham authored
      I was checking a HANDLE against INVALID_HANDLE_VALUE to decide whether
      it should be closed. But ten lines further up, I was setting it
      manually to NULL to suppress the close. Oops.
      
      (cherry picked from commit 155d8121)
      6976bf60
    • Simon Tatham's avatar
      Reinstate missing bit counts in Windows Pageant GUI. · bf67ce44
      Simon Tatham authored
      An embarrassing braino of && for || produced a boolean expression that
      could never evaluate true.
      
      (cherry picked from commit 8245510a)
      bf67ce44
    • Simon Tatham's avatar
      Make TermWin's palette_get_overrides() take a Terminal *. · 329bdb34
      Simon Tatham authored
      Less than 12 hours after 0.75 went out of the door, a user pointed out
      that enabling the 'Use system colours' config option causes an
      immediate NULL-dereference crash. The reason is because a chain of
      calls from term_init() ends up calling back to the Windows
      implementation of the palette_get_overrides() method, which responds
      by trying to call functions on the static variable 'term' in window.c,
      which won't be initialised until term_init() has returned.
      
      Simple fix: palette_get_overrides() is now given a pointer to the
      Terminal that it should be updating, because it can't find it out any
      other way.
      
      (cherry picked from commit 571fa338)
      329bdb34
  7. May 02, 2021
    • Simon Tatham's avatar
    • Simon Tatham's avatar
      Docs updates. · f4d99d3f
      Simon Tatham authored
      Since the previous commit is causing an RC2 build of 0.75 anyway,
      let's take the opportunity to bring in updates to the docs from main,
      so that the release will have the most up-to-date version available.
      
      This is a combined cherry-pick of:
        f6142ba2
        7c1bea59
        f5d1d4ce
      f4d99d3f
    • Simon Tatham's avatar
      Fix accidental change to connshare pipe naming. · fdfad6ad
      Simon Tatham authored
      Jacob spots that on Windows, current PuTTY is not compatible with
      0.74, if one of them acts as a connection sharing upstream and the
      other as a downstream. That's because commit 1344d4d1
      accidentally changed the hash preimage in capi_obfuscate_string() so
      that it no longer had an SSH-like string length field at the front. So
      the two versions of PuTTY will expect the named pipe to have a
      different pathname, and so they won't be able to find each other.
      
      Interoperation between PuTTY versions is not the most important use
      case of connection sharing - surely the typical user will invoke it by
      activating the same session twice, or by using Duplicate Session. But
      it was never intended to deliberately _not_ work, so let's fix it
      before 0.75 goes out, so that at least the incompatible behaviour will
      only ever have appeared in development snapshots.
      fdfad6ad
  8. Apr 27, 2021
    • Simon Tatham's avatar
      Remove -Werror from all the default cflags. · f3ee4dbe
      Simon Tatham authored
      I've recently been coming round in general to the idea that -Werror is
      fine for developers and centralised binary builds, but has too many
      unanticipated failure modes in the field (with everyone's different
      versions of compilers, headers etc) to leave turned on for the 'just
      download and build' source tarball that's supposed to work everywhere.
      On main, I've already made the change to hide it behind a cmake
      'strict' setting.
      
      In particular, I've just done pre-release build tests with various
      versions of GTK, which reminded me that the GTK 2 installation on
      Ubuntu 20.04 fails to build at -Werror, because GTK's own header files
      have a warning-generating inconsistency. (glib/gtypes.h declares
      GTimeVal as deprecated, and then gtk/gtktooltips.h uses it anyway.)
      Clearly this is the kind of thing that ought not to break the build of
      a client application!
      f3ee4dbe
  9. Apr 25, 2021
    • Simon Tatham's avatar
      Fix named_pipe_agent_exists(), which just didn't work. · 17371e0d
      Simon Tatham authored
      GetFileType() takes a HANDLE, not a pathname. So passing it the
      pathname of the agent named pipe would never have worked at all.
      
      I hadn't noticed, because the only call to that function logical-ORs
      its return value with that of wm_copydata_agent_exists(), and the
      latter _does_ work.
      
      So if you're running true Pageant, which presents both IPC interfaces,
      then there's no problem. But if a Pageant-emulating system wanted to
      present only the named-pipe version, then we wouldn't have detected
      it. Now we should do.
      17371e0d
  10. Apr 24, 2021
    • Simon Tatham's avatar
      Windows: reinstate redraws during interactive scrollbar drag. · f69cf86a
      Simon Tatham authored
      I just discovered that they weren't happening, and the reason why is
      thoroughly annoying. Details are in the long comment I've added to the
      WM_VSCROLL handler in WndProc, but the short version is that when you
      interactively drag the terminal window's scrollbar, a subsidiary
      message loop is launched by DefWndProc, causing all our timer events
      to go missing until the user lets go of the scrollbar again. So we
      have to manually update the terminal window on scroll events, because
      the normal system is out of action.
      
      I assume this changed behaviour round about the big rework of terminal
      updating in February. Good job I spotted it just _before_ 0.75, and
      not just after!
      f69cf86a
    • Simon Tatham's avatar
      Add the psusan man page to the installed list. · 8c7685c6
      Simon Tatham authored
      Previously, 'make install' would install psusan itself in .../bin, but
      not install psusan.1 in .../share/man/man1. That's not a sensible
      combination. Either it's a test utility so we should install neither,
      or it's a fully supported official utility so we should install both.
      
      It's the latter. Man page is now installed, along with the binary.
      8c7685c6
  11. Apr 23, 2021
    • Simon Tatham's avatar
      Add WSL as another use case for psusan. · 1a017285
      Simon Tatham authored
      I've just spent the afternoon playing with it (rather belatedly - this
      is the first time I've tried it out since it was first announced!),
      and quickly decided that on the one hand it looks quite useful, but on
      the other hand, running it in a Windows console is not for me and I'd
      prefer to talk to it via PuTTY and psusan, for nicer copy-paste
      controls and the ability to forward Pageant into it.
      
      That turns out to be very easy and (I think) useful, so in it goes as
      another psusan use case.
      1a017285
  12. Apr 22, 2021
    • Jacob Nevins's avatar
      winpgnt: remove Help button when help unavailable. · b6d98b4f
      Jacob Nevins authored
      As we do in other similar situations. (The resulting passphrase dialog
      is annoyingly unsymmetric, but probably less annoying than a Help
      button which does nothing, and the situation shouldn't arise with our
      standard builds.)
      b6d98b4f
    • Simon Tatham's avatar
      winpgnt: add a help button to async passphrase prompt. · f5a962fb
      Simon Tatham authored
      Suggested by Jacob: if this dialog box is going to pop up
      _unexpectedly_ - perhaps when people have momentarily forgotten
      they're even running Pageant, or at least forgotten they added a key
      encrypted,, or maybe haven't found out yet that their IT installed it
      - then it could usefully come with a help button that pops up further
      explanation of what the dialog box means, and from which you can find
      your way to the rest of the help.
      f5a962fb
    • Simon Tatham's avatar
      winpgnt: say 'click to focus' in async passphrase prompt. · 16a59b59
      Simon Tatham authored
      I continue to believe that there's nothing I can (or should) do about
      the fact that on Windows, Pageant's async passphrase prompt dialog box
      doesn't automatically get the input focus when it pops up in response
      to a request received via invisible IPC.
      
      However, one thing I can do is add some text to the box that _warns_
      people about it, so that at least there's some kind of suggestion that
      you should get into the habit of clicking on the passphrase prompt
      before typing your passphrase into it.
      
      (I would be less concerned about all of this if it weren't for the
      fact that focus is surprisingly non-obvious on Windows 10, at least on
      the machine I have here. When the window doesn't have focus, the title
      bar has the same background colour, and only the text is fainter. And
      perhaps more confusingly, the cursor in the edit box still flashes!
      That fooled _me_ a few times to begin with.)
      16a59b59
  13. Apr 21, 2021
  14. Apr 20, 2021
  15. Apr 19, 2021
    • Jacob Nevins's avatar
      PuTTYgen: use the term "passphrase hash". · 5dd9d839
      Jacob Nevins authored
      PuTTYgen and its documentation are pretty consistent about calling their
      encryption key a 'passphrase', as opposed to a 'password' supplied
      directly to a server; but the Argon2 parameters UI reverted to
      'password hash', which seemed unecessarily confusing.
      
      I think it's better to use the term 'passphrase' consistently in the UI.
      (People who are used to Argon2 being called a 'password hash' can
      probably deal.)
      
      This required tweaking the coordinates of the Windows PuTTYgen UI.
      5dd9d839
    • Jacob Nevins's avatar
      PuTTYgen: explicitly use 'Kbyte' in Argon2 naming. · 97137f5c
      Jacob Nevins authored
      Instead of 'Kb', which could be misread as 'Kbit'.
      97137f5c
Loading