1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 18:07:59 +00:00
Commit Graph

912 Commits

Author SHA1 Message Date
Simon Tatham
631b494807 New command-line option in Plink (and PuTTY, though it's less useful
there): `plink host -nc host2:port' causes the SSH connection's main
channel to be replaced with a direct-tcpip connection to the
specified destination. This feature is mainly designed for use as a
local proxy: setting your local proxy command to `plink %proxyhost
-nc %host:%port' lets you tunnel SSH over SSH with a minimum of
fuss. Works on all platforms.

[originally from svn r6823]
2006-08-28 15:12:37 +00:00
Simon Tatham
c353c3cc97 The `socket' function in the backends is only ever checked to see if
it's NULL. Since we already have one back end (uxpty) which doesn't
in fact talk to a network socket, and may well have more soon, I'm
replacing this TCP/IP-centric function with a nice neutral
`connected' function returning a boolean. Nothing else about its
semantics has currently changed.

[originally from svn r6810]
2006-08-27 08:03:19 +00:00
Simon Tatham
2d633388a1 Return a non-zero exit code in the event of a fatal-error SSH
session termination. `Close window only on clean exit' was not
working properly on Unix in the absence of this:
notify_remote_exit() was being called and ssh_return_exitcode was
returning zero, causing gtk_main_quit() to be called, _before_
connection_fatal() happened.

[originally from svn r6801]
2006-08-26 09:21:52 +00:00
Jacob Nevins
7958a63147 Sprinkle some header comments in various files in an attempt to explain what
they're for.

[originally from svn r6639]
2006-04-23 18:26:03 +00:00
Jacob Nevins
078c516a45 Dimitry Andric spotted that DH gex with SHA-256 was overflowing a buffer.
Fixed, and added paranoia so that this shouldn't happen again.

[originally from svn r6606]
[this svn revision also touched putty-wishlist]
2006-03-12 19:24:05 +00:00
Jacob Nevins
2cf27e43bb Log the hash used for DH kex (now there's a choice).
[originally from svn r6605]
2006-03-12 15:39:19 +00:00
Simon Tatham
fdee25e1f6 Daniel Meidlinger points out a redundant test :-)
[originally from svn r6579]
2006-02-19 22:37:31 +00:00
Simon Tatham
c2b2d9c539 Introduce a new checkbox and command-line option to inhibit use of
Pageant for local authentication. (This is a `don't use Pageant for
authentication at session startup' button rather than a `pretend
Pageant doesn't exist' button: that is, agent forwarding is
independent of this option.)

[originally from svn r6572]
2006-02-19 12:05:12 +00:00
Jacob Nevins
5d5abbf8d4 Apparently some SSH servers object to our claiming port-forwarded connections
to be from IP "client-side-connection". Claiming "0.0.0.0" instead seems to
work. Spotted by Brant Thomsen.

[originally from svn r6477]
[this svn revision also touched putty-wishlist]
2005-12-07 18:01:40 +00:00
Jacob Nevins
de945281fc r6437 broke the case where Pageant is running but contains no SSH-2 keys
that the SSH-2 server is happy with. Fixed, and since I'm here, fix
`pubkeyfile-and-pageant' as well (for SSH-1 and SSH-2).
Also, in SSH-2, we now reexamine "methods that can continue" for every
Pageant key offer, which is technically more correct although it seems
unlikely that it was causing any real problems.
(It's not entirely pretty, but neither was the old code. We could probably
do with some sort of abstraction for public/private keys to avoid carting
lots of fiddly bits of data around.)

[originally from svn r6459]
[r6437 == 8719f92c14]
[this svn revision also touched putty-wishlist]
2005-11-13 16:06:41 +00:00
Jacob Nevins
c4b2b493ff I broke the ability to cope with multiple consecutive k-i INFO_REQUESTS
in r6437. This ought to be better (but I can't test that case).

[originally from svn r6451]
[r6437 == 8719f92c14]
2005-11-09 23:19:33 +00:00
Jacob Nevins
29f1ae8a7e Fix minor hiccup in SSH-1 p-k auth.
[originally from svn r6447]
2005-11-04 23:31:11 +00:00
Jacob Nevins
4496d752a9 Placate a compiler warning introduced in r6437.
(I forgot we usually compile with -Werror on Unix, oops.)

[originally from svn r6446]
[r6437 == 8719f92c14]
2005-11-04 23:21:42 +00:00
Jacob Nevins
041e93f508 Fix for `ssh2-password-expiry'. Success case tested.
(Much easier since r6437, and actually works to boot.)

[originally from svn r6445]
[r6437 == 8719f92c14]
[this svn revision also touched putty-wishlist]
2005-11-04 14:49:22 +00:00
Jacob Nevins
6724e01956 (do_ssh2_authconn_state).method is redundant since r6437; remove.
Remove FIXMEs from .type assignments, as they look fine.

[originally from svn r6442]
[r6437 == 8719f92c14]
2005-10-31 22:43:51 +00:00
Jacob Nevins
8719f92c14 Revamp SSH authentication code so that user interaction is more
abstracted out; replace loops structured around a single interaction
per loop with less tortuous code (fixes: `ki-multiprompt-crash',
`ssh1-bad-passphrase-crash'; makes `ssh2-password-expiry' and
`proxy-password-prompt' easier).

The new interaction abstraction has a lot of fields that are unused in
the current code (things like window captions); this is groundwork for
`gui-auth'. However, ssh.c still writes directly to stderr; that may
want to be fixed.

In the GUI apps, user interaction is moved to terminal.c. This should
make it easier to fix things like UTF-8 username entry, although I
haven't attempted to do so. Also, control character filtering can be
tailored to be appropriate for individual front-ends; so far I don't
promise anything other than not having made it any worse.

I've tried to test this fairly exhaustively (although Mac stuff is
untested, as usual). It all seems to basically work, but I bet there
are new bugs. (One I know about is that you can no longer make the
PuTTY window go away with a ^D at the password prompt; this should be
fixed.)

[originally from svn r6437]
[this svn revision also touched putty-wishlist]
2005-10-30 20:24:09 +00:00
Jacob Nevins
c14f259ba2 Allow rsakey_pubblob() to return the key comment.
(like r6433 but for SSH-1)

[originally from svn r6434]
[r6433 == 49d2cf19ac]
2005-10-30 15:16:42 +00:00
Jacob Nevins
49d2cf19ac Add ability for ssh2_userkey_loadpub() to return the key comment.
(Not actually used currently, but it makes life easier for a patch I'm
working on.)

[originally from svn r6433]
2005-10-30 13:42:36 +00:00
Jacob Nevins
69ac38c1a8 Fix an error I introduced into SSH packet logging in r5642: some outgoing
packets over about 256 bytes would be logged with 12 bytes of preceding
garbage. (But the rest of the packet was logged in its entirety. This
holds for packets where (int(len/256)%2)==1, with an appropriate fudge
factor applied to `len'.) Ahem.

[originally from svn r6429]
[r5642 == c09d885b27]
2005-10-26 22:18:11 +00:00
Jacob Nevins
f2c17e2df8 Tweak to r6392: spell "MAC" thus.
[originally from svn r6399]
[r6392 == 8fb9bd0216]
2005-10-13 22:51:44 +00:00
Ben Harris
8fb9bd0216 Make SSH_MSG_DISCONNECT reasons less scary (without removing useful content).
[originally from svn r6392]
2005-10-13 21:51:38 +00:00
Ben Harris
c0d36aa00a Implement hmac-sha1-96. It's RECOMMENDED in the current transport draft,
and we don't have any strong reason not to implement it, for all that it's
rather pointless.

[originally from svn r6284]
2005-09-10 16:19:53 +00:00
Ben Harris
9131914278 Add support for diffie-hellman-group-exchange-sha256. Tested against a
patched OpenSSH server.  This is controlled by the same user settings
as diffie-hellman-group-exchange-sha1, which may not be optimal, especially
given that they're both referred to as dh-gex-sha1 in saved sessions.

[originally from svn r6272]
2005-09-04 14:53:39 +00:00
Ben Harris
a42d103cf9 Restructure things so that a single entry in the KEX preference list can
correspond to multiple SSH-2 KEX algorithms.  We already do the equivalent
for cipher algorithms.

[originally from svn r6262]
2005-09-03 13:41:43 +00:00
Jacob Nevins
d628d14e7f Check ssh->v2_session_id_len _after_ assigning to it.
[originally from svn r6260]
2005-09-02 10:51:09 +00:00
Ben Harris
a59356aa74 Add infrastructure for supporting multiple hashes in key exchange.
Nothing very surprising here.

[originally from svn r6251]
2005-08-31 20:43:06 +00:00
Ben Harris
11d5c791ac Rename ssh_md5 and ssh_sha1 to ssh_hmac_md5 and ssh_hmac_sha1 respectively.
This is to make room for a hash abstraction that's likely to want to use
ssh_sha1, at least.

[originally from svn r6249]
2005-08-31 19:11:19 +00:00
Ben Harris
7cceb6eeae Further progress in the direction of variable exchange hashes -- stash the
outgoing KEXINIT, and only start generating the exchange hash once we know
which KEX method we're using.

[originally from svn r6242]
2005-08-30 22:39:35 +00:00
Ben Harris
ef630659dd Beginnings of support for multiple exchange hashes in SSH-2: rather than
storing a SHA-1 hash of the client and server version strings, store the
strings themselves so we can feed them through the appropriate hash when
we know what it is.

[originally from svn r6241]
2005-08-30 20:38:57 +00:00
Jacob Nevins
1e57b290b8 More versions of WeOnlyDo have the rekey bug (but they've fixed it now).
[originally from svn r6233]
2005-08-29 00:34:03 +00:00
Jacob Nevins
5661adabbc I think this should fix various problems with queued incoming data not being
processed and incoming data being processed out of order, which I suspect is
the cause of `ssh1-fwd-trouble' as noted by Gevan Dutton. I'm not able to
test the failure case, but it doesn't seem to have obviously broken anything
in the cases I have tested, anyway.

[originally from svn r6221]
2005-08-26 21:17:49 +00:00
Ben Harris
575fa173d8 Florian Gaab reports that freeSSHd 1.0.7, which claims a "softwareversion"
of "WeOnlyDo-1.2.6", mishandles repeat key exchange.  Add it to the list.

[originally from svn r6200]
2005-08-22 20:07:46 +00:00
Ben Harris
ae64be506f draft-ietf-secsh-transport-24 says that only "SSH-" at the start of a line
marks a version string.  It's a bit vague about the definition of a line,
but I think it's reasonable to assume that they'll end with LF.  Change
do_ssh_init() to ignore "SSH-" anywhere else.  This makes the existing state
machine overkill, so replace it with something a little more readable.

[originally from svn r6138]
2005-07-24 13:46:14 +00:00
Ben Harris
7d49271ada Piers Finlayson reports that "DigiSSH_2.0" chokes (in a new and exciting
manner) on rekeys.  Add it to the list.

[originally from svn r6067]
2005-07-05 21:15:23 +00:00
Jacob Nevins
9897694920 Fix an apparently-harmless error spotted by Ben Rudiak-Gould:
do_ssh2_transport() was returning the wrong value for rekeys after the first.
This apparent error was introduced in r4901, but we can't see any reason for
the change to have been made. If it turns out to be a mistake to revert it,
I'm sure we'll find out.

Here for posterity is Simon's analysis:

| A lot of the return values from do_ssh2_transport appear to be vestigial: it
| used to be that a zero return from do_ssh2_transport meant it had handled the
| packet internally, and a 1 return meant the packet wasn't a transport-layer
| one and needed to pass on to do_ssh2_authconn. Since r4901, however, the
| layer discrimination is done based on the message type ranges, and the only
| remaining dependency on the return value from do_ssh2_transport is a special
| case in ssh2_protocol which detects the first 1 return and makes the
| initialisation call to do_ssh2_authconn.
| 
| Therefore, the gratuitous 1 return on every key exchange as a result of the
| confusing if statement is simply ignored in ssh2_protocol (because
| ssh->protocol_initial_phase_done is already TRUE). So the remaining question
| was, why does the _lack_ of that 1 return not cause a problem, if the if's
| sense is indeed reversed?
| 
| The answer is that 1 is still returned, just not by the crReturn inside the
| if statement. It's returned by the next crReturn, just after
| wait_for_rekey(). Which suggests that in fact, the if statement has the
| correct sense, but the crReturn inside it has the wrong value - it should be
| returning _zero_, to indicate that every NEWKEYS after the first one is
| uninteresting to the authconn code, and on the very first run through that
| doesn't happen and the NEWKEYS gets all the way to the crReturn(1) later on.

[originally from svn r5986]
[r4901 == a4ba026838]
2005-06-21 20:13:48 +00:00
Ben Harris
4ad47722e8 Make the sanity-checks on the size of incoming packets much stricter. We now
enforce the following:

* Packet must have at least one byte of payload and four bytes of padding.
* Total packet length must not exceed 35000 bytes compressed.
* Total packet length including length field must be a multiple of cipher
  block size (or eight bytes).

The feebleness of our old checks was noticed by Ben Rudiak-Gould.

[originally from svn r5981]
2005-06-20 13:56:30 +00:00
Ben Harris
93712a3ee1 A major purpose of PuTTY's memory-allocation functions is to succeed or die
trying, so there's no need to check their return values for NULL.  Spotted
by Ben Rudiak-Gould.

[originally from svn r5978]
2005-06-19 14:17:24 +00:00
Jacob Nevins
3c7cb747f6 Detection of "auth-agent@openssh.com" was too liberal. Spotted by
Ben Rudiak-Gould.

[originally from svn r5962]
2005-06-14 23:20:42 +00:00
Jacob Nevins
a7097f7e86 Remove a couple of mistaken references to Telnet in comments.
[originally from svn r5853]
2005-05-28 13:46:04 +00:00
Jacob Nevins
99ecca53ed Factor out all local SSH disconnections into a new function ssh_disconnect(),
and add the ability to treat a local disconnection as "unclean" -- notably, if
we can't agree any authentication methods to even try; someone was complaining
that the PuTTY window by default just disappears for no apparent reason in this
circumstance.

Also, use appropriate disconnect codes for those SSH2_MSG_DISCONNECT messages
that we do send.

I don't think I've seriously broken any user-visible behaviour, but the way
that connection-close distinctions are transmitted to the front-end is shaky
(or so it seems to me), so there may be non-ideal changes on some platforms.

[originally from svn r5824]
2005-05-21 16:49:27 +00:00
Jacob Nevins
b742913984 connection_fatal() should be called after ssh_closing() and other accesses to
`ssh', since it potentially frees it and potentially doesn't return.
Only affected a couple of rare circumstances.

[originally from svn r5787]
2005-05-16 14:41:08 +00:00
Jacob Nevins
680a32d5bc Don't try and set up reconfigured port-forwardings if the connection isn't yet
ready for them. Spotted by Martin Dushkov.

[originally from svn r5786]
2005-05-16 08:31:05 +00:00
Jacob Nevins
aa43d817d2 Use the packet dispatch table to handle USERAUTH_BANNER messages, which should
hopefully solve `drop-banner'. I haven't been able to test the failure case,
but the behaviour with OpenSSH appears no worse.

[originally from svn r5772]
[this svn revision also touched putty-wishlist]
2005-05-12 15:09:35 +00:00
Jacob Nevins
b099456c87 Implement `bypass-ssh2-userauth', since from correspondence it sounds like
there are servers which could in principle operate in this mode, although I
don't know if any do in practice. (Hence, I haven't been able to test it.)

[originally from svn r5748]
[this svn revision also touched putty-wishlist]
2005-05-05 22:37:54 +00:00
Ben Harris
df913d0036 Also blank X authentication data when using SSH-1, and add a comment explaining
why this may not be sufficient to hide it.

[originally from svn r5720]
2005-04-30 17:08:48 +00:00
Ben Harris
162d04d360 X11 authentication data are generally sensitive, so blank them from packet
logs by default.

[originally from svn r5719]
2005-04-30 16:13:11 +00:00
Ben Harris
d83cd2f79b Fix stupid typo that probably utterly broke SSH-1 support, and caused compiles
with GCC to fail.  Not sure how it survived long enough to test, really.

[originally from svn r5715]
2005-04-30 14:26:46 +00:00
Ben Harris
fcaee2626c In SSH-2 mode, PuTTY wasn't sending KEXINIT until it had received one from the
server, which led to stalemate if the server did the same.  PuTTY now sends
KEXINIT proactively as soon as it's worked out that it's talking SSH-2.

[originally from svn r5685]
2005-04-27 11:10:54 +00:00
Ben Harris
f2b0335c48 Now that we've got at least some SDCTR modes working (and aes256-ctr is our
default preferred cipher), add code to inject SSH_MSG_IGNOREs to randomise
the IV when using CBC-mode ciphers.  Each cipher has a flag to indicate
whether it needs this workaround, and the SSH packet output maze has gained
some extra complexity to implement it.

[originally from svn r5659]
2005-04-23 16:22:51 +00:00
Jacob Nevins
fb581ac625 First crack at `terminal-modes' in SSH. PuTTY now sends ERASE by default,
Unix Plink sends everything sensible it can find, and it's fully configurable
from the GUI.

I'm not entirely sure about the precise set of modes that Unix Plink should
look at; informed tweaks are welcome.

Also the Mac bits are guesses (but trivial).

[originally from svn r5653]
[this svn revision also touched putty-wishlist]
2005-04-21 13:57:08 +00:00
Jacob Nevins
62a3389981 Remove "none" from the MACs we offer to support in SSH-2. (It was at the
end, after the REQUIRED "hmac-sha1".) This has been present since SSH-2
support was introduced (r569).

[originally from svn r5643]
[r569 == 35205e5cb7]
2005-04-19 13:27:21 +00:00
Jacob Nevins
c09d885b27 Add ability to construct SSH-1 packets incrementally (not used yet).
I've added this to support `terminal-modes', but since this unifies some
SSH-1 and SSH-2 packet construction code, it saves a few hundred bytes.
Bonus.

[originally from svn r5642]
2005-04-18 21:09:58 +00:00
Ben Harris
09951c6078 Implement my experimental arcfour modes. The 256-bit version is disabled
until I can test it against someone else's implementation.

[originally from svn r5633]
2005-04-14 22:58:29 +00:00
Jacob Nevins
6eec320f0b Unify GET_32BIT()/PUT_32BIT() et al from numerous source files into misc.h.
I've done a bit of testing (not exhaustive), and I don't _think_ I've broken
anything...

[originally from svn r5632]
2005-04-12 20:04:56 +00:00
Simon Tatham
6df09c6275 <1112163342.018492.101240@f14g2000cwb.googlegroups.com> on
comp.security.ssh contains a Dr Watson log which looks to me as if
`unclean-close-crash' occurred due to a rekey timer going off after
the session had closed. Hence, ssh2_timer() now avoids doing
anything if the session is already closed, and also ssh_do_close()
proactively calls expire_timer_context(). Between those I think they
ought to solve the problem.

[originally from svn r5564]
2005-03-30 08:27:54 +00:00
Simon Tatham
4fa2049108 After we receive EOF on stdin, we should clear ssh->send_ok so that
we stop trying to read anything further from stdin. Otherwise we
send a continuous stream of SSH2_MSG_CHANNEL_EOF.

[originally from svn r5561]
2005-03-29 13:10:33 +00:00
Simon Tatham
7e41c571db The structural reorganisation of ssh.c (r4909) caused
ssh2_try_send() to no longer be run after receiving WINDOW_ADJUSTs.
I believe this is likely to have been the cause of recent PSCP
hanging issues.

[originally from svn r5517]
[r4909 == 02b0474f57]
2005-03-17 19:49:51 +00:00
Jacob Nevins
1ddb28955c Make it clearer which protocol version various bugs apply to.
[originally from svn r5490]
2005-03-11 15:24:09 +00:00
Jacob Nevins
5aa719d16e Consistently use a single notation to refer to SSH protocol versions, as
discussed. Use Barrett and Silverman's convention of "SSH-1" for SSH protocol
version 1 and "SSH-2" for protocol 2 ("SSH1"/"SSH2" refer to ssh.com
implementations in this scheme). <http://www.snailbook.com/terms.html>

[originally from svn r5480]
2005-03-10 16:36:05 +00:00
Jacob Nevins
b222632c66 Add notification when using the various auth methods with server-supplied
prompts, to make it more obvious if a server is attempting to spoof a local
passphrase prompt.

I believe an alert user could have spotted this in all cases in SSH-2,
although perhaps not in SSH-1. (But they'd have to have enabled
TIS/CryptoCard.)

[originally from svn r5450]
2005-03-06 16:38:19 +00:00
Simon Tatham
0fbab7b041 Over-enthusiastic assertions in the port forwarding code removed.
Port forwardings are set up before initialising the last few details
of the main shell session, so ssh->state can reasonably hold values
other than SSH_STATE_SESSION and SSH_STATE_CLOSED during calls to
sshfwd_*.

[originally from svn r5446]
2005-03-05 18:14:57 +00:00
Simon Tatham
f76c35b4b7 Make sure we do notify_remote_exit(ssh->frontend) _before_
connection_fatal(), since the latter is entitled to destroy the
backend so `ssh' may no longer be valid once it returns.

For the Unix port, switch exit(0) to gtk_main_quit() in
notify_remote_exit(), so that we don't exit before the subsequent
connection_fatal()!

[originally from svn r5445]
2005-03-05 17:56:28 +00:00
Jacob Nevins
8316deb339 rm some magic numbers in ssh_setup_portfwd()
[originally from svn r5439]
2005-03-04 01:20:20 +00:00
Jacob Nevins
140688e77f Another failure to crStop(0) on user abort, this time for SSH-1 cipher
askalg(). That should be the last one.

[originally from svn r5369]
2005-02-20 21:00:16 +00:00
Simon Tatham
5c3f8d2f26 Oops; missed out a crStop in the new host key verification code.
[originally from svn r5354]
2005-02-19 14:48:36 +00:00
Simon Tatham
775fe9eb31 A few more fixes in the new asynchronous-alert-box mechanism.
[originally from svn r5343]
2005-02-18 18:19:28 +00:00
Simon Tatham
0598df9217 Adjust the semantics of cfg.remote_cmd_ptr: it is now NULL when
cfg.remote_cmd is to be used, rather than actually pointing at
cfg.remote_cmd. This change restores the ability to structure-copy
Configs without breaking them. (Though of course this is only a
temporary solution: really what wants doing is to fix
`config-struct'.)

[originally from svn r5335]
2005-02-17 19:31:32 +00:00
Simon Tatham
fceaa2e4a7 Ahem. Actually _checking_ that asynchronous askalg() worked would
have been helpful. Since async verify_ssh_host_key() worked, I
didn't think anything else could go wrong. How wrong I was.

[originally from svn r5331]
2005-02-17 18:56:37 +00:00
Simon Tatham
8574822b9b Revamp interface to verify_ssh_host_key() and askalg(). Each of them
now returns an integer: 0 means cancel the SSH connection and 1
means continue with it. Additionally, they can return -1, which
means `front end has set an asynchronous alert box in motion, please
wait to be called back with the result', and each one is passed a
callback function pointer and context for this purpose.

I have not yet done the same to askappend() yet, because it will
take a certain amount of reorganisation of logging.c.

Importantly, this checkin means the host key dialog box now works on
OS X.

[originally from svn r5330]
2005-02-17 18:34:24 +00:00
Jacob Nevins
92ccb964a2 ssh_do_close() should close any listening sockets associated with
port-forwardings.

[originally from svn r5325]
2005-02-17 02:00:01 +00:00
Jacob Nevins
077ce4012f ssh_do_close() was only closing about half the channels. Fixed.
[originally from svn r5324]
2005-02-17 01:47:01 +00:00
Jacob Nevins
346907478d Fix a minor valgrind issue in dynamic port-forwarding.
[originally from svn r5318]
2005-02-16 11:56:27 +00:00
Jacob Nevins
c9116974ac The terminal window can now indicate that PuTTY is busy in various ways, by
changing its mouse pointer. Currently this is only used in the (slightly-
arbitrarily-defined) "heavy" bits of SSH-2 key exchange. We override pointer
hiding while PuTTY is busy, but preserve pointer-hiding state.

Not yet implemented on the Mac.

Also switch to frobbing window-class cursor in Windows rather than relying on
SetCursor().

[originally from svn r5303]
2005-02-15 17:05:58 +00:00
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
Simon Tatham
1ca821cfb1 Now that Packet structures are dynamically allocated, it means we
can keep several of them in parallel. In particular, this allows us
to queue outgoing packets during repeat key exchange, to be actually
sent after the rekey completes.

(This doesn't fully fix ssh2-kex-data; also required is the ability
to handle _incoming_ connection-layer packets during rekey without
exploding.)

[originally from svn r4899]
2004-11-24 19:23:02 +00:00
Simon Tatham
277089b0fb Minor refactoring: the fields pktin' and pktout' in the Ssh
structure have been retired. Now all Packet structures are
dynamically allocated. Each rdpkt function allocates one, and it's
freed after being used; and the packet construction functions
allocate them too, and they're freed by the send functions.

`pktin' and `pktout' were ugly. They were _morally_ still global
variables; even though they were replicated per SSH session to
comply with the Mac no-globals requirement, they weren't really in
the _spirit_ of `dynamically allocate your data'.

As a side effect of this change, the `pktout_blanks' and
`pktout_nblanks' fields in the Ssh structure have been moved into
the Packet structure.

[originally from svn r4898]
2004-11-24 18:45:52 +00:00
Jacob Nevins
1969da0208 XXX comment in the logic which sends failed password auth back to username
prompt for keyboard-interactive. I suspect we should do the same with that
method (especially given the apparent number of systems that use it for
regular password auth), but in the absence of systems to test against I've
not actually made the change. (I'm worried that the `partial success' field
might not be set correctly in a multi-stage authentication, for instance.)

[originally from svn r4850]
2004-11-20 17:47:40 +00:00
Jacob Nevins
abf999a809 As a result of the policy allowing changes of username to reset the
authentication state, a failed `password' authentication in SSH-2 was
sending us back to trying `none' and `keyboard-interactive' each time
round, which uses up OpenSSH's quota of authentication attempts rather
quickly. Added a check for `cfg.change_username' to the logic which
sends us back to the start.

[originally from svn r4849]
2004-11-20 17:11:38 +00:00
Jacob Nevins
b66d69ee25 Remove FLAG_INTERACTIVE test from "login as:" prompt. Kelly John Carney
pointed out that Plink would attempt to use a zero-length username iff
a remote command was specified (because the FLAG_INTERACTIVE test was
erroneously combined with the no-username test).

I don't think this will break non-interactive use; in the cases which
behave differently, Plink would be attempting to use the empty
username, which was almost certainly wrong, whereas now it will give a
prompt (which can be avoided with -batch as usual).

(Although perhaps we should attempt to use a local username as a guess for
the remote username, as PSCP does? I've not done this.)

[originally from svn r4831]
2004-11-19 20:57:32 +00:00
Jacob Nevins
352bca5b1e Argh, I messed up SSH1 remote tunnels too (same mistake).
[originally from svn r4728]
2004-11-01 14:18:37 +00:00
Jacob Nevins
f24ac64cef Ahem, let's not try initialising a static with a non-constant initialiser.
Also, I'm pretty sure that adding a source address to a remote SSH-2 forwarding
can never have worked, since we added an address string to the packet twice in
that case. OpenSSH 3.4p1 certainly doesn't like it (`Server has disabled port
forwarding' debug message). Fixed (and OpenSSH is happier now).

[originally from svn r4727]
2004-11-01 00:47:37 +00:00
Jacob Nevins
86ba7399bb Argh. Failure to make a variable static to get round coroutine
mechanics means that each SSH-2 remote tunnel will sfree() something
random and thus have a chance of crashing or doing something else
bad, although it won't otherwise affect execution. Introduced in
1.319 [r4529] (some of my improved diagnostics). One day I'll make a
checkin to ssh.c without forgetting about the coroutines...

[originally from svn r4725]
[r4529 == 27193c4bf0]
2004-11-01 00:17:31 +00:00
Jacob Nevins
2e90539429 Malcolm Rowe spotted that we broke display of SSH2_MSG_DEBUG messages while
fixing `vuln-ssh2-debug', by missing out a field. In most cases
(always_display = 0) we would log a zero-length or truncated message.

(Also add a prototype for ssh2_pkt_getbool().)

[originally from svn r4718]
2004-10-28 00:23:44 +00:00
Simon Tatham
64821979b1 Better bounds checking in the exit-signal handler.
[originally from svn r4670]
2004-10-22 16:50:51 +00:00
Simon Tatham
5ff0e6b1d9 We ought to be using the ssh_pkt_* routines for the messages which we
process at any time in the rdpkt routines, as well as everywhere else.

[originally from svn r4669]
2004-10-22 16:47:46 +00:00
Jacob Nevins
7543a93516 Add support for logging "exit-signal", why not.
This is disgustingly huge because old versions of OpenSSH got the message
format wrong, so we have to infer which format is in use. Tested with
Debian stable OpenSSH (3.4p1), with `uint32' packet, and lshd, which uses
the correct `string' packet, and also let me test "core dumped" and the
explanatory message.

[originally from svn r4653]
2004-10-18 00:41:48 +00:00
Jacob Nevins
17b0d8c58e Support the SSH-2 mechanism for sending signals to a running session. Neither
of the SSH servers I conveniently have access to (Debian stable OpenSSH --
3.4p1 -- and lshd) seem to take a blind bit of notice, but the channel
requests look fine to me in the packet log.

I've included all the signals explicitly defined by
draft-ietf-secsh-connect-19, but I've put the more obscure ones in a submenu
of the specials menu; there's therefore been some minor upheaval to support
such submenus.

[originally from svn r4652]
2004-10-17 21:22:22 +00:00
Jacob Nevins
1efa60e40d We shouldn't offer the Break special when we don't have a session to send it
down. (A side effect of fixing this is that ssh->mainchain is set to NULL
when it closes, which might avoid other sorts of trouble.)

While we're here, don't bother offering SSH1_MSG_IGNORE if we believe the
remote will barf on it.

[originally from svn r4650]
2004-10-17 15:32:42 +00:00
Simon Tatham
859d92a577 Moved the environment variables config block out of the Telnet panel
into the Connection panel, and implemented support for the SSH2
"env" request. (I haven't yet found a server which accepts this
request, so although I've visually checked the packet log and it
looks OK, I haven't yet been able to do a full end-to-end test.)
Also, the `pty' backend reads this data and does a series of
`putenv' commands before launching the shell or application.

This is mostly because in last week's UTF-8 faffings I got
thoroughly sick of typing `export LANG=en_GB.UTF-8' every time I
started a new testing pterm, and it suddenly occurred to me that
this would be precisely the sort of thing you'd want to have pterm
set up for you, particularly since you can configure it alongside
the translation settings and so you can ensure they match up
properly.

[originally from svn r4645]
2004-10-16 10:56:54 +00:00
Simon Tatham
dd279dffc2 Implement part of `ssh2-generality': introduce the ability to tell
PuTTY / Plink not to run a remote shell/command at all. Supported in
the GUI configuration and via the (OpenSSH-like) -N command-line
option.

No effort is currently made to arrange `nice' UI properties. If you
do this in GUI PuTTY, a full-size terminal window will still be
created, and will sit there with almost nothing in it throughout
your session. If you do it in Plink, Plink will not accept any kind
of request to terminate gracefully; you'll have to ^C or kill it.
Nonetheless, even this little will be useful to some people...

[originally from svn r4614]
2004-10-13 13:43:11 +00:00
Jacob Nevins
e375ba107d `ssh-log-pw-blank': known password fields are now omitted from SSH packet logs
by default (although they can be included). There's also an option to remove
session data, which is good both for privacy and for reducing the size of
logfiles.

[originally from svn r4593]
2004-10-02 00:33:27 +00:00
Jacob Nevins
fb92f118bd Mention the negotiated SSH-2 MAC algorithm(s) in the Event Log.
(It should be possible to at least see what MAC is in use without going to a
SSH packet log.)

[originally from svn r4591]
2004-09-29 23:57:03 +00:00
Simon Tatham
05696aabfd Report details in Event Log when receiving SSH2_MSG_CHANNEL_OPEN_FAILURE.
[originally from svn r4589]
2004-09-29 12:38:45 +00:00
Jacob Nevins
57c34f0872 Add `OSU_1.5alpha4' to BUG_CHOKES_ON_SSH1_IGNORE; this is apparently enough to
enable login with this version. (I'd suspected as much -- see ssh.c CVS
log 1.299 [r3359] -- and Geoffrey Hughes has now confirmed this.)

[originally from svn r4566]
[r3359 == d534d4e104]
2004-09-21 21:04:28 +00:00
Jacob Nevins
27193c4bf0 Improved diagnostics in port-forwarding: we now log any error returned by
pfd_addforward() rather than just ignoring it.

[originally from svn r4529]
2004-09-03 13:46:39 +00:00
Jacob Nevins
47997ad904 In SSH-2, list each compression algorithm only once. (No particular reason
for this change, just tidiness.)

[originally from svn r4528]
2004-09-03 12:28:19 +00:00
Simon Tatham
e2cd7e404e More sensible error handling when we receive an SSH1 public key
modulus of zero (!!), and also a robustness fix in ssh1_rdpkt which
I happened to notice while debugging that.

[originally from svn r4516]
2004-08-28 16:51:26 +00:00
Jacob Nevins
1af5523edc Someone complained that their keyboard-interactive password prompt was being
truncated - it was from OpenSSH on HP/UX and had all sorts of stuff in it
("last successful login" etc).

Bodged it by bumping up the space allocated in the fixed array for a password
prompt. Also added an indication that the prompt is being truncated, as
required by draft-ietf-secsh-auth-kbdinteract-06.

(NB that before this checkin, there was a more-or-less harmless buffer overread
where if we ever received a keyboard-interactive prompt with echo=1, we'd
probably spew goo on the terminal; fixed now.)

[originally from svn r4476]
2004-08-17 14:08:05 +00:00
Simon Tatham
f16d8aff82 ssh_free() should not call log_free(); it's for the front end to
decide whether the logctx is finished with or not.

[originally from svn r4452]
2004-08-14 12:24:02 +00:00
Jacob Nevins
f17522be6c Extra logging in SSH-2 port-forwarding. Most obviously, the opening of a
forwarded X11 connection is now logged as well as the closing; but we also
log the peer IP/port in case it's interesting, and log the reason for
refusing to honour a channel open.

[originally from svn r4451]
2004-08-13 01:08:34 +00:00
Jacob Nevins
11f628b075 When using remote forwarding with SSH-1, you'd get bogus 'SSH1 cannot
handle source address spec ":10023"; ignoring' type errors in the
Event Log. The forwarding would go ahead as normal so this is
cosmetic. Fixed.

[originally from svn r4392]
2004-08-03 23:43:07 +00:00
Simon Tatham
4217269931 Merged SSH1 robustness changes from 0.55 release branch on to trunk.
[originally from svn r4379]
2004-08-01 12:07:11 +00:00
Jacob Nevins
20f433efac Add a configuration option for TCP keepalives (SO_KEEPALIVE), default off.
No very good reason, but I've occasionally wanted to frob it to see if it
makes any difference to problems I'm having, and it was easy.

Tested that it does actually cause keepalives on Windows (with tcpdump);
should also work on Unix. Not implemented on Mac (does nothing), but then
neither is TCP_NODELAY.

Quite a big checkin, much of which is adding `keepalive' alongside `nodelay'
in network function calls.

[originally from svn r4309]
2004-06-20 17:07:38 +00:00
Simon Tatham
78dbf5df0e `Authenticating with key' message when using a local key file in
SSH2 was not contained within a test for FLAG_VERBOSE. Thanks to
Paul Gotch for pointing this out.

[originally from svn r4281]
2004-06-15 09:50:05 +00:00
Jacob Nevins
14d9628130 Spotted by Dimitry Andric: `ssh-termspeed' implementation was not taking
account of coroutines and used local variables over a crFoo. I believe the
impact was cosmetic, affecting the speeds reported in the Event Log only.

I've put the variables `ispeed' and `ospeed' in the main ssh_tag structure,
even though they're only live for a short duration; I did this rather than
create a new state struct for ssh1_protocol() (since ssh_tag already has
short-duration junk like portfwd_strptr).

[originally from svn r4272]
2004-06-03 10:36:27 +00:00
Jacob Nevins
3867e5956e In SSH, we now send terminal speeds to the server when requesting a pty
(we didn't before) - `ssh-termspeed'.
In the process, I've removed the individual controls on the Telnet and
Rlogin panels and replaced them with one on the Connection panel (since they
were backed by the same storage anyway).
The terminal speeds sent in SSH are logged in the Event Log.

[originally from svn r4133]
2004-04-24 20:05:03 +00:00
Simon Tatham
a326264500 Two small memory leaks, also noticed by Martin Prikryl.
[originally from svn r3752]
2004-01-21 19:41:34 +00:00
Simon Tatham
b424ea234f Martin Prikryl points out that need_pw may be used uninitialised.
[originally from svn r3751]
2004-01-21 19:33:48 +00:00
Simon Tatham
33a59e78f1 Memory management fixes. Fixed a segfault in SSH1 compression
cleanup noticed by Gerhard Wiesinger, and also fixed some memory
leaks spotted by valgrind while debugging same.

[originally from svn r3726]
2004-01-18 09:14:41 +00:00
Simon Tatham
c53056f95c Joe Yates's memory leak patch was overenthusiastically freeing
things; it called freebn on the DH gex values even if DH gex had not
taken place. Bug was trivially reproducible as a NULL-dereference
segfault by making any SSH2 connection with DH gex disabled. Should
now be fixed.

[originally from svn r3678]
2004-01-01 16:42:48 +00:00
Simon Tatham
7a1eae7ff2 Joe Yates's memory leak patches.
[originally from svn r3650]
2003-12-19 12:44:46 +00:00
Simon Tatham
f9f6763a0e Trivial braino in parsing of the port forwarding config data. Was
causing all port forwardings after the first dynamic one to be
ignored.

[originally from svn r3572]
2003-11-22 14:50:57 +00:00
Jacob Nevins
eebc7529ed Work towards wish `keyfile-diagnostic'. Many sshpubk.c keyfile-loading
functions have sprouted `**errorstr' arguments, which if non-NULL can
return a textual error message. The interface additions are patchy and
ad-hoc since this seemed to suit the style of the existing interfaces.

I've since realised that most of this is masked by sanity-checking that
gets done before these functions are called, but it will at least report
MAC failures and the like (tested on Unix), which was the original point
of the exercise.

Note that not everyone who could be using this information is at the
moment.

[originally from svn r3430]
2003-08-29 22:52:57 +00:00
Jacob Nevins
92db92af5a Control of 'addr' is now handed over to {platform_,}new_connection() and
sk_new() on invocation; these functions become responsible for (eventually)
freeing it. The caller must not do anything with 'addr' after it's been passed
in. (Ick.)

Why:
A SOCKS5 crash appears to have been caused by overzealous freeing of
a SockAddr (ssh.c:1.257 [r2492]), which for proxied connections is
squirreled away long-term (and this can't easily be avoided).

It would have been nice to make a copy of the SockAddr, in case the caller has
a use for it, but one of the implementations (uxnet.c) hides a "struct
addrinfo" in there, and we have no defined way to duplicate those. (None of the
current callers _do_ have a further use for the SockAddr.)

As far as I can tell, everything _except_ proxying only needs addr for the
duration of the call, so sk_addr_free()s immediately. If I'm mistaken, it
should at least be easier to find the offending free()...

[originally from svn r3383]
[r2492 == bdd6633970]
2003-08-07 16:04:33 +00:00
Jacob Nevins
d534d4e104 Add SSH-1 password camouflage bug detection for version OSU_1.4alpha3 of the
OSU VMS SSH server <http://kcgl1.eng.ohio-state.edu/~jonesd/ssh/>.

The changelog appears to indicate that the server was fixed for pwplain1 at
1.5alpha4, and for IGNORE and DEBUG messages at 1.5alpha6. However I'm going
to go on the reports we've had as I haven't tested this; and they indicate
only that 1.5alpha6 is known not to require any bug compatibility modes.

(I wasn't sure whether to add this at all, given that upgrading to version
OSU_1.5alpha6 is an easy way to fix the problem. However, there is precedent
for adding detection for old versions of servers which have since been fixed.)

[originally from svn r3359]
2003-07-12 13:45:21 +00:00
Simon Tatham
d02ea52abc Fix a segfault (non-security-critical - null dereference for
reading) in the zlib code when fed certain kinds of invalid data. As
a result, ssh.c now needs to be prepared for zlib_decompress_block
to return failure.

[originally from svn r3306]
2003-06-26 13:41:30 +00:00
Ben Harris
3006ebf15c Fix a couple of memory leaks pointed out by Adam Bernstein.
[originally from svn r3262]
2003-06-14 18:27:10 +00:00
Jacob Nevins
e955cc77ce Add exceptions for "VShell" to the ssh.com bug compatibility modes (which are
just numbers) in an attempt to fix `vshell-no-bug-compat'.
Not even tested a little bit.

[originally from svn r3219]
2003-05-24 19:03:34 +00:00
Simon Tatham
06e6997a74 Rename crc32() to crc32_compute(), to avoid clashing catastrophically
with the crc32() function in the zlib interface. (Not that PuTTY
itself _uses_ zlib, but on Unix it's linked against libgtk which
uses libpng which uses zlib. And zlib has poor namespace management
so it defines this ridiculously intrusive function name. Arrrrgh.)

[originally from svn r3191]
2003-05-13 18:23:43 +00:00
Ben Harris
ead3dee597 Make ssh_agent_callback() and ssh_agentf_callback() static.
[originally from svn r3182]
2003-05-10 12:54:29 +00:00
Simon Tatham
6bb121ecb9 Colin's const-fixing Patch Of Death. Seems to build fine on Windows
as well as Unix, so it can go in.

[originally from svn r3162]
2003-05-04 14:18:18 +00:00
Simon Tatham
0bfe876b57 Colin's and my fixes to connection_fatal().
[originally from svn r3161]
2003-05-04 14:14:10 +00:00
Simon Tatham
f6a208fbdd First half of `pageant-async' work. agent_query() is now passed a
callback function; it may return 0 to indicate that it doesn't have
an answer _yet_, in which case it will call the callback later on
when it does, or it may return 1 to indicate that it's got an answer
right now. The Windows agent_query() implementation is functionally
unchanged and still synchronous, but the Unix one is async (since
that one was really easy to do via uxsel). ssh.c copes cheerfully
with either return value, so other ports are at liberty to be sync
or async as they choose.

[originally from svn r3153]
2003-04-28 11:41:39 +00:00
Simon Tatham
1f9c9bb00f The new ssh_do_close() function itself causes a segfault if the
connection goes foom before ssh->channels is set up. Oops. Fixed.

[originally from svn r3141]
2003-04-25 17:44:09 +00:00
Simon Tatham
2a0fff2451 Robustness in the face of sudden connection closures: we now make a
credible effort to shut down open forwardings cleanly when the
owning SSH connection terminates abruptly (for whatever reason).

[originally from svn r3137]
2003-04-25 11:48:24 +00:00
Simon Tatham
041dcfd83d Unix makefile now uses -O2, which massively cuts down key exchange
time. This gives rise to a whole bunch of spare warnings, one or two
of which might have been actual bugs; now all resolved.

[originally from svn r3134]
2003-04-23 13:48:09 +00:00
Simon Tatham
717fd50963 Oops; we _do_ need to set dport even when doing dynamic forwarding,
because otherwise the `if (sport && dport)' statement runs the risk
of not working.

[originally from svn r3129]
2003-04-18 09:06:11 +00:00
Simon Tatham
a9c8e035dd Fix obvious foulup in X forwarding: my recent `how did this ever
work' change to port forwarding completely broke it, by failing to
set peeraddr{,len} before reading them. Oops.

[originally from svn r3127]
2003-04-18 09:00:16 +00:00
Simon Tatham
65fab07ad0 Remote-to-local port forwarding in SSH2 was apparently completely
broken! We were expecting the peer address/port in the incoming
packet _before_ the connected address/port, which is just wrong. I
wonder how I managed to mess that up.

[originally from svn r3083]
2003-04-09 11:19:39 +00:00
Simon Tatham
8a3ff2bf3e Dynamic port forwarding by means of a local SOCKS server. Fully
supports SOCKS 4, SOCKS 4A and SOCKS 5 (well, actually IPv6 in SOCKS
5 isn't supported, but it'll be no difficulty once I actually get
round to it). Thanks to Chas Honton for his `stone soup' patch: I
didn't end up actually using any of his code, but it galvanised me
into doing it properly myself :-)

[originally from svn r3055]
2003-04-05 11:45:21 +00:00
Simon Tatham
3bd0415579 Turned the old `Telnet Command' System-submenu into a more general
`Special Command' menu, in which any backend can place its own list
of magical things the user might want to ask the backend to do. In
particular I've implemented the recently proposed "break" extension
in SSH2 using this mechanism.
NB this checkin slightly breaks the Mac build, since it needs to
provide at least a stub form of update_specials_menu().

[originally from svn r3054]
2003-04-04 20:21:05 +00:00
Simon Tatham
09ba8ca111 Make sure the socket is closed properly in the various SSH exit paths.
[originally from svn r3037]
2003-03-31 13:15:51 +00:00
Simon Tatham
b044c350f4 Ahem; fix `bombout' so it passes the correct frontend handle to
connection_fatal().

[originally from svn r3030]
2003-03-31 11:22:30 +00:00
Ben Harris
3e4386d810 In a couple of places, snewn() was being asked for an array of char which was
then assigned to an unsigned char * variabe.  This fixes that.

[originally from svn r3023]
2003-03-29 23:05:36 +00:00
Simon Tatham
d36a4c3685 Introduced wrapper macros snew(), snewn() and sresize() for the
malloc functions, which automatically cast to the same type they're
allocating the size of. Should prevent any future errors involving
mallocing the size of the wrong structure type, and will also make
life easier if we ever need to turn the PuTTY core code from real C
into C++-friendly C. I haven't touched the Mac frontend in this
checkin because I couldn't compile or test it.

[originally from svn r3014]
2003-03-29 16:14:26 +00:00
Simon Tatham
cbb126917f While I'm adding explanatory comments by the coroutine macros, it
occurs to me that would also be a good place to put a copy of the
instructions for disabling Edit and Continue debugging. Nobody
_actually_ reads the README, after all...

[originally from svn r2935]
2003-03-14 21:20:32 +00:00
Simon Tatham
9890c7a57a I've been meaning to get round to this for _ages_: in front of my
coroutine macros, I now include a comment linking to my web article
that explains what they do.

[originally from svn r2902]
2003-03-03 16:35:45 +00:00
Simon Tatham
8aa463b7a1 In merging the username and password input functions I inadvertently
removed the support for control characters in passwords. Replaced.

[originally from svn r2900]
2003-02-28 20:28:03 +00:00
Ben Harris
01105493cc Work around an SC bug that causes it to try to use the same register for
two purposes in s_wrpkt_prepare().  This makes SSH1 work on 68K Macs, at
least until I deactivate the terminal window...

[originally from svn r2876]
2003-02-23 00:13:17 +00:00
Jacob Nevins
2bb23257f2 Fix `ssh2.0.11-keyderive-nonbug' on the strength of Ben's analysis.
Not tested it myself.

[originally from svn r2861]
2003-02-18 20:10:24 +00:00
Simon Tatham
be9718cb13 Add another bug workaround, this one for old OpenSSH (<2.3) servers
which have a strange idea of what data should be signed in a PK auth
request. This actually got in my way while doing serious things at
work! :-)

[originally from svn r2800]
2003-02-04 13:02:51 +00:00
Simon Tatham
b83b9fad77 Further fallout from the introduction of the Filename type. (Memo to
self: if you change the type of a variable and everything compiles
without type-checking errors, that doesn't mean it's all fixed,
because variadic functions aren't type-checked! Oops.)

[originally from svn r2799]
2003-02-04 13:00:54 +00:00
Simon Tatham
bd16b29a7a Oops, Ben is quite right about the rather appalling design of
filename_from_str. Here's a better fix, with some const
repercussions too.

[originally from svn r2768]
2003-02-01 17:24:27 +00:00
Simon Tatham
f26b7aa0d3 Created new data types Filename' and FontSpec', intended to be
opaque to all platform-independent modules and only handled within
per-platform code. `Filename' is there because the Mac has a magic
way to store filenames (though currently this checkin doesn't
support it!); `FontSpec' is there so that all the auxiliary stuff
such as font height and charset and so on which is needed under
Windows but not Unix can be kept where it belongs, and so that I can
have a hope in hell of dealing with a font chooser in the forthcoming
cross-platform config box code, and best of all it gets the horrid
font height wart out of settings.c and into the Windows code where
it should be.
The Mac part of this checkin is a bunch of random guesses which will
probably not quite compile, but which look roughly right to me.
Sorry if I screwed it up, Ben :-)

[originally from svn r2765]
2003-02-01 12:54:40 +00:00
Simon Tatham
6aa4211f6e Remove all `enum'-typed variables from the Config structure.
Everything in there which is integral is now an actual int, which
means my forthcoming revamp of the config box will be able to work
with `int *' pointers without fear of doom.

[originally from svn r2733]
2003-01-27 18:02:24 +00:00
Ben Harris
eaf6cce661 Remove stray debugging code that got in with the last commit.
[originally from svn r2650]
2003-01-18 22:02:22 +00:00
Ben Harris
35f3ef5cc9 Clear kex_ctx in a new session so we can safely free an ssh session without
one.

[originally from svn r2649]
2003-01-18 21:56:33 +00:00
Ben Harris
694aafa071 Add the ability to close sessions. This adds *_free() functions to most
areas of the code.  Not all back-ends have been tested, but Telnet and SSH
behave reasonably.

Incidentally, almost all of this patch was written through Mac PuTTY,
admittedly over a Telnet connection.

[originally from svn r2615]
2003-01-15 23:30:21 +00:00
Simon Tatham
952857fca3 proxy.c now no longer refers to `cfg'. Instead, each of the three
proxy-indirection network functions (name_lookup, new_connection,
new_listener) takes a `const Config *' as an argument, and extracts
enough information from it before returning to handle that
particular network operation in accordance with the proxy settings
it specifies. This involved {win,ux}net.c due to a `const'
repercussion.

[originally from svn r2567]
2003-01-12 15:26:10 +00:00
Simon Tatham
5ecbac2441 There's no real need for portfwd.c to reference `cfg' directly, when
it only needs one item from it and that can easily be passed in from
the call site in ssh.c.

[originally from svn r2564]
2003-01-12 14:56:19 +00:00
Simon Tatham
f49c8c5a07 The back ends now contain their own copies of the Config structure,
and have a function to pass in a new one. (Well, actually several
back ends don't actually bother to do this because they need nothing
out of Config after the initial setup phase, but they could if they
wanted to.)

[originally from svn r2561]
2003-01-12 14:48:29 +00:00
Simon Tatham
fee1624c69 Support for XDM-AUTHORIZATION-1 at the SSH server end, making use of
the remote IP/port data provided by the server for forwarded
connections. Disabled by default, since it's incompatible with SSH2,
probably incompatible with some X clients, and tickles a bug in
at least one version of OpenSSH.

[originally from svn r2554]
2003-01-12 14:11:38 +00:00
Simon Tatham
ee54789b25 Yet _another_ `received data for nonexistent channel' bug. This time
it was because we received WINDOW_ADJUST on a channel we'd already
sent CLOSE on, and reflexively attempted to continue sending the
buffered data in response. Should now be fixed.

[originally from svn r2539]
2003-01-11 10:05:29 +00:00
Simon Tatham
86977efa81 Introduce framework for authenticating with the local X server.
Windows and Mac backends have acquired auth-finding functions which
do nothing; Unix backend has acquired one which actually works, so
Plink can now do X forwarding believably.
(This checkin stretches into some unlikely parts of the code because
there have been one or two knock-on effects involving `const'. Bah.)

[originally from svn r2536]
2003-01-10 18:33:35 +00:00
Simon Tatham
10c1d43ac6 Yikes! Forgot to zero the password after SSH2 PW authentication.
[originally from svn r2512]
2003-01-09 17:33:49 +00:00
Ben Harris
40493b20ea Use '\012' as the end of the SSH banner line, not '\n'.
Mac compilers default to making '\n' == '\015'.

[originally from svn r2493]
2003-01-07 23:05:12 +00:00
Ben Harris
bdd6633970 Initialise the "protocol" field of a new ssh_tag to NULL so Bad Things don't
happen if we try to type things before the SSH banner has been received.

[originally from svn r2492]
2003-01-07 22:45:12 +00:00
Ben Harris
88b1506298 Make ssh1_pkt_type(), ssh2_pkt_type, logeventf(), setup_userpass_input(),
process_userpass_input(), and ssh_unthrottle() static, since they're not
referenced outside this file.

[originally from svn r2475]
2003-01-05 23:01:43 +00:00
Ben Harris
3f055f22d8 Move x11fwd and portfwd prototypes from ssh.c into ssh.h so they can be seen
by (and checked against) the definitions.

[originally from svn r2474]
2003-01-05 22:53:23 +00:00
Ben Harris
7c37547df8 Deal with "possible unintended assignment" warnings.
[originally from svn r2461]
2003-01-05 13:46:13 +00:00
Ben Harris
b91ae87c78 Attack char * vs unsigned char * conversions. In most cases, I've just
gone for replacing the implicit casts with explicit ones.  Where there was
something obviously better that I could do, I've done it, though.

[originally from svn r2460]
2003-01-05 13:43:02 +00:00
Simon Tatham
368ead15bc Propagate the screen number from a local X display to the remote
forwarded one. Fixes `x11-default-screen'.

[originally from svn r2418]
2003-01-02 10:41:22 +00:00
Simon Tatham
6c34f06a71 Move the stderr output of event log messages in verbose mode to the
general logging module rather than localising it in ssh.c. This
means it should work in other protocols as well (notably Telnet,
where it might actually be useful for debugging negotiations).

[originally from svn r2360]
2002-12-19 14:24:28 +00:00
Simon Tatham
7f7e3f539c logeventf() shouldn't throw stuff at stderr, since it invokes the
ssh.c logevent _macro_ which has already done so! Duhh.

[originally from svn r2356]
2002-12-19 11:51:42 +00:00
Simon Tatham
a564ad3140 Support for doing DNS at the proxy end. I've invented a new type of
SockAddr, which just contains an unresolved hostname and is created
by a stub function in *net.c. It's an error to pass this to most of
the real-meat functions in *net.c; these fake addresses should have
been dealt with by the time they get down that far. proxy.c now
contains name_lookup(), a wrapper on sk_namelookup() which decides
whether or not to do real DNS, and the individual proxy
implementations each deal sensibly with being handed an unresolved
address and avoid ever passing one down to *net.c.

[originally from svn r2353]
2002-12-18 16:23:11 +00:00
Simon Tatham
99b870dbc6 Implement `portfwd-loopback-choice'. Works on local side in Unix as
well, though it's a lot less useful since you still can't bind to
low-numbered ports of odd loopback IPs. Should work in principle for
SSH2 remote forwardings as well as local ones, but OpenSSH seems
unwilling to cooperate.

[originally from svn r2344]
2002-12-18 11:39:25 +00:00
Simon Tatham
8cb52a26e1 BUG_SSH2_DERIVEKEY is apparently only present in SSH 2.0.11 and
before, not in 2.0.13. Verified on at least one host. Fixes bug
`ssh2-keyderive-nonbug'.

[originally from svn r2342]
2002-12-18 10:06:38 +00:00
Simon Tatham
29b0705961 logeventf()'s first argument is ssh, not ssh->frontend! This is what
I get for making the latter a `void *' - type checking deserts me in
my hour of need. Should fix Andrey Borzenkov's bug.

[originally from svn r2340]
2002-12-18 09:47:20 +00:00
Jacob Nevins
4ffd0ca9d1 Modify bug-compatibility checks to use wildcards. Should have exactly the
same behaviour as before (tested a little bit), but should be easier to
expand.
(This is the easy bit -- work still needs to be done to fix
ssh2-keyderive-nonbug, vshell-no-bug-compat, etc -- but should be easier
now.)

[originally from svn r2293]
2002-12-08 16:54:31 +00:00
Simon Tatham
75ebfa28f0 Interchange two parameters in a printf, to prevent a silly segfault.
[originally from svn r2235]
2002-11-20 19:56:10 +00:00
Simon Tatham
7c95ea19c8 Robustness fixes for KEXINIT handling and others. In particular, I've
created a self-mallocing variant of sprintf, to obviate any future
need for paranoid %.100s type stuff in format strings.

[originally from svn r2199]
2002-11-07 19:49:03 +00:00
Simon Tatham
63f793b965 valgrind has caught two more uninitialised elements in the SSH
context structure. I knew the Unix port would be a good idea!

[originally from svn r2173]
2002-11-01 12:59:09 +00:00
Simon Tatham
a5da5adc07 Move an output newline to make username entry in Plink/SSH2 look
more sensible.

[originally from svn r2168]
2002-11-01 12:53:45 +00:00
Simon Tatham
2e25b715e3 Pass int rather than char to va_arg (the latter gets promoted).
[originally from svn r2167]
2002-11-01 12:53:10 +00:00
Simon Tatham
52bdffbfe0 More preparatory work: remove the <windows.h> include from lots of
source files in which it's no longer required (it was previously
required in anything that included <putty.h>, but not any more).
Also moved a couple of stray bits of exposed WinSock back into
winnet.c (getservbyname from ssh.c and AF_INET from proxy.c).

[originally from svn r2160]
2002-10-30 17:57:31 +00:00
Simon Tatham
ce677ce258 Yikes - put back a #include I accidentally removed two revs ago!
That'd have been embarrassing. Mind you I'd like to remove this
particular #include for good anyway, but the time is not now...

[originally from svn r2158]
2002-10-29 16:54:09 +00:00
Simon Tatham
1c80391e61 Hmm. Probably best initialise mainchan as well; oops.
[originally from svn r2157]
2002-10-29 14:41:10 +00:00
Simon Tatham
7e4f9e1af0 Try actually initialising ssh->v1_compressing. With any luck this
will be what was causing Owen's crash report today.

[originally from svn r2156]
2002-10-29 13:05:20 +00:00
Simon Tatham
4756c15fc9 Yet more global-removal. The static variables in logging.c are now
absent, and also (I think) all the frontend request functions (such
as request_resize) take a context pointer, so that multiple windows
can be handled sensibly. I wouldn't swear to this, but I _think_
that only leaves the Unicode stuff as the last stubborn holdout.

[originally from svn r2147]
2002-10-26 12:58:13 +00:00
Simon Tatham
ae09bf1c95 X forwarding authentication is now invented on a per-SSH-connection
basis, so the statics are gone from x11fwd.c.

[originally from svn r2145]
2002-10-26 11:23:15 +00:00
Simon Tatham
948f95d5e8 Reorganised the Unicode layer somewhat: moved luni_send and
lpage_send out into the line discipline, making them _clients_ of
the Unicode layer rather than part of it. This means they can access
ldisc->term, which in turn means I've been able to remove the
temporary global variable `term'. We're slowly getting there.

[originally from svn r2143]
2002-10-26 11:08:59 +00:00
Simon Tatham
24530b945e Port forwarding module now passes backend handles around properly.
As a result I've now been able to turn the global variables `back'
and `backhandle' into module-level statics in the individual front
ends. Now _that's_ progress!

[originally from svn r2142]
2002-10-26 10:33:59 +00:00
Simon Tatham
0b2523eeda Line discipline module now uses dynamically allocated data. Also
fixed one or two other minor problems.

[originally from svn r2141]
2002-10-26 10:16:19 +00:00
Simon Tatham
5df8e45c2e The Zlib module now uses dynamically allocated contexts. I think
that completes the static-removal in the crypto library. Ooh.

[originally from svn r2136]
2002-10-25 13:26:33 +00:00
Simon Tatham
db7196c174 Diffie-Hellman key exchange now uses a dynamically allocated context.
[originally from svn r2135]
2002-10-25 13:08:01 +00:00
Simon Tatham
107d1d875d SSH CRC attack detector now uses a dynamically allocated context.
[originally from svn r2132]
2002-10-25 12:58:21 +00:00
Simon Tatham
8f91f07599 SSH2 MACs now use dynamically allocated contexts.
[originally from svn r2131]
2002-10-25 12:51:28 +00:00
Simon Tatham
9848062b86 SSH ciphers now use dynamically allocated contexts.
[originally from svn r2130]
2002-10-25 12:35:22 +00:00
Simon Tatham
72ff571148 Major destabilisation, phase 2. This time it's the backends' turn:
each backend now stores all its internal variables in a big struct,
and each backend function gets a pointer to this struct passed to
it. This still isn't the end of the work - lots of subsidiary things
still use globals, notably all the cipher and compressor modules and
the X11 forwarding authentication stuff. But ssh.c itself has now
been transformed, and that was the really painful bit, so from here
on it all ought to be a sequence of much smaller and simpler pieces
of work.

[originally from svn r2127]
2002-10-25 11:30:33 +00:00
Jacob Nevins
771b0299c3 Fixes for (Backend)->size() changes -- internal declarations didn't include
new arguments and neither did internal calls.

[originally from svn r2119]
2002-10-23 14:03:11 +00:00
Simon Tatham
a9bd716df8 Cleanups from yesterday's destabilisation: lots of stuff in
terminal.c was apparently relying on implicit initialisation to
zero, and also I've removed the backends' dependency on terminal.h
by having terminal sizes explicitly passed in to back->size().

[originally from svn r2117]
2002-10-23 12:41:35 +00:00
Simon Tatham
0a80c983e2 Major destabilisation, phase 1. In this phase I've moved (I think)
all the global and function-static variables out of terminal.c into
a dynamically allocated data structure. Note that this does not yet
confer the ability to run more than one of them in the same process,
because other things (the line discipline, the back end) are still
global, and also in particular the address of the dynamically
allocated terminal-data structure is held in a global variable
`term'. But what I've got here represents a reasonable stopping
point at which to check things in. In _theory_ this should all still
work happily, on both Unix and Windows. In practice, who knows?

[originally from svn r2115]
2002-10-22 16:11:33 +00:00
Simon Tatham
ace232f5fa Remove last vestiges of `buggymac' in the Config structure. Might
have been cause of a Plink bug since it no longer got initialised.

[originally from svn r1986]
2002-10-01 18:30:15 +00:00
Simon Tatham
a394f20829 Add a new SSH2 bug: some servers apparently claim to be able to do
DH group exchange, but choke when you actually try it. Never
automatically enabled; manual control only.

[originally from svn r1982]
2002-09-26 18:37:33 +00:00
Simon Tatham
30e159d112 Be proactively pedantic about channel-close irregularities: we no
longer just sit there like a lemon if we can't find the channel in
question, we bomb out and complain. With any luck, remaining
problems of this type should be easier to catch under this policy.

[originally from svn r1962]
2002-09-15 13:31:11 +00:00
Simon Tatham
9b69e1b8aa Improvements to SSH1 channel close handling: track sending and
receiving of CLOSE and CLOSE_CONFIRMATION separately rather than
taking short cuts. I believe ssh-1.2.33 sending CLOSE_CONFIRMATION
before CLOSE was causing the remaining incidences of bug
`nonexistent-channel'. (ssh-1.2.33 appears to have unilaterally
decreed that CLOSE and CLOSE_CONFIRMATION are respectively renamed
INPUT_EOF and OUTPUT_CLOSING, hence there is no longer an ordering
constraint on them. Bah.)

[originally from svn r1961]
2002-09-15 13:24:00 +00:00
Jacob Nevins
9f9739602b Semi-bug "long-usernames":
Bump username storage from 32 to 100 chars. Also replaced a couple of magic
numbers with sizeof in ssh.c.
I don't believe this is going to startle any of the protocols PuTTY talks.

[originally from svn r1952]
2002-09-12 16:05:05 +00:00
Simon Tatham
3391745d2d Introduce the Bugs control panel, for overriding PuTTY's server
version number checks to determine the presence or absence of server
bugs.

[originally from svn r1936]
2002-09-08 13:28:38 +00:00
Simon Tatham
b15be34edf Increase length limit on SSH1_MSG_DEBUG; 70 chars is short enough to
lose vital information in some existing servers' messages.

[originally from svn r1932]
2002-09-07 12:27:13 +00:00
Simon Tatham
c24016e0da Add BUG_SSH2_DERIVEKEY, present (according to OpenSSH) in ssh.com
versions 2.0.*, and causing the shared secret not to be included in
key derivation hashes. (This doesn't quite cause a blatant security
hole because the session ID - _derived_ from the shared secret - is
still included.)

[originally from svn r1853]
2002-08-18 09:27:15 +00:00
Simon Tatham
67cb02d03d In SSH2, if decrypting the packet length gave us a negative value,
subsequent packet-receiver code would fail to notice anything was
wrong and segfault. Since this is clearly a silly packet length
anyway, we now explicitly reject it as a daft encryption error.

[originally from svn r1852]
2002-08-18 09:10:17 +00:00
Simon Tatham
4b64ea9db9 Final fixes to keyboard-interactive so it now works with packets
containing more than one prompt instead of less than one, and also
correctly enables echo on prompts that the server requests it for.
In the process I've moved the whole username/password input routine
out into its own function, where it's called independently of which
SSH protocol we're using, so this should even have _saved_ code
size. Rock!

[originally from svn r1830]
2002-08-11 13:02:01 +00:00
Simon Tatham
5ac941933a Oops. Didn't quite get the new SSH protocol selection code right. *blush*
[originally from svn r1818]
2002-08-07 17:57:06 +00:00
Simon Tatham
6e00685af0 Add an option to force SSH1 protocol only. Partly for symmetry;
mostly because I'm about to want it for the -1 command line option.

[originally from svn r1816]
2002-08-07 17:48:26 +00:00
Simon Tatham
118fc8c81e Revamp of command-line handling. Most command line options should
now be processed in cmdline.c, which is called from all utilities
(well, not Pageant or PuTTYgen). This should mean we get to
standardise almost all options across almost all tools. Also one
major change: `-load' is now the preferred option for loading a
saved session in PuTTY proper. `@session' still works but is
deprecated.

[originally from svn r1799]
2002-08-04 21:18:56 +00:00
Simon Tatham
949cecd569 Fix culpable lack of generality in keyboard-interactive
authentication: a k-i request packet can contain any number of auth
prompts (including zero!) and we must ask the user all of them and
send back a packet containing the same number of responses. FreeBSD
systems were sending a zero-prompts packet which was crashing us;
this now appears fixed (we correctly return a zero-responses packet)
but I haven't tested a multiple-prompts packet because I can't
immediately think of a server that generates them.

[originally from svn r1797]
2002-08-03 16:22:55 +00:00
Simon Tatham
3f8d151c5a One of the recent port forwarding crash reports contained details
which suggested bufchain_prefix() was finding an improperly
initialised bufchain structure. Looking at the code, this may indeed
have been able to happen, since the bufchain in a SOCKDATA_DORMANT
channel was not initialised until CHANNEL_OPEN_CONFIRMATION was
received. This seems utterly daft, so I now call bufchain_init()
when the channel structure is actually created. With any luck the
crash will mystically disappear now (I wasn't able to reproduce it
myself).

[originally from svn r1735]
2002-06-15 16:52:35 +00:00
Simon Tatham
858441ba81 Workaround for the SSH2 RSA padding bug in OpenSSH 2.5 - 3.2
inclusive. Padding is accomplished by rewriting the signature blob
rather than at the point of generation, in order to avoid having to
move part of the workaround into Pageant (and having to corrupt the
agent wire protocol to allow PuTTY to specify whether it wants its
signatures padded!).

[originally from svn r1708]
2002-05-31 17:39:16 +00:00
Simon Tatham
8cdae4f73b ieof-for-nonexistent-channel problem: avoid comparing an unsigned with -1
[originally from svn r1686]
2002-05-17 12:33:20 +00:00
Owen Dunn
c71432cb86 SSH2 only support
[originally from svn r1664]
2002-05-11 13:08:37 +00:00
Simon Tatham
8c3a0eb50b Improved error messages if you use the wrong key type: you should
now be told that the key is the wrong type, _and_ what type it is,
rather than being given a blanket `unable to read key file' message.

[originally from svn r1662]
2002-05-11 12:13:42 +00:00
Simon Tatham
17af65c78c Remember to wait for SSH1_MSG_SUCCESS after enabling remote port
forwardings in SSH1. Was causing several MSG_SUCCESS to be queued up
unread, which was wrong-but-benign in most cases but caused a hard
crash with compression enabled (one of those uncompressed
MSG_SUCCESSes was fed to the zlib decompressor with spectacular
results).

[originally from svn r1609]
2002-03-27 21:58:11 +00:00
Simon Tatham
e40f043ff8 Matt Harden's (modified) patch to do getservbyname() lookups on port-
forwarding port numbers.

[originally from svn r1608]
2002-03-27 21:43:37 +00:00
Simon Tatham
36d125e1d7 Attempt to ensure that everything passed to connection_fatal() is
also logged to the Event Log, so that it's easy to cut-and-paste the
error message afterwards.

[originally from svn r1599]
2002-03-23 18:04:27 +00:00
Simon Tatham
eabd704d1e Justin Bradford's proxy support patch. Currently supports only HTTP
CONNECT, but contains an extensible framework to allow other
proxies. Apparently SOCKS and ad-hoc-telnet-proxy are already
planned (the GUI mentions them already even though they don't work
yet). GUI includes full configurability and allows definition of
exclusion zones. Rock and roll.

[originally from svn r1598]
2002-03-23 17:47:21 +00:00
Simon Tatham
869989e7e6 Pedantic little patch to ensure blank usernames work vaguely as
expected, in case anyone really wants to use one

[originally from svn r1596]
2002-03-20 22:34:00 +00:00
Simon Tatham
dac0d45699 Ensure our network layer is properly cleaned up before PuTTY exits.
Specifically, we explicitly closesocket() all open sockets, which
appears to be necessary since otherwise Windows sends RST rather
than FIN. I'm _sure_ that's a Windows bug, but there we go.

[originally from svn r1574]
2002-03-06 20:13:22 +00:00
Simon Tatham
ae7c314f33 Set SSH socket variable to NULL if connect() fails. Failure to do
this was causing PSCP to hang indefinitely after reporting
Connection Refused.

[originally from svn r1569]
2002-02-27 22:45:52 +00:00
Simon Tatham
84c3ece865 Cisco routers apparently have yet another bug: they can't handle RSA
auth attempts at all without panicking and bombing out. Workaround
added.

[originally from svn r1568]
2002-02-27 22:41:31 +00:00
Simon Tatham
e6cc16b8b2 Add support for sending SSH2_MSG_UNIMPLEMENTED for unrecognised
messages; also do something with the debugging messages sent as
SSH2_MSG_DEBUG.

[originally from svn r1544]
2002-01-10 19:50:53 +00:00
Simon Tatham
46803abdbe Support SSH2_MSG_GLOBAL_REQUEST (just return failure)
[originally from svn r1542]
2002-01-10 16:42:17 +00:00
Simon Tatham
cf8190f637 Extra safety feature to avoid sending SSH2_MSG_WINDOW_ADJUST on
a nonexistent channel. I don't quite know why this was happening,
but whatever it was this ought to fix it.

[originally from svn r1540]
2002-01-10 13:29:43 +00:00
Simon Tatham
d237773599 Add the CRC32 compensation attack detector that all other SSH
clients have had for ages and I forgot about. Of course I've got the
version with the buffer overflow fixed!

[originally from svn r1535]
2002-01-08 11:57:32 +00:00
Simon Tatham
ccf9a051ca I have no brain at all. The SSH1 auth loop was trying all Pageant
keys before _every_ other authentication; so if you tried a local
pubkey _and_ a password, for example, you'd also try Pageant twice.
Now fixed.

[originally from svn r1524]
2001-12-30 16:27:07 +00:00
Simon Tatham
2ce502eae2 PuTTY can now detect when one of the Pageant keys it tries matches
the private key file given in the config; if it spots this then it
avoids trying it again (and in particular avoids needing to ask for
the passphrase when it knows perfectly well it won't work).

[originally from svn r1523]
2001-12-30 16:20:31 +00:00
Simon Tatham
ef885c78ca Add a new back-end function to return the exit code of the remote
process. This is functional in SSH, and vestigial (just returns 0)
in the other three protocols. Plink's Windows exit code is now
determined by the remote process exit code, which should make it
more usable in scripting applications. Tested in both SSH1 and SSH2.

[originally from svn r1518]
2001-12-29 15:31:42 +00:00
Simon Tatham
88a3baa065 Add the remote counterpart for the `local port forwardings accept
connections from outside localhost' switch. Interestingly OpenSSH
3.0 appears to ignore this (though I know it works because ssh.com
3.0 gets it right, and the SSH packet dump agrees that I'm doing the
right thing).

[originally from svn r1496]
2001-12-15 12:15:24 +00:00
Simon Tatham
3ed0d44f16 Retired the #ifdef DUMP_PACKETS stuff in ssh.c because I'm utterly
sick of recompiling to enable packet dumps. SSH packet dumping is
now provided as a logging option, and dumps to putty.log like all
the other logging options. While I'm at it I cleaned up the format
so that packet types are translated into strings for easy browsing.
POSSIBLE SIDE EFFECT: in the course of this work I had to re-enable
the SSH1 packet length checks which it turns out hadn't actually
been active for some time, so it's possible things might break as a
result. If need be I can always disable those checks for the 0.52
release and think about it more carefully later.

[originally from svn r1493]
2001-12-14 14:57:50 +00:00
Simon Tatham
7983d2dd28 Disable username switching between SSH2 auth attempts, and add a
configurable option so users can re-enable the feature _if_ they
know they have an SSH2 server that isn't going to get shirty about
it. Inspired by a spectacular increase in OpenSSH's shirtiness.

[originally from svn r1474]
2001-12-11 21:00:01 +00:00
Simon Tatham
46f2897cf6 Apparently sending DISCONNECT on a normal SSH2 connection close is
actually _less_ polite than just closing the connection, rather than
more polite as I'd believed. So we now just close.

[originally from svn r1468]
2001-12-10 18:12:51 +00:00
Simon Tatham
994bb17c57 Make the nonstandard "des-cbc" cipher disabled by default
[originally from svn r1429]
2001-11-29 22:26:52 +00:00
Simon Tatham
3270c74f9e Configurable TCP_NODELAY option on network connections
[originally from svn r1428]
2001-11-29 21:47:11 +00:00
Simon Tatham
82e7fd0f23 Make keyboard-interactive authentication configurable off. (This is
a stopgap until we get round to a proper authentications preference
list.)

[originally from svn r1426]
2001-11-29 20:34:06 +00:00
Simon Tatham
64df2cd90f Remember to terminate the prompt string in keyboard-interactive
[originally from svn r1425]
2001-11-29 20:27:20 +00:00
Simon Tatham
b49fde9410 Add single-DES support in SSH2
[originally from svn r1396]
2001-11-21 23:06:10 +00:00
Jacob Nevins
dd4bfacd9a Primitive protection against SSH2 not actually agreeing a cipher in
either direction.

[originally from svn r1394]
2001-11-21 22:48:20 +00:00
Simon Tatham
15517300d8 Send SSH2_MSG_NEWKEYS _before_ expecting to receive it, rather than
after. Shouldn't make a difference for any server that previously
worked, but we should now interoperate sensibly with servers that
wait to receive our NEWKEYS before sending their own. Apparently
Unisphere produce one such.

[originally from svn r1390]
2001-11-21 22:06:53 +00:00
Simon Tatham
7530a9905a Handle incoming SSH2_MSG_CHANNEL_REQUEST (by refusing all requests).
Should have done this ages ago; the OpenSSH 3.0 ClientAliveInterval
mechanism requires it so now it's really necessary.

[originally from svn r1380]
2001-11-13 22:06:37 +00:00
Simon Tatham
818176c66f Oops - one missing set of the ssh1 throttling indicator
[originally from svn r1377]
2001-11-10 17:09:17 +00:00
Simon Tatham
f2319456bc Tidy up the SERIOUS NETWORK ERROR fixes
[originally from svn r1345]
2001-10-30 20:57:22 +00:00
Simon Tatham
d1e305543a Tidy up SSH packet-level debugging
[originally from svn r1344]
2001-10-30 20:35:29 +00:00
Simon Tatham
8493e83d74 Add remaining comments to the last checkin (gah, remember to hit
Save in the editor _before_ running cvs commit).

[originally from svn r1333]
2001-10-27 11:06:11 +00:00
Simon Tatham
6c9cdbe29f Update to password length traffic analysis: one Cisco router can
apparently not deal with SSH1_MSG_IGNORE _or_ padded passwords, so
we must fall back to sending an undefended password.

[originally from svn r1332]
2001-10-27 10:39:54 +00:00
Simon Tatham
28292dbc95 `Server got confused by' error messages now quote a packet type, so
I can start debugging as soon as I get one sent to me.

[originally from svn r1304]
2001-09-26 20:29:03 +00:00
Simon Tatham
39c3f9b8bc Fix pasting of newlines in local line editing mode. Possibly not a
very _good_ fix; something might want doing after the release.

[originally from svn r1277]
2001-09-19 20:07:15 +00:00
Simon Tatham
2e4480d6b6 SSH back end should now be tolerant of garbage appearing in the data
stream after the actual SSH connection is finished. Some firewalls
add this for no good reason.

[originally from svn r1271]
2001-09-18 18:16:56 +00:00
Simon Tatham
7bb4a9f5f0 Be more careful of bombouts at the s_rdpkt level: if these happen
(for example SSH_MSG_DISCONNECT) we should avoid even calling
ssh_protocol.

[originally from svn r1259]
2001-09-09 14:47:29 +00:00
Simon Tatham
b12f450964 Jacob's TIS / CCard authentication tweaks.
[originally from svn r1253]
2001-09-08 12:50:15 +00:00
Simon Tatham
a3bfa43b0f Fix error message: couldn't load _private_ key, not public.
[originally from svn r1251]
2001-09-08 11:57:00 +00:00
Simon Tatham
2e4cefa420 When we receive SSH_MSG_DISCONNECT, say so in an error box because
it's likely to be more helpful than `Strange packet received' or
whatever.

[originally from svn r1250]
2001-09-08 10:33:56 +00:00
Simon Tatham
f08de20a1e Robert de Bath's asynchronous-connect patch. Helps a lot in port
forwarding; improves Event Log; and causes the PuTTY window to
appear earlier in the setup process.

[originally from svn r1239]
2001-09-07 22:39:01 +00:00
Simon Tatham
47e97ae032 Fix gratuitous assertion failure in Plink (ssh1_throttle_count was
being decremented far too many times).

[originally from svn r1238]
2001-09-07 22:04:44 +00:00
Simon Tatham
d1d2fd7a13 D'oh! Putting keyboard-interactive authentication _before_ publickey
causes password login to occur on a server that supports password-
through-k-i. Of course when we use the new preference list mechanism
for selecting the order of authentications this will all become much
more sane, but for the moment I've put publickey back up to the top
and things seem to be happier.

[originally from svn r1220]
2001-08-28 08:43:33 +00:00
Simon Tatham
ea27f048f9 Fix various small compiler warnings, mostly unused local variables
[originally from svn r1218]
2001-08-28 08:08:43 +00:00
Simon Tatham
5c646f3270 Fix handling of SSH2_MSG_CHANNEL_CLOSE, which was breaking in port
forwarding talking to ssh.com's ssh-3.0.1.

[originally from svn r1216]
2001-08-27 16:58:47 +00:00
Simon Tatham
254f50974e Port forwarding bug fix: we were unable to handle receiving
CHANNEL_OPEN_FAILURE messages, which occur when the remote side is
unable to open a forwarded network connection we have requested. (It
seems they _don't_ show up if you get something mundane like
Connection Refused - the channel is cheerfully opened and
immediately slammed shut - but they do if you try to connect to a
host that doesn't even exist. Try forwarding a port to
frogwibbler:4800 and see what you get.)

[originally from svn r1213]
2001-08-27 15:13:14 +00:00
Simon Tatham
ff9a038cdd PSCP now uses the modern SFTP protocol if it can, and falls back to
scp1 if it can't. Currently not very tested - I checked it in as
soon as it completed a successful recursive copy in both directions.
Also, one known bug: you can't specify a remote wildcard, because by
the nature of SFTP we'll need to implement the wildcard engine on
the client side. I do intend to do this (and use the same wildcard
engine in PSFTP as well) but I haven't got round to it yet.

[originally from svn r1208]
2001-08-26 18:32:28 +00:00
Simon Tatham
44c4ee79e6 Jacob's patch for a drag-list to select SSH ciphers. Heavily hacked
by me to make the drag list behaviour slightly more intuitive.
WARNING: DO NOT LOOK AT pl_itemfrompt() IF YOU ARE SQUEAMISH.

[originally from svn r1199]
2001-08-25 19:33:33 +00:00
Simon Tatham
c87fa98d09 Extensive changes that _should_ fix the socket buffering problems,
by ceasing to listen on input channels if the corresponding output
channel isn't accepting data. Has had basic check-I-didn't-actually-
break-anything-too-badly testing, but hasn't been genuinely tested
in stress conditions (because concocting stress conditions is non-
trivial).

[originally from svn r1198]
2001-08-25 17:09:23 +00:00
Simon Tatham
7ff3999e49 Oops - fix that fix :-/
[originally from svn r1197]
2001-08-22 20:23:49 +00:00
Simon Tatham
96fd4be809 Fix to allow more than one challenge/response pair during
keyboard-interactive authentication. UNTESTED except that I checked
it compiles. Will ask for testing from the user who complained.

[originally from svn r1195]
2001-08-22 19:47:05 +00:00
Simon Tatham
24e97a365d Trivial port forwarding fixes from Jacob
[originally from svn r1185]
2001-08-15 18:23:50 +00:00
Simon Tatham
9cbaacd673 Stop yelling about Access Denied if the server refuses even to
attempt keyboard-interactive authentication. We can yell about it if
we make a creditable attempt and are rejected, but if the server
just refuses to even consider it then the user won't really want to
know (and if they do there's the Event Log).

[originally from svn r1180]
2001-08-09 21:22:38 +00:00
Simon Tatham
54bcab760f Port forwarding now works in SSH 2 as well as SSH 1.
[originally from svn r1179]
2001-08-09 21:17:05 +00:00
Simon Tatham
fa6b9c1896 Keyboard-interactive authentication, thanks to Paul Sokolovsky.
[originally from svn r1178]
2001-08-09 20:13:17 +00:00
Simon Tatham
50766ce729 SSH port forwarding! How cool is that?
Only currently works on SSH1; SSH2 should be doable but it's late
and I have other things to do tonight. The Cool Guy award for this
one goes to Nicolas Barry, for doing most of the work and actually
understanding the code he was adding to.

[originally from svn r1176]
2001-08-08 20:44:35 +00:00
Simon Tatham
4fb01728e1 Fix segfault if the server maliciously sends the wrong type of key
after a different type has been agreed.

[originally from svn r1165]
2001-08-04 12:37:43 +00:00
Simon Tatham
a4c1aad9b2 Yet another possible segfault path in the backends fixed. I don't
_believe_ I'm still finding these. I have no idea what I was
thinking when I wrote this stuff.

[originally from svn r1162]
2001-07-31 14:23:21 +00:00
Simon Tatham
fb473cc16c Placate gcc's `-Wall' warnings.
[originally from svn r1121]
2001-05-13 14:02:28 +00:00
Simon Tatham
839353ad3a Control characters are now allowed as part of the password, if
they're not special control characters processed by the line input
routines.

[originally from svn r1116]
2001-05-13 11:44:57 +00:00
Simon Tatham
e45f75a2be Attempt to report the error condition right when an SCP connection
with a pre-supplied password fails to authenticate.

[originally from svn r1114]
2001-05-13 11:15:16 +00:00
Simon Tatham
c2eb57a034 `realhost', passed back from all the backend init functions, was
scoped within those functions. It's now dynamically allocated.

[originally from svn r1108]
2001-05-09 14:01:15 +00:00
Simon Tatham
3730ada5ce Run entire source base through GNU indent to tidy up the varying
coding styles of the various contributors! Woohoo!

[originally from svn r1098]
2001-05-06 14:35:20 +00:00
Simon Tatham
f30937f737 Debugging improvements. Started using Dave Hinton's dmemdump
function (woohoo!), improved that function so it provides an ASCII
dump as well as hex (whee!), removed all remaining spurious \r in
debug statements (ooh!), and made enabling of packet debugging in
SSH a matter of one ifdef rather than lots (phew!).

[originally from svn r1091]
2001-04-28 17:35:18 +00:00
Simon Tatham
76dfe1cac9 Fix completely stupid agent_exists test. (Hint to self: you have to
actually _call_ a boolean-returning function, not just test its
address for nonzerohood.) Thanks Jacob.

[originally from svn r1082]
2001-04-28 11:25:58 +00:00
Simon Tatham
b7844a20af Add some fflushes to make it easier for piped programs to talk to
plink and pscp

[originally from svn r1078]
2001-04-28 08:42:06 +00:00
Simon Tatham
3abea3d4ea Having now compiled the last few days' changes with MSVC, it's turned
up a bunch of warnings, mostly unused variables. All fixed.

[originally from svn r1058]
2001-04-17 08:24:29 +00:00
Simon Tatham
03c9b6107b Replace PuTTY's 2-3-4 tree implementation with the shiny new counted
one, in preparation for using it to speed up scrollback.

[originally from svn r1053]
2001-04-16 17:18:24 +00:00
Simon Tatham
522f130391 Pageant interface changes. You can now do `pageant -c command' to
spawn another command after starting Pageant. Also, if Pageant is
already running, `pageant keyfile' and `pageant -c command' will do
the Right Thing, that is, add the key to the _first_ Pageant and/or
run a command and then exit. The only time you now get the `Pageant
is already running' error is if you try to start the second copy
with no arguments.
NB the affected files in this checkin are rather wide-ranging
because I renamed the not really SSH1-specific
`ssh1_bignum_bitcount' function to just `bignum_bitcount'.

[originally from svn r1044]
2001-04-16 11:16:58 +00:00
Simon Tatham
fb8745a7d7 Log the text message in SSH_MSG_DISCONNECT (both protocols) so that
when people submit Event Logs for diagnosis it's a little easier to
work out what's up.

[originally from svn r1043]
2001-04-16 09:10:34 +00:00
Simon Tatham
36df70978a After we fall back to 3DES, double-check the server really does
support it, and bomb out with a complaint if not.

[originally from svn r1042]
2001-04-16 07:49:11 +00:00
Simon Tatham
1734a09466 Experimental checkin to see if we can prevent multiple closes ever
being sent on an SSH1 forwarding (or indeed primary) channel.

[originally from svn r1037]
2001-04-11 12:29:35 +00:00
Simon Tatham
ab3443b9e6 Fix the detect_bugs routine, which was failing to find the right bit
of the version string :-)

[originally from svn r1026]
2001-03-29 13:40:03 +00:00
Simon Tatham
6a4294fbac Fix the SSH protocol version exchange, which had a weird stack trash
in it which for some reason didn't show up when built with VC++6 but
blew up the nightlies. Should be OK now.

[originally from svn r1023]
2001-03-23 10:28:36 +00:00
Simon Tatham
4d881300c8 Remove the length limit on protocol version strings. (In principle, I
could have got away with upping it to 256, but I didn't want a repeat
of the chaos when some server accidentally breaks that limit too...)

[originally from svn r1019]
2001-03-22 17:32:40 +00:00
Simon Tatham
0cda163a2d Plink in noninteractive-script mode should not show the `Authenticated
with public key' message in SSH2 (it already doesn't in SSH1). It
shouldn't show the login banner either, since its output is probably
redirected to something which will choke on it.

[originally from svn r1011]
2001-03-19 10:27:59 +00:00
Simon Tatham
4b5cda8aaa Add Norman Brandinger's suggested `-m' option in plink, to read the
remote command from a local file. Advantage: you can have more than
one line in it, so you can remotely run what's effectively a small
script.

[originally from svn r1010]
2001-03-19 10:24:55 +00:00
Simon Tatham
c152034706 SSH2 channel fix: received WINDOW_ADJUSTs were always applied to the
primary (shell session) channel, rather than the one they were aimed
at. This _despite_ me having deliberately gone and looked the channel
ID up in the B-tree - I was ignoring the result by accident :-/

X forwarding should now work in SSH2 even on non-trivial clients (ie
things other than xdpyinfo).

[originally from svn r1007]
2001-03-16 12:09:44 +00:00
Simon Tatham
02f012a66a Correct handling of SSH1 protocol flags, in particular
PROTOFLAG_SCREEN_NUMBER, without which OpenSSH 2.5.1 was objecting to
my gratuitous inclusion of a screen number in the SSH1 X forwarding
request. Ahem.

[originally from svn r1006]
2001-03-16 11:58:54 +00:00
Simon Tatham
947d33408f Add support for SSH2 userauth banners. We currently can't deal with
printing them _before_ the username prompt. This apparently isn't very
serious because OpenSSH doesn't _send_ it before the username prompt,
but only in response to USERAUTH_REQUEST "none". Good job we do that!

[originally from svn r1005]
2001-03-15 17:14:31 +00:00
Simon Tatham
080d59422b At long last: PuTTY will now report its version to the server
sensibly, as a release or a snapshot or a local build. With any luck
this should make bug reporting easier to handle, because anyone who
sends their Event Log should automatically include the version :-)

[originally from svn r1003]
2001-03-15 12:15:02 +00:00
Simon Tatham
4b5a97fbee Fix a few trivial compiler warnings
[originally from svn r1001]
2001-03-15 11:39:17 +00:00
Simon Tatham
31d6765aca Bit more robustness when talking to Pageant
[originally from svn r1000]
2001-03-15 11:38:02 +00:00
Simon Tatham
1a9d213a74 Oops - don't invent an X authorisation when doing agent forwarding!
Overenthusiastic c'n'p breaks the world.

[originally from svn r999]
2001-03-15 11:32:23 +00:00
Simon Tatham
c760ef6f83 Fix a segfault on abrupt X connection shutdown.
[originally from svn r998]
2001-03-15 11:19:59 +00:00
Simon Tatham
7b0e082700 Dave Hinton's modifications to the network layer interface, which
should make it possible to add SSL support later.

[originally from svn r996]
2001-03-13 10:22:45 +00:00
Simon Tatham
55659a959f ssh_get_password has become ssh_get_line, so it can handle usernames
as well. This should fix the multiple-reads-on-stdin bug in plink.

[originally from svn r994]
2001-03-12 15:31:53 +00:00
Simon Tatham
9ee21069b5 Zero length passwords no longer cause an assertion failure :-)
[originally from svn r993]
2001-03-12 15:12:33 +00:00
Simon Tatham
d823077f18 Add support for using Diffie-Hellman with short exponents (sshdh.c
contains a reference to a paper on the subject). Reduces time taken
for DH group exchange to the point where it's viable to enable it
all the time, so I have. :-)

[originally from svn r991]
2001-03-10 11:04:07 +00:00
Simon Tatham
630a9a628f Having introduced a new function into the SSH2 compression structure,
it would help if I implemented it in the dummy no-compression case!

[originally from svn r987]
2001-03-08 10:07:22 +00:00
Simon Tatham
a34ef3df55 Introduce the ability to distinguish remote SSH implementations by
their version strings and enable bug compatibility modes.

[originally from svn r985]
2001-03-06 10:32:28 +00:00
Simon Tatham
48c0729310 Update a couple of messages to be clearer to users who don't have
access to complete documentation (ie all of them at the moment :-)

[originally from svn r984]
2001-03-06 09:29:43 +00:00
Simon Tatham
aaeecbb4ea Make the SSH2 traffic analysis defence robust in the face of Zlib
compression. This involves introducing an option to disable Zlib
compression (that is, continue to work within the Zlib format but
output an uncompressed block) for the duration of a single packet.

[originally from svn r982]
2001-03-05 16:38:42 +00:00
Simon Tatham
a1d5dab580 Further traffic analysis defences
[originally from svn r981]
2001-03-05 10:32:36 +00:00
Simon Tatham
16f4ffe616 Implement OpenSSH's private agent forwarding extension. I believe we
now interoperate with OpenSSH/SSH2 to _exactly_ the same level as we
interoperate with SSH1. Which is pretty cool really.

[originally from svn r980]
2001-03-03 16:38:44 +00:00
Simon Tatham
de1c70a5d4 Remove a spurious \r\n from an Event Log message
[originally from svn r978]
2001-03-03 16:05:52 +00:00
Simon Tatham
245cf9c8c9 SSH2 can now use Pageant to obtain keys from
[originally from svn r977]
2001-03-03 15:56:39 +00:00
Simon Tatham
deccfaa3ef The authentication diagnostics in SSH2 should now be better.
Additionally, the ability to switch usernames if you mistype the
first one has been restored (although it didn't actually work
because OpenSSH didn't feel like playing; patch submitted :-).

[originally from svn r975]
2001-03-03 13:53:44 +00:00
Simon Tatham
28b1fc766c Preliminary support for RSA user authentication in SSH2! Most of the
error messages are currently wrong, and Pageant doesn't yet support
the new key type, and I haven't thoroughly tested that falling back
to password authentication and trying invalid keys etc all work. But
what I have here has successfully performed a public key
authentication, so it's working to at least some extent.

[originally from svn r973]
2001-03-03 11:54:34 +00:00
Simon Tatham
97ace7d80d Added support for RSA host keys (not user keys yet)
[originally from svn r969]
2001-03-02 17:13:36 +00:00
Simon Tatham
b182356f99 Support for selecting AES from the GUI. In the process, I've had to
introduce another layer of abstraction in SSH2 ciphers, such that a
single `logical cipher' (as desired by a user) can equate to more
than one `physical cipher'. This is because AES comes in several key
lengths (PuTTY will pick the highest supported by the remote end)
and several different SSH2-protocol-level names (aes*-cbc,
rijndael*-cbc, and an unofficial one rijndael-cbc@lysator.liu.se).

[originally from svn r967]
2001-03-02 13:55:23 +00:00
Simon Tatham
bf25fd405c Add AES support in SSH2. Not yet complete: there's no way to select
it in the GUI (or even in the registry).

[originally from svn r966]
2001-03-02 11:44:35 +00:00
Simon Tatham
cc9d7ba87e Diffie-Hellman group exchange in SSH2. Currently #ifdeffed out
(change the sense of #ifdef DO_DIFFIE_HELLMAN_GEX in ssh.c) because
it's _far_ too slow. Will be re-enabled once the bignum routines
work a bit faster (or rather a _lot_ faster).

[originally from svn r962]
2001-03-01 17:55:40 +00:00
Simon Tatham
f72b5aa95f Remove the last lingering knowledge, outside sshbn.c, of the
internal structure of the Bignum type. Bignum is now a fully opaque
type unless you're inside sshbn.c.

[originally from svn r960]
2001-03-01 17:41:26 +00:00
Simon Tatham
39cf689fd6 psftp now works as part of the PuTTY suite
[originally from svn r940]
2001-02-24 16:08:56 +00:00
Simon Tatham
5cdfd67cd1 Add a traffic analysis defence to SSH2 password authentication
[originally from svn r936]
2001-02-23 13:15:17 +00:00
Simon Tatham
8a4206e636 Attempt to fix the remaining key re-exchange bug
[originally from svn r934]
2001-02-20 13:55:59 +00:00
Simon Tatham
60585cff9c Yet another attempt at OOB handling in the network abstraction. This
version allows you to specify, per socket, which sockets receive OOB
data in-line (so that you know what was before the mark and what was
after) and which receive it out of line (so it's really a one-byte
out-of-band facility rather than discard-to-mark). This reflects the
fact that rlogin appears to make more sense in the latter mode, and
telnet in the former. This patch makes rlogin work right for me.

[originally from svn r921]
2001-02-01 14:11:04 +00:00
Simon Tatham
362d3deaf1 Prevent duplicate sk_close() calls on the same socket when the
connection dies unexpectedly (CONNABORTED / CONNRESET)

[originally from svn r910]
2001-01-29 14:30:59 +00:00
Simon Tatham
6017418fca Remove a segfault in bombout() macro: don't sk_close() the socket if
it's already NULL. The `Incorrect MAC' problem was causing
ssh2_rdpkt to bombout(), setting s to NULL, and then a secondary
bombout() was happening at the next level up, causing a segfault.

[originally from svn r909]
2001-01-29 13:19:59 +00:00
Simon Tatham
65b47c59c6 Fix the SSH2 key re-exchange bug. Session id != exchange hash,
because the session id is the exchange hash from the _first_ key
exchange, so in subsequent key exchanges they're different.

[originally from svn r901]
2001-01-26 18:50:13 +00:00
Simon Tatham
62a76699ad Ensure all backends _remember_ the connection has closed after
receiving a network error. Should prevent the cascading-error-box
bug.

[originally from svn r900]
2001-01-26 12:22:16 +00:00
Simon Tatham
7a79df8fe6 Rethink the whole line discipline architecture. Instead of having
multiple switchable line disciplines, we now have a single unified
one which changes its behaviour based on option settings. Each
option setting can be suggested by the back end and/or the terminal
handler, and can be forcibly overridden by the configuration. Local
echo and local line editing are separate, independently switchable,
options.

[originally from svn r895]
2001-01-24 14:08:20 +00:00
Simon Tatham
89505459e3 Improve socket error handling so that a socket error isn't an
automatic fatalbox(). Instead, the error is passed to the receiver
routine, which can decide just how fatal the problem really is.

[originally from svn r894]
2001-01-24 10:11:18 +00:00
Simon Tatham
1eb0308ad7 Remove the entirely pointless fourth parameter from x11_init().
[originally from svn r889]
2001-01-23 11:02:02 +00:00
Simon Tatham
83066d174c Bring the SSH2 channel architecture up to scratch, enabling X
forwarding to work under SSH2. Also - surprise! - implement X
forwarding under SSH2.

[originally from svn r882]
2001-01-22 15:36:07 +00:00
Simon Tatham
4a339ef430 Add X11 forwarding, mainly thanks to Andreas Schultz
[originally from svn r878]
2001-01-22 11:34:52 +00:00
Simon Tatham
ca90be26a8 Experimental Rlogin support, thanks to Delian Delchev. Local flow
control is unsupported, and server-to-client comms may fail for want
of working TCP Urgent.

[originally from svn r875]
2001-01-19 10:10:37 +00:00
Simon Tatham
e364010d4f Trivial fix for when the two directions select different encryption
algorithms

[originally from svn r869]
2001-01-17 16:57:15 +00:00
Simon Tatham
43dff68308 Oops - accidentally undid rev 1.82 [r844]
[originally from svn r853]
[r844 == eac718ee1b]
2001-01-09 17:16:43 +00:00
Simon Tatham
609593e119 Ensure ssh specials (EOF and PING) don't occur except in connection
states where they're meaningful. In case Plink misses an EOF by
attempting to send it before reaching SSH_STATE_SESSION, it is
buffered and sent later. PINGs can be sent during any part of the
initialisation phase _except_ before deciding whether to use
protocol 1 or 2.

[originally from svn r850]
2001-01-08 13:57:45 +00:00
Simon Tatham
eac718ee1b Adam D Ligas's segfault: one form of connection closure was failing
to set SSH_STATE_CLOSED, causing subsequent resize events to go foom.

[originally from svn r844]
2001-01-07 17:18:12 +00:00
Simon Tatham
7a580aa4d8 Attempt to get repeated key exchange working in SSH2. Still under
test - might not be 100%. I think it _ought_ to work though.

[originally from svn r826]
2000-12-18 09:20:08 +00:00
Simon Tatham
c34ff1bcbf Fix an intermittent segfault that prevented the new Zlib compression
from being very useful. (Thanks to Minefield for catching it.)

[originally from svn r820]
2000-12-12 11:07:59 +00:00
Simon Tatham
d5240d4157 Make memory management uniform: _everything_ now goes through the
smalloc() macros and thence to the safemalloc() functions in misc.c.
This should allow me to plug in a debugging allocator and track
memory leaks and segfaults and things.

[originally from svn r818]
2000-12-12 10:33:13 +00:00
Simon Tatham
8eca227b92 Improve SSH2 host key abstraction into a generic `signing key'
abstraction, so as to be able to re-use the same abstraction for
user authentication keys and probably in the SSH2 agent (when that
happens) as well.

[originally from svn r815]
2000-12-02 12:48:15 +00:00
Simon Tatham
6bdd92be5f Fix bugtraq 1949: server could open an agent forwarding channel even
if agent forwarding had not been negotiated on, and more
particularly even if it had been deliberately disabled by the user.

[originally from svn r814]
2000-12-02 11:43:25 +00:00
Simon Tatham
d094883d3c Fix segfault when you press a key before the SSH protocol decides whether
it's doing SSH1 or SSH2. Only visible on slow servers :-)

[originally from svn r803]
2000-11-21 10:53:10 +00:00
Simon Tatham
462063cdc5 Implement Zlib compression, in both SSH1 and SSH2.
[originally from svn r792]
2000-11-01 21:34:21 +00:00
Simon Tatham
696400a672 Stop the "Sent username %s" message coming up twice in pscp -v
[originally from svn r772]
2000-10-27 09:24:32 +00:00
Simon Tatham
2c9c817895 Misc bugfixes
[originally from svn r771]
2000-10-27 09:17:19 +00:00
Simon Tatham
eab981fbd1 Format SSH2_MSG_DISCONNECT correctly (with reason code, reason
string, and language tag).

[originally from svn r770]
2000-10-26 13:10:47 +00:00
Simon Tatham
809bd81d5c Fix another bignum formatting problem. This one hit Diffie-Hellmann
[originally from svn r761]
2000-10-24 21:43:39 +00:00
Simon Tatham
5ff9cc2f1f SSH2 connections weren't closing cleanly after socket revamp. Fixed.
[originally from svn r754]
2000-10-24 09:55:45 +00:00
Simon Tatham
039103ff5d Window resizing wasn't working in SSH2
[originally from svn r753]
2000-10-24 09:49:03 +00:00
Simon Tatham
bbbda4110b Created a shiny new abstraction for the socket handling. Has many
advantages:
 - protocol modules can call sk_write() without having to worry
   about writes blocking, because blocking writes are handled in the
   abstraction layer and retried later.
 - `Lost connection while sending' is a thing of the past.
 - <winsock.h> is no longer needed in most modules, because
   "putty.h" doesn't have to declare `SOCKET' variables any more,
   only the abstracted `Socket' type.
 - select()-equivalent between multiple sockets will now be handled
   sensibly, which opens the way for things like SSH port
   forwarding.

[originally from svn r744]
2000-10-23 10:32:37 +00:00
Simon Tatham
e32603347c Introduce a sane interface function, from_backend(), for backends to
use when they have data from the network. Replaces the utterly daft
inbuf / inbuf_head / term_out() interface, which only made sense
when feeding to terminal.c. (terminal.c now implements
from_backend() as a small function that gateways to the old
interface.)

As a side effect, from_backend() also has an `is_stderr' parameter,
so scp can once again separate the server's pronouncements on stderr
from the actual protocol progress on stdout.

[originally from svn r729]
2000-10-20 13:51:46 +00:00
Simon Tatham
8d0bee8629 PuTTYgen initial version. Still to do are basic user-friendliness
features (prompt for passphrase twice, prompt before overwriting a
file, check the key file was actually saved OK), testing of the
generated keys to make sure I got the file format right, and support
for a variable key size. I think what's already here is basically
sound though.

[originally from svn r715]
2000-10-19 15:43:08 +00:00
Simon Tatham
f543b08ca5 Add some more commented-out diagnostics for ssh1
[originally from svn r713]
2000-10-18 15:33:05 +00:00
Simon Tatham
95697270b5 Implement MD5 MAC for the benefit of old SSH2 servers
[originally from svn r709]
2000-10-12 14:24:58 +00:00
Simon Tatham
fd3e15f328 Miscellaneous fixes for better interoperation with commercial SSH 2
[originally from svn r708]
2000-10-12 13:34:46 +00:00
Simon Tatham
3e83d75154 Add a config option to emulate the HMAC bug in commercial SSH v2.3.x
and earlier (namely, it uses only 16 bytes of key rather than 20).

[originally from svn r706]
2000-10-12 12:39:44 +00:00
Simon Tatham
fd5588d087 Robert de Bath's big patch:
- cope with strange WinSock wrappers not supporting SIOCATMARK
  - define yet more terminal compatibility modes
  - support UK-ASCII (just like US-ASCII but # is a sterling sign)
  - support connection keepalives at a configurable interval

[originally from svn r692]
2000-10-09 12:53:32 +00:00
Simon Tatham
8c169b0c6d Tighten up use of "static" throughout. Module-internal things should NOT
be exported willy-nilly. It encourages people to use them.

[originally from svn r677]
2000-10-06 11:42:30 +00:00
Simon Tatham
9a9bd54197 Store default port number in each back end
[originally from svn r669]
2000-10-04 14:35:15 +00:00
Simon Tatham
a4a9ccc70b Further restructuring
[originally from svn r657]
2000-09-29 15:56:33 +00:00
Simon Tatham
bfec52c1c9 Fix ssh2 after the rev 1.54 [r649] reorg broke it
[originally from svn r656]
[r649 == 960c03468d]
2000-09-29 15:53:59 +00:00
Simon Tatham
0a1fe7a9af Make sure a locally entered login name still comes up in the pw prompt
[originally from svn r653]
2000-09-29 12:04:42 +00:00
Simon Tatham
0e9b76540b Add -pw and -P options, and usage/version message, to plink
[originally from svn r650]
2000-09-29 08:56:30 +00:00
Simon Tatham
960c03468d Minor restructuring to ssh.c in preparation for portability drive
[originally from svn r649]
2000-09-29 08:43:47 +00:00
Simon Tatham
087f33eb71 While we're doing a hostkey reorg, store port numbers as well
[originally from svn r643]
2000-09-28 08:37:10 +00:00
Simon Tatham
aad0a52dfb Rationalised host key storage. Also started code reorg: persistent-state
routines have been moved out into a replaceable module winstore.c.

[originally from svn r639]
2000-09-27 15:21:04 +00:00
Simon Tatham
0fed43e9f4 Remove the special hooks in ssh.c for pscp. pscp now uses the standard
interface to the outside of the ssh module. This means pscp now works
without change in SSH2.

[originally from svn r638]
2000-09-27 09:36:39 +00:00
Simon Tatham
355cdbd5e8 Implement OpenSSH-compatible RSA key fingerprints and use them throughout
[originally from svn r637]
2000-09-26 14:26:21 +00:00
Simon Tatham
ab839c6127 Fix a segfault in agent forwarding code
[originally from svn r633]
2000-09-26 11:16:47 +00:00
Simon Tatham
3e4619b479 The "Authenticated using key from agent" message is a verbose-only one
[originally from svn r631]
2000-09-26 10:06:05 +00:00
Simon Tatham
673f2e48a7 Rationalise ordering of authentication operations. Still some work to do,
but at least pscp no longer hangs when prompting for a passphrase

[originally from svn r621]
2000-09-25 10:14:53 +00:00
Simon Tatham
e70425dda6 Enable better build-time flexibility over which WinSock to include
[originally from svn r615]
2000-09-22 13:16:49 +00:00
Simon Tatham
c0ac8ab9b4 Bug fix: line discipline selection is not enabled until after ssh
authentication phase to stop user/password prompts behaving oddly

[originally from svn r614]
2000-09-22 13:10:19 +00:00
Simon Tatham
e5ef37f3f5 Prevent network errors from summarily closing the window when CoE is off
[originally from svn r613]
2000-09-22 11:04:57 +00:00
Simon Tatham
180b62b6b0 Miscellaneous ssh2 fixes. plink is now relatively sane
[originally from svn r608]
2000-09-21 14:34:32 +00:00
Simon Tatham
ea8d61f2d9 Fix Blowfish-with-SSH2 combination, and enable user cipher
selection for SSH2

[originally from svn r606]
2000-09-20 15:15:02 +00:00
Simon Tatham
c410c7c44c SSH2 is now more plausible - window sizes listened to, basic non-crashing
[originally from svn r604]
2000-09-20 14:29:52 +00:00
Simon Tatham
774110ee94 A couple of SSH2 fixes
[originally from svn r602]
2000-09-20 10:59:24 +00:00
Simon Tatham
f8be19a08b Configuration option for agent forwarding
[originally from svn r597]
2000-09-15 11:26:18 +00:00
Simon Tatham
a97b390d96 A couple of small cleanups
[originally from svn r595]
2000-09-15 10:57:15 +00:00
Simon Tatham
c96384efe0 Pageant now accepts an initial key list on the command line
[originally from svn r592]
2000-09-15 10:48:42 +00:00
Simon Tatham
c366174cc2 Added Pageant, a first-attempt PuTTY authentication agent
[originally from svn r589]
2000-09-14 15:02:50 +00:00
Simon Tatham
eed592d887 Add CryptoCard authentication
[originally from svn r587]
2000-09-12 08:44:30 +00:00
Simon Tatham
334b79e16c Add switch to choose SSH v1-versus-v2 protocol preference where both
are available

[originally from svn r584]
2000-09-11 09:37:43 +00:00
Simon Tatham
1864344036 Oops - remove SHA debugging from ssh2
[originally from svn r578]
2000-09-09 08:21:34 +00:00
Simon Tatham
4109ac3dfc Stop plink losing data at start of session
[originally from svn r577]
2000-09-08 16:42:11 +00:00
Simon Tatham
be711d9cd4 plink can now execute a specific command instead of just a shell session
[originally from svn r576]
2000-09-08 15:24:19 +00:00
Simon Tatham
8394a48620 Added a fourth application: plink, a command line connection utility
[originally from svn r575]
2000-09-08 14:45:20 +00:00
Simon Tatham
263d9e0f09 Public key authentication now works in pscp too - oops
[originally from svn r574]
2000-09-08 08:33:52 +00:00
Simon Tatham
d9af8f4b90 RSA key authentication in ssh1 works; SSH2 is nearly there
[originally from svn r572]
2000-09-07 16:33:49 +00:00
Simon Tatham
0f1e449189 SSH2 transport layer now enables encryption and MAC successfully for 3DES
[originally from svn r571]
2000-09-06 09:55:32 +00:00
Simon Tatham
36a499a7f1 Second attempt. Can successfully decrypt the _first block_ of a packet.
[originally from svn r570]
2000-09-05 16:23:36 +00:00
Simon Tatham
35205e5cb7 SSH 2 support, phase 1, debugging. Currently does Diffie-Hellman and gets
the same results as the server, which is a pretty good start.

[originally from svn r569]
2000-09-05 14:28:17 +00:00
Simon Tatham
0d5d39064a Robert de Bath's Big Patch, part 1
[originally from svn r516]
2000-07-26 12:13:51 +00:00
Simon Tatham
9546cf7393 PSCP: After a password supplied with `-pw' fails to authenticate,
we should _not_ fall back to console input for a second attempt,
because this hangs batch files.

[originally from svn r513]
2000-07-21 09:17:05 +00:00
Simon Tatham
2832ef1e75 Joris van Rantwijk's unified SSH code suitable for PuTTY and PSCP
[originally from svn r504]
[this commit reordered to come after creation of 0.49 tag]
2000-06-22 12:18:34 +00:00
Simon Tatham
0793be4efe Security improvement: check that string length field in
SSH_SMSG_{STDOUT,STDERR}_DATA packets is consistent with length
field in packet header. (Helps prevent insertion attack.)

[originally from svn r496]
2000-06-06 08:57:55 +00:00
Simon Tatham
6b81798205 Security improvement: check CRC on incoming packets
[originally from svn r489]
2000-05-31 10:18:24 +00:00
Simon Tatham
229245f384 Ahem. This time high-half characters really _do_ work in username
and password...

[originally from svn r468]
2000-05-09 08:56:30 +00:00
Simon Tatham
ba68a6d5f7 Enable high-half characters (>=160) in usernames and passwords
[originally from svn r454]
2000-04-11 10:39:58 +00:00
Simon Tatham
9922072a8d Peter Schellenbach's patch: re-implement the PuTTY cryptographic
functions as calls to the MS Crypto API. Not integrated into the
Makefile yet, but should eventually allow building of an SSH-enabled
PuTTY which contains no native crypto code, so it can be used
everywhere (and anyone who can get the MS encryption pack can still
use the SSH parts).

[originally from svn r425]
2000-03-24 09:45:49 +00:00
Simon Tatham
96dbf9c6e6 First stab at the ability to compile puttytel.exe, an SSH-free
variant which is patent-safe in the US and legal in France and
Russia. This is a horrible hack in some ways: it's shown up serious
deficiencies in the module boundaries. Needs further work, probably
once the SSH implementations are recombined.

[originally from svn r410]
2000-03-15 15:08:48 +00:00
Simon Tatham
a8d5838ebc Robert de Bath's multi-purpose patch, slightly modified.
- ^E answerback is now `PuTTY'.
 - The framework is now in place for the scrollback to reset to
   bottom on display _or_ keyboard events _or_ both. An actual
   configurable option isn't yet present, but most of the code is in
   place.
 - Try to deal with the problems where incoming data gets dropped
   after decoding but before display.
 - Scrollback behaviour has changed: instead of keying it off
   `scroll' versus `delete top line', things now go into the
   scrollback from _either_ of those but only if the primary screen
   is selected. Should fix problems with `less' and talkers.
 - must_update variable has gone because rdb correctly observed that
   it didn't seem to be doing a great deal :-)

[originally from svn r328]
1999-11-30 10:52:07 +00:00
Simon Tatham
b51c18f24c Fix unexpected network error 5000
[originally from svn r286]
1999-11-09 11:34:14 +00:00
Simon Tatham
f6c63320ea Changes from executor:
- NetHack keypad mode (Shift only works with NumLock off)
 - Alt-Space handling (best I could manage; not too bad considering)
 - Event Log rather than Telnet Negotiation Log

[originally from svn r284]
1999-11-09 11:10:04 +00:00
Simon Tatham
59e798fc6d Add TIS authentication option
[originally from svn r283]
1999-11-08 17:42:12 +00:00
Simon Tatham
a764191663 Switch to using SSH_MSG macros
[originally from svn r282]
1999-11-08 17:36:08 +00:00
Simon Tatham
3992fc48f1 Fix versioncmp
[originally from svn r255]
1999-10-25 14:27:13 +00:00
Simon Tatham
2d6fcb0a7a Single-DES encryption, patch courtesy of Murphy Lam
[originally from svn r253]
1999-10-25 08:59:40 +00:00
Simon Tatham
b3efa01293 We failed to ignore SSH_MSG_IGNORE :-)
[originally from svn r219]
1999-09-10 15:35:26 +00:00
Simon Tatham
4e889024e3 Jimen Ching's patches to remove compiler warnings
[originally from svn r183]
1999-07-20 13:01:56 +00:00
Simon Tatham
585c14f365 Add encryption selection, and Blowfish as second option
[originally from svn r175]
1999-07-06 19:42:57 +00:00
Simon Tatham
7c9195b8f9 Add SSH_STATE_CLOSED to prevent accidentally sending resizes down a
closed connection; was causing process hangs under NT and whole-
system hangs under '95

[originally from svn r126]
1999-03-23 17:21:44 +00:00
Simon Tatham
ee9e246617 Fix various segfaults and heap trashes. Thanks to Andrew Mobbs.
[originally from svn r29]
1999-02-09 15:39:08 +00:00
Simon Tatham
e68a529cc9 Add SSH don't-allocate-pty option, and corresponding LF-implies-CR
terminal setting

[originally from svn r16]
1999-01-15 11:30:40 +00:00
Simon Tatham
60ab6a5d82 John Sullivan's patches plus more fixes:
- Stop using the identifier `environ' as some platforms make it a macro
  - Fix silly error box at end of connection in FWHACK mode
  - Fix GPF on maximise-then-restore
  - Use SetCapture to allow drag-selecting outside the window
  - Correctly update window title when iconic and in win_name_always mode

[originally from svn r12]
1999-01-08 13:10:19 +00:00
Simon Tatham
c74130d423 Initial checkin: beta 0.43
[originally from svn r11]
1999-01-08 13:02:13 +00:00