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

389 Коммитов

Автор SHA1 Сообщение Дата
Jacob Nevins 4e7a72310f ssh_setup_portfwd() should usually be looking at the new cfg, not the old
one, so that changes to port visibility are honoured in new forwardings.

[originally from svn r5282]
2005-02-10 01:03:08 +00:00
Jacob Nevins 7ffad81d31 Slightly gratuitous logeventf() crusade and purge of fixed-length buffers.
Also a bonus sfree().

[originally from svn r5281]
2005-02-10 00:16:59 +00:00
Owen Dunn 71e3ce0498 Make a few things static
[originally from svn r5212]
2005-01-26 18:11:28 +00:00
Ben Harris 11bc6185ec Don't abuse a remote channel number of (unsigned)(-1) to indicate a channel
for which we don't yet have a remote number, and instead add a flag to indicate
this fact.  Fixes bug ssh-remoteid-minusone.

[originally from svn r5171]
2005-01-22 16:06:21 +00:00
Ben Harris 5140b67435 Probable support for first_kex_packet_follows in KEXINIT. Not significantly
tested since none of the common key-exchange protocols starts with a packet
from the server, so I don't have a server that implements this.

[originally from svn r5162]
2005-01-22 13:32:41 +00:00
Ben Harris f1a22fb3cb While we're here, pad USERAUTH_INFO_RESPONSEs to 256 bytes too.
[originally from svn r5145]
2005-01-19 17:41:21 +00:00
Ben Harris e94042612f Make the outgoing SSH2 sequence number unsigned, so as to avoid depending
on overflow behaviour of signed integers.

[originally from svn r5142]
2005-01-19 12:34:52 +00:00
Owen Dunn 9318800643 Yes we do mean assignment. Bah.
[originally from svn r5135]
2005-01-18 19:09:02 +00:00
Owen Dunn 7e19075103 ssh_pkt_getstring wants a boring int rather than an unsigned int. Let's
give it one.

[originally from svn r5129]
2005-01-18 09:38:58 +00:00
Owen Dunn 8bd1aacec0 Change some function arguments to void * to placate picky compilers.
[originally from svn r5124]
2005-01-17 10:07:13 +00:00
Ben Harris 8a20515844 In SSH2, rather than sending an SSH_MSG_IGNORE after every password, just
pad the packet out to 256 bytes.  Much simpler.

This leavs ssh2_pkt_defer() unused, so ifdef it out.

[originally from svn r5122]
2005-01-17 00:50:35 +00:00
Ben Harris 214e11a7fe Be a little less enthusiastic about sending SSH_MSG_CHANNEL_WINDOW_ADJUST:
only send it when it will significantly increase the server's idea of our
window.  This avoids the slew of one-byte WINDOW_ADJUSTs that an interactive
shell typically generates.

[originally from svn r5121]
2005-01-16 14:43:12 +00:00
Simon Tatham f70efc5cc6 Support for falling back through the list of addresses returned from
a DNS lookup, whether they're IPv4, v6 or a mixture of both.

[originally from svn r5119]
[this svn revision also touched putty-wishlist]
2005-01-16 14:29:34 +00:00
Ben Harris 0f754aac82 Make our SSH2 maximum packet size into a constant, since it's used in several
places.

[originally from svn r5118]
2005-01-16 14:14:59 +00:00
Simon Tatham f3b5bddd32 Fix `disconnect': arrange that we keep track of when we're expecting
to see the server slam the TCP connection shut (i.e. almost never,
unless it's just sent us an SSH_MSG_DISCONNECT), and treat an
unexpected closure as a non-clean session termination. Previously
any server-initiated connection closure was being treated as a clean
exit, which was a hangover from the good old Telnet-only days.

[originally from svn r5098]
[this svn revision also touched putty-wishlist]
2005-01-11 19:33:41 +00:00
Ben Harris 95368801d3 Versions of OpenSSH before 2.5.4 kill the connection if the client attempts
to rekey.  Extend the description of SSH2_BUG_REKEY to cover this situation
and apply it to the relevant OpenSSH versions.

[originally from svn r5097]
2005-01-11 16:33:08 +00:00
Simon Tatham d5de8eacab Bah, I left a rogue event log entry lying around.
[originally from svn r5095]
2005-01-11 15:33:35 +00:00
Ben Harris a16d64ee49 Sun_SSH_1.0.1 also has BUG_SSH2_REKEY.
[originally from svn r5094]
2005-01-11 13:24:47 +00:00
Simon Tatham e7b53c3ad5 Servers announcing themselves as `Sun_SSH_1.0' apparently cannot
deal with rekeys at all: they totally ignore mid-session KEXINIT
sent by the client. Hence, a new bug entry so we don't try it.

[originally from svn r5092]
2005-01-11 10:37:55 +00:00
Simon Tatham d72eb8f6db Clear the kex-specific context in ssh->pkt_ctx for every new key
exchange. Without doing this, after we have done one specific-group
DH exchange (group1 or group14), ssh2_pkt_type _always_ translates
30 and 31 as KEXDH_INIT and KEXDH_REPLY, making a subsequent
group-exchange kex look rather strange in an SSH packet log.

[originally from svn r5081]
2005-01-08 13:28:41 +00:00
Jacob Nevins 550f7b37cb Simon points out that r5068 broke keyboard-interactive with multiple
INFO_REQUESTs, and for some reason Debian OpenSSH is sending INFO_REQUESTs
containing no prompts after a normal password authentication, so this
should fix Shai's problem.

[originally from svn r5078]
[r5068 == 297ee2573e]
[this svn revision also touched putty-wishlist]
2005-01-07 16:55:45 +00:00
Simon Tatham 88c52fa85f Use sk_set_frozen() to ensure that no data will be accepted from an
SSH connection when we're in the middle of asking the user a
dialog-box-type question. Fixes `unix-kex-packet', which has just
bitten me when connecting to one of the work Suns.

[originally from svn r5071]
[this svn revision also touched putty-wishlist]
2005-01-07 09:24:24 +00:00
Jacob Nevins 4e550f96b2 Add an explicit message about lack of support for PASSWD_CHANGEREQ in a
half-hearted attempt to flush out any uses of it.

[originally from svn r5070]
2005-01-06 17:05:54 +00:00
Jacob Nevins 297ee2573e `kbdint-failure': we now offer keyboard-interactive auth to the user for as
long as the server offers it, rather than only once, unless the server responds
to our initial USERAUTH_REQUEST("keyboard-interactive") with FAILURE, in which
case we give up on it entirely.

[originally from svn r5068]
[this svn revision also touched putty-wishlist]
2005-01-06 13:23:47 +00:00
Simon Tatham f5c90091bb Allow reconfiguration of compression and cipher settings in
mid-session in SSH2: this forces an immediate rekey to activate the
new settings. I'm not sure exactly what this will be useful for
(except possibly it might make comparative performance testing
easier?), but it has wonderful James Bond value for being able to
switch to a more secure cipher before doing anything sensitive :-)
If, that is, you weren't using the most secure one to begin with...

[originally from svn r5051]
2004-12-31 10:51:14 +00:00
Simon Tatham 44239efc6b Reinstate the textual service name in port forwarding Event Log
messages where specified. (I had removed this in the previous
revision through forgetfulness.)

[originally from svn r5050]
2004-12-30 17:53:26 +00:00
Simon Tatham d006b68c5e Jacob points out that when we reconfigure port forwarding, we ought
to be destroying old ones _before_ creating new ones, so that we can
reuse a port for a new purpose without colliding with ourselves.

Also fixed port forwarding, which my IPv6 checkin had completely
funted :-)

[originally from svn r5049]
2004-12-30 17:48:35 +00:00
Simon Tatham 6daf6faede Integrate unfix.org's IPv6 patches up to level 10, with rather a lot
of polishing to bring them to what I think should in principle be
release quality. Unlike the unfix.org patches themselves, this
checkin enables IPv6 by default; if you want to leave it out, you
have to build with COMPAT=-DNO_IPV6.

I have tested that this compiles on Visual C 7 (so the nightlies
_should_ acquire IPv6 support without missing a beat), but since I
don't have IPv6 set up myself I haven't actually tested that it
_works_. It still seems to make correct IPv4 connections, but that's
all I've been able to verify for myself. Further testing is needed.

[originally from svn r5047]
[this svn revision also touched putty-wishlist]
2004-12-30 16:45:11 +00:00
Simon Tatham 7573f3733f Stray // comments.
[originally from svn r5046]
2004-12-30 15:29:38 +00:00
Simon Tatham b0bf176dfb Loose end from r5031: the Kex panel should only be displayed in
mid-session if we are not using SSHv1. I've done this by introducing
a generic `cfg_info' function which every back end can use to
communicate an int's worth of data to setup_config_box; in SSH
that's the protocol version in use, and in everything else it's
currently zero.

[originally from svn r5040]
[r5031 == d77102a8d5]
2004-12-29 12:32:25 +00:00
Simon Tatham 6120d91507 The latest unfix.org IPv6 patch contains these apparently
IPv6-unrelated changes, which convert ints into unsigned in a few
key places in ssh.c. Looks harmless at worst, possibly terribly
useful, so I think we'll have these no matter what the real IPv6
stuff is up to!

[originally from svn r5038]
2004-12-28 17:12:20 +00:00
Simon Tatham 11655820ca Forgot to initialise ssh->portfwds to NULL. Unusually, this was
pointed out by the MSVC debugger, not by valgrind :-)

[originally from svn r5034]
2004-12-28 16:18:17 +00:00
Simon Tatham d77102a8d5 Support reconfiguration of key exchange in mid-session. The fiddly
bit is working out when to reschedule the next rekey for when the
timeout or data limit changes; sometimes it will be _right now_
because we're already over the new limit.

Still to do: the Kex panel should not appear in mid-session if we
are using SSHv1.

[originally from svn r5031]
2004-12-28 14:10:32 +00:00
Simon Tatham 81df0d4253 SSH port forwarding is now configurable in mid-session. After doing
Change Settings, the port forwarding setup function is run again,
and tags all existing port forwardings as `do not keep'. Then it
iterates through the config in the normal way; when it encounters a
port forwarding which is already in the tree, it tags it `keep'
rather than setting it up from scratch. Finally, it goes through the
tree and removes any that haven't been labelled `keep'. Hence,
editing the list of forwardings in Change Settings has the effect of
cancelling any forwardings you remove, and adding any new ones.

The SSH panel now appears in the reconfig box, and is empty apart
from a message explaining that it has to be there for subpanels of
it to exist. Better wording for this message would be welcome.

[originally from svn r5030]
2004-12-28 14:07:05 +00:00
Simon Tatham 67f93aa30e Abstracted out the rather large port-forwarding setup code into a
routine which is common between SSH1 and SSH2. Since this routine is
not part of the coroutine system, this means it can't sit and wait
to get its various success/failure responses back. Hence, I've
introduced a system of queued packet handlers, each of which waits
for exactly one of a pair of messages (SSH1_SMSG_{SUCCESS,FAILURE}
or SSH2_MSG_REQUEST_{SUCCESS,FAILURE}), handles it when it arrives,
and automatically de-registers itself. Hence the port-forwarding
setup code can be called once, and then subsequent packets related
to it will automatically be handled as they arrive.

The real purpose of all this is that the infrastructure is now there
for me to arrange mid-session configurability of port forwarding.
However, a side benefit is that fewer round trips are involved in
session startup. I'd quite like to move more of the connection setup
(X forwarding, agent forwarding, pty allocation etc) to using the
new queued handler mechanism for this reason.

[originally from svn r5029]
2004-12-28 14:04:58 +00:00
Jacob Nevins 30896d650e Basic configurability for client-initiated rekeys.
[originally from svn r5027]
2004-12-24 13:39:32 +00:00
Jacob Nevins d0da973746 Don't offer repeat key exchange as a special command in SSH-1.
[originally from svn r5026]
2004-12-24 10:04:28 +00:00
Jacob Nevins 3c98d6e60d Add a preference list for SSH-2 key exchange algorithms, on a new "Kex" panel
(which will gain more content anon).

Retire BUG_SSH2_DH_GEX and add a backwards-compatibility wart, since we never
did find a way of automatically detecting this alleged server bug, and in any
case there was only ever one report (<3D91F3B5.7030309@inwind.it>, FWIW).

Also generalise askcipher() to a new askalg() (thus touching all the
front-ends).

I've made some attempt to document what SSH key exchange is and why you care,
but it could use some review for clarity (and outright lies).

[originally from svn r5022]
2004-12-23 02:24:07 +00:00
Simon Tatham 56d5dc7eec Support diffie-hellman-group14-sha1 group exchange. Tested against
locally built OpenSSH 3.9, and seems to work fine.

[originally from svn r5018]
2004-12-22 10:53:58 +00:00
Simon Tatham d67bc798aa Fix obviously stupid segfault. Ahem.
[originally from svn r4989]
2004-12-16 15:38:39 +00:00
Jacob Nevins d46ebde528 NULL a couple of members after freeing them in ssh_free(). In particular,
should stop ssh_do_close() accessing freed ssh->channels when invoked later
from ssh_free(). Spotted by Fred Sauer.

(Perhaps this is the cause of the crashes people have been reporting on
abnormal closures such as `Software caused connection abort'? I've not been
able to test this.)

[originally from svn r4946]
2004-12-02 13:37:28 +00:00
Simon Tatham 9731b1425d Bah. Ben points out that SSH_1_ version strings should still end in
\n, and also that `\r' and `\n' don't mean what I think they mean on
all compilers (Mac reverses them).

[originally from svn r4941]
2004-12-01 15:34:12 +00:00
Simon Tatham 4c31b113a6 And now I look at it, the latest draft also says version strings
should be followed by \r\n, not just \n.

[originally from svn r4940]
2004-12-01 13:42:50 +00:00
Simon Tatham 22c46786be Kimmo Parviainen points out that SSH software version strings have
restrictions on the use of hyphens and spaces.

[originally from svn r4939]
2004-12-01 13:37:31 +00:00
Jacob Nevins d0992ade3d typo in comment
[originally from svn r4923]
2004-11-29 09:27:13 +00:00
Simon Tatham 8c69ba0672 Loose end from timing shakeup: sshrand.c is now a client of
timing.c, and hence takes its own responsibility for calling
noise_regular() at regular intervals. Again, this means it will be
called consistently in _all_ the SSH-speaking tools, not just those
in which I remembered to call it!

[originally from svn r4913]
2004-11-27 19:56:38 +00:00
Simon Tatham 02b0474f57 Almost _all_ of the final connection-layer loop, in both SSH1 and
SSH2, is now handled by the packet dispatch table. Dispatch table
entries are enabled as soon as possible, so that if anyone tries to
(for example) start using a forwarded port before the main shell
session setup has finished, things should work sensibly.

The SSH code is now a hybrid of coroutine-based sequential logic and
table-driven event dispatch, each where it makes the most sense. I'm
rather pleased with it.

Should fix: ext-data-at-start, portfwd-at-start.

[originally from svn r4909]
[this svn revision also touched putty-wishlist]
2004-11-27 15:32:45 +00:00
Simon Tatham 812870d1b3 Implement client-initiated rekeys after an hour, or after 1Gb of
data transfer in either direction (whichever comes first), or at
explicit client request (nice idea Jacob). Have tested by lowering
the limits, and it all seems solid enough; in particular, this has
also allowed me to test the behaviour when connection-level data is
received during rekey, and that looks fine too (at least it does
_now_ :-).

[originally from svn r4908]
[this svn revision also touched putty-wishlist]
2004-11-27 14:29:20 +00:00
Simon Tatham 7ecf13564a New timing infrastructure. There's a new function schedule_timer()
which pretty much any module can call to request a call-back in the
future. So terminal.c can do its own handling of blinking, visual
bells and deferred screen updates, without having to rely on
term_update() being called 50 times a second (fixes: pterm-timer);
and ssh.c and telnet.c both invoke a new module pinger.c which takes
care of sending keepalives, so they get sent uniformly in all front
ends (fixes: plink-keepalives, unix-keepalives).

[originally from svn r4906]
[this svn revision also touched putty-wishlist]
2004-11-27 13:20:21 +00:00
Simon Tatham a4ba026838 Re-architected the top level of the SSH protocol handlers.
ssh1_protocol() and ssh2_protocol() are now high-level functions
which see _every_ SSH packet and decide which lower-level function
to pass it to. Also, they each support a dispatch table of simple
handler functions for message types which can arrive at any time.
Results are:

 - ignore, debug and disconnect messages are now handled by the
   dispatch table rather than being warts in the rdpkt functions

 - SSH2_MSG_WINDOW_ADJUST is handled by the dispatch table, which
   means that do_ssh2_authconn doesn't have to explicitly
   special-case it absolutely every time it waits for a response to
   its latest channel request

 - the top-level SSH2 protocol function chooses whether messages get
   funnelled to the transport layer or the auth/conn layer based on
   the message number ranges defined in the SSH architecture draft -
   so things that should go to auth/conn go there even in the middle
   of a rekey (although a special case is that nothing goes to
   auth/conn until initial kex has finished). This should fix the
   other half of ssh2-kex-data.

[originally from svn r4901]
2004-11-24 20:35:15 +00:00