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

519 Коммитов

Автор SHA1 Сообщение Дата
Jacob Nevins c90f047476 Fix handling of duplicate port forwardings; they were effectively cancelling
out, but are now just ignored.
(We should make more effort to prevent duplicates before they get as far as
ssh_setup_portfwd() -- it's currently trivially easy to enter them in the
GUI and on the command line, let alone both -- but there's bound to be someone
with a saved session containing dupes out there by now, and anyway there are
duplicates we can't detect before getting this far, for instance
"1234:localhost:22" vs "1234:localhost:ssh".)

[originally from svn r8623]
2009-08-18 23:38:48 +00:00
Simon Tatham d58d1692b8 Richard Clark points out a missing check for ssh->mainchan being NULL.
[originally from svn r8502]
2009-04-24 18:45:22 +00:00
Jacob Nevins 713df723ae Fix cosmetic keyboard-interactive issue: at the end of a normal k-i session,
some servers (Debian in particular seems prone to this) send a k-i packet with
no prompts and nothing to display. We were printing an extra "Using
keyboard-interactive authentication" message in this case. (Introduced by me
in r8172, I think.)

[originally from svn r8492]
[r8172 == 211fdb9f46]
2009-03-03 19:57:58 +00:00
Jacob Nevins 7843fb79d1 Be prepared for x11_setup_display() to return NULL (for instance, if DISPLAY
has invalid contents). Simply refuse to try X forwarding in this circumstance.

[originally from svn r8390]
2009-01-05 22:53:14 +00:00
Jacob Nevins 6b5f874552 Log reason for failure to create a connection to a local X display.
[originally from svn r8379]
2009-01-04 21:43:20 +00:00
Simon Tatham e6fee2636d At some point recently, Unix PuTTY started suffering build errors
using -DNO_GSSAPI. Move some ifdefs around so it stops.

[originally from svn r8370]
2008-12-02 18:18:32 +00:00
Ben Harris b892d451ee Jacob correctly points out that I accidentally lost a clearing of
s->gss_sndtok in r8326.  I'm not sure it was strictly necessary, since
even if there's no send token, gss_init_sec_context() is meant to explicitly
make it empty, but it wasn't an intentional change.

[originally from svn r8337]
[r8326 == 81dafd906e]
2008-11-26 14:30:58 +00:00
Ben Harris 86c183f8e8 Mitigation for VU#958563: When using a CBC-mode server-to-client cipher
under SSH-2, don't risk looking at the length field of an incoming packet
until we've successfully MAC'ed the packet.

This requires a change to the MAC mechanics so that we can calculate MACs
incrementally, and output a MAC for the packet so far while still being
able to add more data to the packet later.

[originally from svn r8334]
2008-11-26 12:49:25 +00:00
Ben Harris 81dafd906e Change how we handle the Ssh_gss_buf type. Previously, we defined it
ourselves, but on Unix then assumed it was compatible with the system's
gss_buffer_desc, which wasn't the case on LP64 systems.  Now, on Unix
we make Ssh_gss_buf into an alias for gss_buffer_desc, though we keep
something similar to the existing behaviour on Windows.  This requires
renaming a couple of the fields in Ssh_gss_buf, and hence fixing all
the references.

Tested on Linux (MIT Kerberos) and Solaris.  Compiled on NetBSD (Heimdal).
Not tested on Windows because neither mingw32 nor winegcc worked out of the
box for me.  I think the Windows changes are all syntactic, though, so
if this compiles it should work no worse than before.

[originally from svn r8326]
2008-11-24 23:44:55 +00:00
Jacob Nevins dc896b79af New option to allow use of the local OS username for login to the remote side
if we have no better ideas, with UI shamelessly stolen from Quest PuTTY.

Off by default, which effectively reverts the change to using the local
username by default that came in with GSSAPI support in r8138. Anyone wanting
seamless single sign-on will need to set the new option. (The previous
default behaviour was getting in the way in ad-hoc scenarios.)

Note that the PSCP and Unix-Plink behaviour of using the local username by
default have remained unchanged throughout; they are not affected by the new
option. Not sure if that's the Right Thing.

[originally from svn r8324]
[r8138 == de5dd9d65c]
2008-11-24 17:51:42 +00:00
Simon Tatham ca6fc3a4da Revamp of the local X11 connection code. We now parse X display
strings more rigorously, and then we look up the local X authority
data in .Xauthority _ourself_ rather than delegating to an external
xauth program. This is (negligibly) more efficient on Unix, assuming
I haven't got it wrong in some subtle way, but its major benefit is
that we can now support X authority lookups on Windows as well
provided the user points us at an appropriate X authority file in
the standard format. A new Windows-specific config option has been
added for this purpose.

[originally from svn r8305]
2008-11-17 18:38:09 +00:00
Simon Tatham 3a3abd211b In SSH packet logging mode, log SSH-2 packet sequence numbers, in
both directions. We had a bug report yesterday about a Cisco router
sending SSH2_MSG_UNIMPLEMENTED and it wasn't clear for which packet;
logging the sequence numbers should make such problems much easier
to diagnose.

(In fact this logging fix wouldn't have helped in yesterday's case,
because the router also didn't bother to fill in the sequence number
field in the SSH2_MSG_UNIMPLEMENTED packet! This is a precautionary
measure against the next one of these problems.)

[originally from svn r8295]
2008-11-11 07:47:27 +00:00
Jacob Nevins 211fdb9f46 If we got a keyboard-interactive INFO_REQUEST with an "instruction" string but
no actual prompts, we weren't displaying the former, which was wrong. We
should now (although I haven't found a server to test it against).

[originally from svn r8172]
2008-09-09 20:36:40 +00:00
Owen Dunn de5dd9d65c Initial commit of GSSAPI Kerberos support.
[originally from svn r8138]
2008-08-10 13:10:31 +00:00
Jacob Nevins d6a2f57214 Another, subtly different version string for ssh2-bug-maxpkt, from Tim Kosse.
[originally from svn r8120]
[this svn revision also touched putty-wishlist]
2008-07-18 21:39:49 +00:00
Simon Tatham e81a8cf795 Been meaning to do this for years: introduce a configuration option
to manually tweak the host name and port number under which the SSH
host key is read and written.

I've put it in the cross-platform Connection panel. Partly under the
flimsy pretext that other backends _can_ use it if they so wish (and
in fact it overrides the host name for title-bar purposes in all
network backends, though it has no other effect in anything but
SSH); but mostly because the SSH panel was too full already :-)

[originally from svn r8033]
2008-06-01 11:16:32 +00:00
Jacob Nevins 33bfb2bc72 Apparently Vista's printf-like functions don't support %n by default.
We could explicitly re-enable %n, but we only use it in one place, so take
the path of least resistance and remove that single instance. This stops
dupvprintf() getting stuck in a loop (a behaviour that's caused by a workaround
for a broken libc).

<http://msdn.microsoft.com/en-us/library/ms175782(VS.80).aspx>

[originally from svn r8030]
2008-05-31 17:22:29 +00:00
Ben Harris 1940b37ff0 Add a new bug-compatibility mode that limits the window size we'll
advertise so that the server can't exceed our maximum packet size.
Enable it for "1.36_sshlib GlobalSCAPE" which apparently sends oversize
packets otherwise.

[originally from svn r7804]
2007-12-05 00:02:06 +00:00
Ben Harris ca2b97f1d0 Replace mentions of SSH-2 I-Ds with references to the corresponding RFCs.
[originally from svn r7759]
2007-10-03 21:21:18 +00:00
Ben Harris f8e7894e15 snew() always returns non-NULL, so checking if its return value is NULL
is pointless.

[originally from svn r7758]
2007-10-03 21:06:00 +00:00
Ben Harris 4a9feea43d Factor out the increasingly complicated SSH-2 channel structure initialisation
into its own function.  Maintaining four copies was getting boring.

[originally from svn r7757]
2007-10-03 21:04:26 +00:00
Ben Harris 3c149087e4 Take the code that does flow control in SSH-1, and make it work in SSH-2
as well.  This won't be triggered in the usual case, but it's useful
if the remote end ignores our window, or if we're in "simple" mode and
setting the window far larger than is necessary.

[originally from svn r7756]
2007-10-03 20:29:27 +00:00
Ben Harris 2db59b7443 Rather than rejecting spurious SSH_MSG_CHANNEL_SUCCESSes, and ignoring
spurious SSH_MSG_CHANNEL_FAILUREs, treat them as the protocol errors
they are and forcibly disconnect.  Inspired by recent traffic on
comp.security.ssh.

[originally from svn r7752]
2007-10-01 21:11:11 +00:00
Ben Harris da5d553afc Merge the looking up of channel numbers for SSH-2 channel messages into
a single function which also handles checking that channels exist and
are properly open.  This should make PuTTY a little less tolerant of
servers that send bogus messages.

[originally from svn r7751]
2007-09-30 19:42:31 +00:00
Ben Harris 22f9618deb Add support for automatically tuning the SSH-2 window size for decent
performance.  The theory behind this is fairly simple, though the
implementation turns out to be a little trickier than it looks.

The basic idea is that when the connection isn't being limited by our ability
to process data, we want to ensure that the window size _as seen by the server_
never drops to zero.  Measuring the server's view of the window size is done
by arranging for it to acknowledge every SSH_MSG_CHANNEL_WINDOW_ADJUST, or 
rather an SSH_MSG_CHANNEL_REQUEST sent just before it.  That way we can tell
when it its outgoing data stream it received the window adjustment, and
thus how small the server's view of the window got.

At present, we only ever increase the window size.  In theory, we could
arrange to reduce it again if the server's view of it seemed to be persistently
too large, but my experiments suggest that getting this right will be tricky.

[originally from svn r7735]
2007-09-24 15:18:11 +00:00
Ben Harris 1854dcd388 Don't try SSH-1 RSA authentication unless the server has advertised support
for it.  It's possible that this obsoletes BUG_CHOKES_ON_RSA.  Certainly
the one SSH-1.5-Cisco-1.25 server I found was correctly not advertising RSA
auth.  For now, leave it in, because I'm not feeling entirely confident.

[originally from svn r7726]
2007-09-20 21:33:21 +00:00
Ben Harris 1e8a5e4796 In SSH-1, don't attempt password authentication unless the server has
announced support for it.  Instead exit with a fatal error (since password
auth is our last resort).

[originally from svn r7724]
2007-09-20 21:07:24 +00:00
Simon Tatham 4b178be3e9 ssh->mainchan can be NULL; try not to segfault in that situation.
[originally from svn r7705]
2007-09-03 19:09:56 +00:00
Ben Harris ac041a3d66 Use "int" rather than "unsigned" as the argument to ssh2_set_window, not
because it can ever be negative, but because we'll be comparing it with
another int.  This way, C's promotion rules don't bite us and we should
stand slightly more chance of coping with broken servers that overrun our
window.

[originally from svn r7683]
2007-08-06 20:56:52 +00:00
Ben Harris dd10ff5864 May as well reference an RFC rather than an Internet Draft where we can.
[originally from svn r7682]
2007-08-05 22:18:59 +00:00
Ben Harris 16cbd4f260 Small window-handling tweaks. Set the default big window to 0x7fffffff bytes,
and tweak ssh2_set_window() so it can cope with that.  Also arrange to send
a private channel message in simple mode to tell the server that it can safely
use a large window too.

[originally from svn r7679]
2007-08-05 14:18:43 +00:00
Ben Harris a3ea90c0e8 In the file-transfer applications, which only ever use the main
channel, arrange to set the SSH-2 window size to something very
large.  This prevents the connection stalling when the window fills
up, and means that PSCP receives data _much_ faster.

[originally from svn r7672]
2007-08-04 22:14:19 +00:00
Ben Harris 3dc0f8507d Tweak window handling so that we send a window adjust if the window is half
used up, rather than over half.  That this increases the throughput of PSCP
by 50% indicates just how broken our window handling is.

[originally from svn r7667]
2007-08-04 16:04:08 +00:00
Ben Harris 7cda30ac1a When omitting session data from logs, don't omit the length of the session
data string.  This isn't strictly necessary, but it makes the logs easier to
use.

[originally from svn r7666]
2007-08-04 15:48:52 +00:00
Ben Harris f48e3eb16b Tweak to window handling: Keep the local window in a signed integer, and
arrange to handle usefully the case where the server sends us more data
than it's allowed to.  There's no danger of overflow, since the maximum is
OUR_V2_WINSIZE and the minimum is -OUR_V2_MAXPKT (at least if the server is
nice).

[originally from svn r7661]
2007-08-04 14:32:06 +00:00
Ben Harris 77da96c62f Split pkt_ctx into a separate enumeration for each of kex and userauth
instead of a bitfield for both.  This doesn't gain much here, but it should
make it easier to make things other than logging use the context.

[originally from svn r7647]
2007-07-21 21:39:36 +00:00
Ben Harris c1459927df Arrange that log_packet() isn't called for raw data logging if logctx is null.
This allows us to send data in ssh_init(), albeit at the expense of its not
being properly logged, so arrange to send the version string then if that's
sensible, which should reduce the number of round-trips required to bring
up an SSH-2 connection.

[originally from svn r7646]
2007-07-21 13:43:57 +00:00
Ben Harris 22cde3ee5b Separate out the code for creating and sending SSH version strings so that in
the SSH-2-only case, we can send it as soon as we connect rather than waiting
for the server's one.  Unfortunately, actually doing so will take a little
more effort -- there are subtleties to do with having a working log context
at the right moment that need to be sorted out.

[originally from svn r7645]
2007-07-19 23:53:02 +00:00
Ben Harris 3ac841ff6f Update an outdated comment.
[originally from svn r7642]
2007-07-18 22:54:31 +00:00
Jacob Nevins 46c00b0f38 Rationalise access to, and content of, backends[] array.
Should be no significant change in behaviour.
(Well, entering usernames containing commas on Plink's command line will be
a little harder now.)

[originally from svn r7628]
2007-06-30 21:56:44 +00:00
Simon Tatham 90e7bf4228 Fix a couple of signedness compiler warnings, presumably due to me
using a different version of gcc from before.

[originally from svn r7627]
2007-06-30 18:18:20 +00:00
Simon Tatham fd26b64c74 Tong Ho points out a missing ssh_pkt_ensure().
[originally from svn r7626]
2007-06-30 18:17:12 +00:00
Simon Tatham 723d834a13 Reindent the section that was marked `XXX The lines below should be
reindented before this is committed'. Unfortunately not before it
was committed, but you can't have everything :-)

[originally from svn r7499]
2007-05-01 12:26:44 +00:00
Ben Harris dad558a1e5 Add support for RFC 4432 RSA key exchange, the patch for which has been
lying around in my home directory for _years_.

[originally from svn r7496]
2007-04-30 22:09:26 +00:00
Ben Harris 3ffd1fbe38 Use preprocessor trickery to make the signal translation mechanism a little
less hideous.  The output of the preprocessor should be basically unchanged.

[originally from svn r7294]
2007-02-17 22:33:11 +00:00
Ben Harris f69a0cf005 ssh2_set_window checks whether the channel is being closed, so there's no
need to check that before calling it.

[originally from svn r7293]
2007-02-17 22:15:57 +00:00
Ben Harris 91694cb3a2 When emitting SSH_MSG_IGNORE to protect against known-IV attacks on CBC,
remember to put an empty string in it rather than sending a completely
empty packet.  This should help with those servers (notably RomSShell)
that actually check the contents of SSH_MSG_IGNORE.

[originally from svn r7236]
2007-02-06 13:57:27 +00:00
Ben Harris 2069720687 Fix compiles on GCC 3.3, which doesn't know about assert(0);
[originally from svn r7130]
2007-01-20 20:05:46 +00:00
Simon Tatham 6716b1513e Flag user cancellation of authentication as a clean exit, so that it
will close the window even in `close window only on clean exit'
mode. Also, while I'm here, arrange a suitable exit code for
"exit-signal".

[originally from svn r7121]
2007-01-17 18:38:45 +00:00
Simon Tatham 42801b7e9e Get rid of all the MSVC warnings.
[originally from svn r7086]
2007-01-09 18:24:07 +00:00