u/mdw/putty
19 years agoLoose end from r5031: the Kex panel should only be displayed in
simon [Wed, 29 Dec 2004 12:32:25 +0000 (12:32 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5040 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe latest unfix.org IPv6 patch contains these apparently
simon [Tue, 28 Dec 2004 17:12:20 +0000 (17:12 +0000)]
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!

git-svn-id: svn://svn.tartarus.org/sgt/putty@5038 cda61777-01e9-0310-a592-d414129be87e

19 years agoAbility to save in mid-session! Simplest possible resolution to all
simon [Tue, 28 Dec 2004 16:46:30 +0000 (16:46 +0000)]
Ability to save in mid-session! Simplest possible resolution to all
the difficult questions about when it's sensible to offer the option
of saving to the slot we loaded from: _we never do_. The user must
always explicitly specify a slot to save to.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5035 cda61777-01e9-0310-a592-d414129be87e

19 years agoForgot to initialise ssh->portfwds to NULL. Unusually, this was
simon [Tue, 28 Dec 2004 16:18:17 +0000 (16:18 +0000)]
Forgot to initialise ssh->portfwds to NULL. Unusually, this was
pointed out by the MSVC debugger, not by valgrind :-)

git-svn-id: svn://svn.tartarus.org/sgt/putty@5034 cda61777-01e9-0310-a592-d414129be87e

19 years agoCan't use `d' for an accelerator in the Kex panel, since it clashes
simon [Tue, 28 Dec 2004 14:11:00 +0000 (14:11 +0000)]
Can't use `d' for an accelerator in the Kex panel, since it clashes
with the `d' used for the Down button in the Windows preference list.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5032 cda61777-01e9-0310-a592-d414129be87e

19 years agoSupport reconfiguration of key exchange in mid-session. The fiddly
simon [Tue, 28 Dec 2004 14:10:32 +0000 (14:10 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5031 cda61777-01e9-0310-a592-d414129be87e

19 years agoSSH port forwarding is now configurable in mid-session. After doing
simon [Tue, 28 Dec 2004 14:07:05 +0000 (14:07 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5030 cda61777-01e9-0310-a592-d414129be87e

19 years agoAbstracted out the rather large port-forwarding setup code into a
simon [Tue, 28 Dec 2004 14:04:58 +0000 (14:04 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5029 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix divide overflow in internal_mod(). Thanks to William Petiot for
simon [Tue, 28 Dec 2004 14:04:26 +0000 (14:04 +0000)]
Fix divide overflow in internal_mod(). Thanks to William Petiot for
spotting a special case that the DIV instruction can't quite cover.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5028 cda61777-01e9-0310-a592-d414129be87e

19 years agoBasic configurability for client-initiated rekeys.
jacob [Fri, 24 Dec 2004 13:39:32 +0000 (13:39 +0000)]
Basic configurability for client-initiated rekeys.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5027 cda61777-01e9-0310-a592-d414129be87e

19 years agoDon't offer repeat key exchange as a special command in SSH-1.
jacob [Fri, 24 Dec 2004 10:04:28 +0000 (10:04 +0000)]
Don't offer repeat key exchange as a special command in SSH-1.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5026 cda61777-01e9-0310-a592-d414129be87e

19 years agoMinimally document "repeat key exchange" special command.
jacob [Thu, 23 Dec 2004 05:54:09 +0000 (05:54 +0000)]
Minimally document "repeat key exchange" special command.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5023 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd a preference list for SSH-2 key exchange algorithms, on a new "Kex" panel
jacob [Thu, 23 Dec 2004 02:24:07 +0000 (02:24 +0000)]
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).

git-svn-id: svn://svn.tartarus.org/sgt/putty@5022 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix potential access of freed data (only if we couldn't create the
jacob [Wed, 22 Dec 2004 23:17:02 +0000 (23:17 +0000)]
Fix potential access of freed data (only if we couldn't create the
second of two registry keys, so pretty unlikely).

git-svn-id: svn://svn.tartarus.org/sgt/putty@5021 cda61777-01e9-0310-a592-d414129be87e

19 years agoSupport diffie-hellman-group14-sha1 group exchange. Tested against
simon [Wed, 22 Dec 2004 10:53:58 +0000 (10:53 +0000)]
Support diffie-hellman-group14-sha1 group exchange. Tested against
locally built OpenSSH 3.9, and seems to work fine.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5018 cda61777-01e9-0310-a592-d414129be87e

19 years agoIn my revamp of cursor handling I had assumed that you were supposed
simon [Wed, 22 Dec 2004 10:21:50 +0000 (10:21 +0000)]
In my revamp of cursor handling I had assumed that you were supposed
to call _either_ do_text() _or_ do_cursor() on a given character
cell. In fact you're supposed to call do_text() no matter what, and
then call do_cursor() as well if it's got the cursor on it, since
do_cursor() _only_ draws the actual cursor, which often doesn't also
cause the text to get drawn.

I'm half tempted to change this in the interface, retire do_cursor()
as an external function and relegate it to an internal function in
each front end, and require that do_text() must fully process all
cursor attributes it is passed. However, I haven't done this yet.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5017 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe end condition in the binary search loop in the new getType() was
simon [Mon, 20 Dec 2004 09:27:44 +0000 (09:27 +0000)]
The end condition in the binary search loop in the new getType() was
incorrect. I must have written that binary search idiom a hundred
times, so it's rather embarrassing that I can't _automatically_ get
it right! This was causing all kinds of characters to be classified
as ON when they should have been various other classes.

Also while I'm here, I've added another test case to utf8.txt (a
small piece of Arabic within a predominantly L->R line), and also
supplied a means to compile minibidi.c with -DTEST_GETTYPE to
produce a command-line character class lookup tool. (Not sure what
use that'll be _other_ than debugging this precise problem, but I
don't like to throw it away now I've written it :-)

git-svn-id: svn://svn.tartarus.org/sgt/putty@5016 cda61777-01e9-0310-a592-d414129be87e

19 years agoRestore border around terminal to default background colour rather than
jacob [Sun, 19 Dec 2004 23:37:30 +0000 (23:37 +0000)]
Restore border around terminal to default background colour rather than
something outside colours[] (consistently brown on my system).

(I don't understand why this code was the way it was, but it gave the
correct result before r4917 `256-colours', and now doesn't.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@5014 cda61777-01e9-0310-a592-d414129be87e

19 years agoCorrect number of configurable colours (NCFGCOLOURS) to match reality
jacob [Sun, 19 Dec 2004 23:15:17 +0000 (23:15 +0000)]
Correct number of configurable colours (NCFGCOLOURS) to match reality
(leftover from `256-colours', r4917).

git-svn-id: svn://svn.tartarus.org/sgt/putty@5013 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix line cursor colours (fallout from `256-colours'), on both Windows and Unix.
jacob [Sun, 19 Dec 2004 22:37:05 +0000 (22:37 +0000)]
Fix line cursor colours (fallout from `256-colours'), on both Windows and Unix.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5012 cda61777-01e9-0310-a592-d414129be87e

19 years agoMake sure the docs in a Unix release tarball are generated with the correct
jacob [Sat, 18 Dec 2004 11:34:41 +0000 (11:34 +0000)]
Make sure the docs in a Unix release tarball are generated with the correct
version info.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5011 cda61777-01e9-0310-a592-d414129be87e

19 years agoMissed options off mput help
jacob [Sat, 18 Dec 2004 10:46:21 +0000 (10:46 +0000)]
Missed options off mput help

git-svn-id: svn://svn.tartarus.org/sgt/putty@5010 cda61777-01e9-0310-a592-d414129be87e

19 years agozip apparently gives a warning (`-l used on binary file') when you
simon [Sat, 18 Dec 2004 10:00:27 +0000 (10:00 +0000)]
zip apparently gives a warning (`-l used on binary file') when you
use -l on a UTF-8 text file. Move potentially UTF-8 things (the new
testdata files) into a new category of source files, and suppress
zip's warning for that category.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5009 cda61777-01e9-0310-a592-d414129be87e

19 years agoJacob has pointed out why SIGCHLD was blocked, so I've updated the
simon [Fri, 17 Dec 2004 14:25:53 +0000 (14:25 +0000)]
Jacob has pointed out why SIGCHLD was blocked, so I've updated the
comment when I unblock it in pty.c to reflect reality. Also I've
moved block_signal() out of pterm.c into signal.c, so I can
conveniently use it for unblocking SIGCHLD rather than having to
reinvent it in pty.c.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5006 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe xfer mechanism wasn't gracefully terminating when an error was
simon [Fri, 17 Dec 2004 13:39:41 +0000 (13:39 +0000)]
The xfer mechanism wasn't gracefully terminating when an error was
encountered part way through transfer. In particular, this caused
psftp to hang (waiting for FXP_READ replies which had already
arrived) if you try `get' (without -r) on a remote directory.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5005 cda61777-01e9-0310-a592-d414129be87e

19 years agoDocument recent SFTP changes:
jacob [Fri, 17 Dec 2004 13:00:01 +0000 (13:00 +0000)]
Document recent SFTP changes:
 - document behaviour of "-r" with mget/mput/reget/reput
 - document "close" command
 - document SFTP wildcard syntax for those who may not be familiar with Unix
   wildcards

git-svn-id: svn://svn.tartarus.org/sgt/putty@5004 cda61777-01e9-0310-a592-d414129be87e

19 years agoI _think_ I've just fixed `font-overflow'. term->disptext now tracks
simon [Fri, 17 Dec 2004 12:55:12 +0000 (12:55 +0000)]
I _think_ I've just fixed `font-overflow'. term->disptext now tracks
the start of every contiguous run passed to do_text() or
do_cursor(), and arranges never to overwrite only part of such a run
on the next update.

I'm a bit worried about this checkin because I've also completely
revamped cursor handling: the cursor was previously being drawn
_outside_ the main loop over the display line, and is now drawn as
part of that loop when it gets to the cursor location. It _seems_ to
still work sensibly, even in complex cases involving LATTR_WIDE and
double-width CJK characters etc, but I won't be entirely happy until
it's had some beta use.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5003 cda61777-01e9-0310-a592-d414129be87e

19 years agoUpdate online help for "-r" and "--" options to get/put commands.
jacob [Fri, 17 Dec 2004 12:15:17 +0000 (12:15 +0000)]
Update online help for "-r" and "--" options to get/put commands.
Use command name in error messages rather than hardcoded "get:"/"put:".

git-svn-id: svn://svn.tartarus.org/sgt/putty@5002 cda61777-01e9-0310-a592-d414129be87e

19 years agoDivide the do_paint() loop into several subloops. The activity of
simon [Fri, 17 Dec 2004 11:37:16 +0000 (11:37 +0000)]
Divide the do_paint() loop into several subloops. The activity of
going through the line and working out which bits need to be redrawn
is now in a separate loop from the subsequent activity of actually
going through and doing the redraws. This _should_ enable me to
tinker with the which-bits-to-redraw data in between the two, thus
fixing `font-overflow'. However, I thought it would be sensible to
break the work up into two commits so we can track bugs in the
restructuring separately from bugs introduced by the new feature.

Also added a couple more terminal test files.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5001 cda61777-01e9-0310-a592-d414129be87e

19 years agoI had apparently broken wrapping of double-width characters (again).
simon [Fri, 17 Dec 2004 11:24:25 +0000 (11:24 +0000)]
I had apparently broken wrapping of double-width characters (again).
Also fixed the new UTF-8 test file so that it tests double-width
wrapping both with _and_ without LATTR_WRAPPED2.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5000 cda61777-01e9-0310-a592-d414129be87e

19 years agoI'd rather not keep losing these little test files, so here's some
simon [Fri, 17 Dec 2004 11:18:13 +0000 (11:18 +0000)]
I'd rather not keep losing these little test files, so here's some
stuff that I can `cat' into a terminal to test particular features
of it.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4999 cda61777-01e9-0310-a592-d414129be87e

19 years agoApparently SIGCHLD is blocked by default in processes run in a
simon [Fri, 17 Dec 2004 09:43:09 +0000 (09:43 +0000)]
Apparently SIGCHLD is blocked by default in processes run in a
pterm, which was breaking my bash job notification patch. This is
apparently not the case for xterm, so I've fiddled with it. Not
entirely sure _why_ it did this in the first place, but there we go.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4997 cda61777-01e9-0310-a592-d414129be87e

19 years agoGeneral mechanism for ensuring a dodgy SFTP server can't return
simon [Thu, 16 Dec 2004 19:36:47 +0000 (19:36 +0000)]
General mechanism for ensuring a dodgy SFTP server can't return
malicious filenames via FXP_READDIR.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4995 cda61777-01e9-0310-a592-d414129be87e

19 years agoImplement the `close' command, which terminates an SFTP session but
simon [Thu, 16 Dec 2004 19:19:59 +0000 (19:19 +0000)]
Implement the `close' command, which terminates an SFTP session but
does not quit PSFTP, so you can then issue another `open' to connect
to somewhere else. This has apparently been trivial for some time,
for exactly the same reasons that `reuse-windows' was so easy, but
it hadn't occurred to me to actually do it until now.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4994 cda61777-01e9-0310-a592-d414129be87e

19 years agoJacob points out that I introduced a bug in PSFTP when I did the
simon [Thu, 16 Dec 2004 19:15:38 +0000 (19:15 +0000)]
Jacob points out that I introduced a bug in PSFTP when I did the
timing shakeup: just running `psftp' caused the net/stdin select
loop (on both Unix and Windows) to get confused at the lack of any
network connection and give up immediately. Should now be fixed.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4993 cda61777-01e9-0310-a592-d414129be87e

19 years agoWildcards in `ls'. I think that completes `psftp-multi'. Woo!
simon [Thu, 16 Dec 2004 17:45:29 +0000 (17:45 +0000)]
Wildcards in `ls'. I think that completes `psftp-multi'. Woo!

git-svn-id: svn://svn.tartarus.org/sgt/putty@4992 cda61777-01e9-0310-a592-d414129be87e

19 years agoImplement mget and mput in PSFTP, supporting wildcards.
simon [Thu, 16 Dec 2004 17:35:20 +0000 (17:35 +0000)]
Implement mget and mput in PSFTP, supporting wildcards.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4991 cda61777-01e9-0310-a592-d414129be87e

19 years agoSupport for recursive file transfer in PSFTP.
simon [Thu, 16 Dec 2004 16:37:37 +0000 (16:37 +0000)]
Support for recursive file transfer in PSFTP.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4990 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix obviously stupid segfault. Ahem.
simon [Thu, 16 Dec 2004 15:38:39 +0000 (15:38 +0000)]
Fix obviously stupid segfault. Ahem.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4989 cda61777-01e9-0310-a592-d414129be87e

19 years agoAbe Crabtree complains that flushing the log file as often as we do in 0.56
jacob [Thu, 16 Dec 2004 15:22:36 +0000 (15:22 +0000)]
Abe Crabtree complains that flushing the log file as often as we do in 0.56
results in unacceptable performance for him on Win2000. Add a checkbox to
revert to the old behaviour.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4988 cda61777-01e9-0310-a592-d414129be87e

19 years agoRename scp.* to pscp.*, because I always misspell it that way. Also
simon [Thu, 16 Dec 2004 15:01:43 +0000 (15:01 +0000)]
Rename scp.* to pscp.*, because I always misspell it that way. Also
it's more consistent with PSFTP like this: scp.c/pscp.c is more
similar to psftp.c (the main application framework) than it is to
sftp.c (a set of back-end library routines).

git-svn-id: svn://svn.tartarus.org/sgt/putty@4987 cda61777-01e9-0310-a592-d414129be87e

19 years agoUnix PSCP was tight-looping when connecting through a ProxyCommand.
simon [Fri, 10 Dec 2004 11:41:14 +0000 (11:41 +0000)]
Unix PSCP was tight-looping when connecting through a ProxyCommand.
Turned out that sk_localproxy_close() was closing the pipe fds
without removing them from the uxsel list.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4965 cda61777-01e9-0310-a592-d414129be87e

19 years agoReplace the RLE-based getType() function with one that binary-
simon [Wed, 8 Dec 2004 19:41:14 +0000 (19:41 +0000)]
Replace the RLE-based getType() function with one that binary-
searches a list of (start,end,type) tuples. This increases data size
by about 5Kb, which is a shame; but on the plus side, it boosts
performance from O(N) to O(log N). As an added bonus, the table now
covers _all_ of Unicode, not just the BMP.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4964 cda61777-01e9-0310-a592-d414129be87e

19 years agoFurther clarity and speed cleanups of minibidi:
simon [Wed, 8 Dec 2004 19:07:05 +0000 (19:07 +0000)]
Further clarity and speed cleanups of minibidi:
 - rewrote the reversal loop in flipThisRun to be considerably clearer
 - rewrote leastGreaterOdd and leastGreaterEven as bit-twiddling macros
 - replaced malloc/free with snewn/sfree
 - lost some gratuitous repeat calls of getType on the same character
And most noticeably:
 - got rid of minibidi.h, since it was entirely full of minibidi.c
   internals (including constant data definitions!) and wasn't used
   to provide an external interface at all. Everything in it has
   been folded into minibidi.c.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4963 cda61777-01e9-0310-a592-d414129be87e

19 years agoReformat minibidi.[ch] in line with my coding conventions. It was
simon [Tue, 7 Dec 2004 18:18:28 +0000 (18:18 +0000)]
Reformat minibidi.[ch] in line with my coding conventions. It was
just getting to be too much hassle trying to work with the existing
indentation.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4952 cda61777-01e9-0310-a592-d414129be87e

19 years agoBidi stability work. I _think_ I've now removed all the failures of
simon [Tue, 7 Dec 2004 18:10:09 +0000 (18:10 +0000)]
Bidi stability work. I _think_ I've now removed all the failures of
array bounds checking.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4951 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix segfault when HOME not set on Unix.
owen [Tue, 7 Dec 2004 11:50:44 +0000 (11:50 +0000)]
Fix segfault when HOME not set on Unix.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4948 cda61777-01e9-0310-a592-d414129be87e

19 years ago\n and \r need double backslashes in Halibut.
simon [Thu, 2 Dec 2004 13:48:32 +0000 (13:48 +0000)]
\n and \r need double backslashes in Halibut.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4947 cda61777-01e9-0310-a592-d414129be87e

19 years agoNULL a couple of members after freeing them in ssh_free(). In particular,
jacob [Thu, 2 Dec 2004 13:37:28 +0000 (13:37 +0000)]
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.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@4946 cda61777-01e9-0310-a592-d414129be87e

19 years agoMention our assumptions about the execution character set. Not very
ben [Thu, 2 Dec 2004 13:07:32 +0000 (13:07 +0000)]
Mention our assumptions about the execution character set.  Not very
well-written, since my brain is largely absent today.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4945 cda61777-01e9-0310-a592-d414129be87e

19 years agoBah. Ben points out that SSH_1_ version strings should still end in
simon [Wed, 1 Dec 2004 15:34:12 +0000 (15:34 +0000)]
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).

git-svn-id: svn://svn.tartarus.org/sgt/putty@4941 cda61777-01e9-0310-a592-d414129be87e

19 years agoAnd now I look at it, the latest draft also says version strings
simon [Wed, 1 Dec 2004 13:42:50 +0000 (13:42 +0000)]
And now I look at it, the latest draft also says version strings
should be followed by \r\n, not just \n.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4940 cda61777-01e9-0310-a592-d414129be87e

19 years agoKimmo Parviainen points out that SSH software version strings have
simon [Wed, 1 Dec 2004 13:37:31 +0000 (13:37 +0000)]
Kimmo Parviainen points out that SSH software version strings have
restrictions on the use of hyphens and spaces.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4939 cda61777-01e9-0310-a592-d414129be87e

19 years agoterm_bidi_cache_store() now has a need to distinguish between the
simon [Wed, 1 Dec 2004 09:25:20 +0000 (09:25 +0000)]
term_bidi_cache_store() now has a need to distinguish between the
_width_ of a terminal line (number of character cell positions) and
its _size_ (number of termchars), since of course these differ in
the presence of combining characters.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4938 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix large memory leak introduced in the r4915 bidi changes.
simon [Tue, 30 Nov 2004 13:39:58 +0000 (13:39 +0000)]
Fix large memory leak introduced in the r4915 bidi changes.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4936 cda61777-01e9-0310-a592-d414129be87e

19 years agoAnother default-background fix for 256-colour mode
jacob [Tue, 30 Nov 2004 01:07:29 +0000 (01:07 +0000)]
Another default-background fix for 256-colour mode

git-svn-id: svn://svn.tartarus.org/sgt/putty@4931 cda61777-01e9-0310-a592-d414129be87e

19 years agoNitpick, close bracket.
owen [Mon, 29 Nov 2004 16:58:02 +0000 (16:58 +0000)]
Nitpick, close bracket.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4926 cda61777-01e9-0310-a592-d414129be87e

19 years agoSome blurb about terminal types and 256-colour xterms. Thanks to Dan
simon [Mon, 29 Nov 2004 11:31:21 +0000 (11:31 +0000)]
Some blurb about terminal types and 256-colour xterms. Thanks to Dan
Nicolaescu for the suggestion.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4925 cda61777-01e9-0310-a592-d414129be87e

19 years agorm '$Source$' from comments as not meaningful under Subversion
jacob [Mon, 29 Nov 2004 09:40:59 +0000 (09:40 +0000)]
rm '$Source$' from comments as not meaningful under Subversion

git-svn-id: svn://svn.tartarus.org/sgt/putty@4924 cda61777-01e9-0310-a592-d414129be87e

19 years agotypo in comment
jacob [Mon, 29 Nov 2004 09:27:13 +0000 (09:27 +0000)]
typo in comment

git-svn-id: svn://svn.tartarus.org/sgt/putty@4923 cda61777-01e9-0310-a592-d414129be87e

19 years agoBriefly document the "CP866" manual-entry feature on Windows in the dialog
jacob [Mon, 29 Nov 2004 09:23:11 +0000 (09:23 +0000)]
Briefly document the "CP866" manual-entry feature on Windows in the dialog
itself (since we have a bit of room).

git-svn-id: svn://svn.tartarus.org/sgt/putty@4922 cda61777-01e9-0310-a592-d414129be87e

19 years agoBah, there's always one thing I miss. Correct the background-colour
simon [Sun, 28 Nov 2004 15:18:23 +0000 (15:18 +0000)]
Bah, there's always one thing I miss. Correct the background-colour
handling in Unix PuTTY.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4918 cda61777-01e9-0310-a592-d414129be87e

19 years agoImplement xterm 256-colour mode.
simon [Sun, 28 Nov 2004 15:13:34 +0000 (15:13 +0000)]
Implement xterm 256-colour mode.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4917 cda61777-01e9-0310-a592-d414129be87e

19 years agoStability fixes (thanks valgrind).
simon [Sun, 28 Nov 2004 09:32:17 +0000 (09:32 +0000)]
Stability fixes (thanks valgrind).

git-svn-id: svn://svn.tartarus.org/sgt/putty@4916 cda61777-01e9-0310-a592-d414129be87e

19 years agoCursor position, selection highlights and mouse clicks are now all
simon [Sun, 28 Nov 2004 09:24:57 +0000 (09:24 +0000)]
Cursor position, selection highlights and mouse clicks are now all
transformed back and forth according to the character position
permutation output from the bidi algorithm. I was expecting that to
be a lot harder.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4915 cda61777-01e9-0310-a592-d414129be87e

19 years agoOops; forgot to add this file in r4913.
simon [Sun, 28 Nov 2004 00:48:31 +0000 (00:48 +0000)]
Oops; forgot to add this file in r4913.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4914 cda61777-01e9-0310-a592-d414129be87e

19 years agoLoose end from timing shakeup: sshrand.c is now a client of
simon [Sat, 27 Nov 2004 19:56:38 +0000 (19:56 +0000)]
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!

git-svn-id: svn://svn.tartarus.org/sgt/putty@4913 cda61777-01e9-0310-a592-d414129be87e

19 years agoChanges in startup order to ensure any subsystem which might attempt
simon [Sat, 27 Nov 2004 19:41:24 +0000 (19:41 +0000)]
Changes in startup order to ensure any subsystem which might attempt
to schedule timers is not started until after hwnd is initialised.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4912 cda61777-01e9-0310-a592-d414129be87e

19 years agoSlight improvement to cursor blink timing: since the cursor doesn't
simon [Sat, 27 Nov 2004 19:34:45 +0000 (19:34 +0000)]
Slight improvement to cursor blink timing: since the cursor doesn't
blink when the window doesn't have focus, we don't schedule blink
timers at that point either.

Infrastructure change: term->has_focus should now not be written
directly from outside terminal.c. Instead, use the function
term_set_focus, which will sort out the blink timers as well.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4911 cda61777-01e9-0310-a592-d414129be87e

19 years agoAlmost _all_ of the final connection-layer loop, in both SSH1 and
simon [Sat, 27 Nov 2004 15:32:45 +0000 (15:32 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4909 cda61777-01e9-0310-a592-d414129be87e

19 years agoImplement client-initiated rekeys after an hour, or after 1Gb of
simon [Sat, 27 Nov 2004 14:29:20 +0000 (14:29 +0000)]
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_ :-).

git-svn-id: svn://svn.tartarus.org/sgt/putty@4908 cda61777-01e9-0310-a592-d414129be87e

19 years agoBah, I knew I'd miss _something_. term_out is now static, so
simon [Sat, 27 Nov 2004 13:31:07 +0000 (13:31 +0000)]
Bah, I knew I'd miss _something_. term_out is now static, so
declaring it in putty.h gives a warning under Unix.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4907 cda61777-01e9-0310-a592-d414129be87e

19 years agoNew timing infrastructure. There's a new function schedule_timer()
simon [Sat, 27 Nov 2004 13:20:21 +0000 (13:20 +0000)]
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).

git-svn-id: svn://svn.tartarus.org/sgt/putty@4906 cda61777-01e9-0310-a592-d414129be87e

19 years agouint64_decimal() incorrectly output 0 as "" instead of "0". This only affected
jacob [Thu, 25 Nov 2004 13:40:01 +0000 (13:40 +0000)]
uint64_decimal() incorrectly output 0 as "" instead of "0". This only affected
PSFTP's "reput" chat. Spotted by Greg Parker.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4904 cda61777-01e9-0310-a592-d414129be87e

19 years agoRe-architected the top level of the SSH protocol handlers.
simon [Wed, 24 Nov 2004 20:35:15 +0000 (20:35 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4901 cda61777-01e9-0310-a592-d414129be87e

19 years agorandom_init() should be called at most once during the running of
simon [Wed, 24 Nov 2004 19:53:31 +0000 (19:53 +0000)]
random_init() should be called at most once during the running of
PuTTY, even if it's managing multiple sessions.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4900 cda61777-01e9-0310-a592-d414129be87e

19 years agoNow that Packet structures are dynamically allocated, it means we
simon [Wed, 24 Nov 2004 19:23:02 +0000 (19:23 +0000)]
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.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@4899 cda61777-01e9-0310-a592-d414129be87e

19 years agoMinor refactoring: the fields `pktin' and `pktout' in the Ssh
simon [Wed, 24 Nov 2004 18:45:52 +0000 (18:45 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4898 cda61777-01e9-0310-a592-d414129be87e

19 years agoI think rjk meant `setpgid', not `setpgrp'.
simon [Wed, 24 Nov 2004 11:42:45 +0000 (11:42 +0000)]
I think rjk meant `setpgid', not `setpgrp'.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4897 cda61777-01e9-0310-a592-d414129be87e

19 years agoRJK's OS X portability patch:
simon [Wed, 24 Nov 2004 11:36:08 +0000 (11:36 +0000)]
RJK's OS X portability patch:
 - initialise blank mbstate_t using memset rather than an ad-hoc
   initialiser.
 - expand the OMIT_UTMP ifdefs to enclose a load of entire functions
   that would generate `static function never called' warnings if
   left as empty shells.
 - couple of other fiddly things.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4896 cda61777-01e9-0310-a592-d414129be87e

19 years agoIt's probably about time I took my private path to the Halibut
simon [Wed, 24 Nov 2004 11:35:27 +0000 (11:35 +0000)]
It's probably about time I took my private path to the Halibut
binary out of the PuTTY docs Makefile. Instead, I expect to find
Halibut as simply `halibut' on the PATH, and anyone who doesn't have
it there can always do `make HALIBUT=/path/to/halibut'.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4895 cda61777-01e9-0310-a592-d414129be87e

19 years ago\k --> \K
jacob [Wed, 24 Nov 2004 03:18:14 +0000 (03:18 +0000)]
\k --> \K

git-svn-id: svn://svn.tartarus.org/sgt/putty@4893 cda61777-01e9-0310-a592-d414129be87e

19 years agoDarek Olszewski points out that telnet->ldisc is never initialised
simon [Tue, 23 Nov 2004 16:43:04 +0000 (16:43 +0000)]
Darek Olszewski points out that telnet->ldisc is never initialised
to NULL.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4888 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix typo in term_size(), flagged by a Dr Watson log from Temme Rainer.
simon [Mon, 22 Nov 2004 13:49:12 +0000 (13:49 +0000)]
Fix typo in term_size(), flagged by a Dr Watson log from Temme Rainer.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4881 cda61777-01e9-0310-a592-d414129be87e

19 years agoMinor index tweakery.
simon [Mon, 22 Nov 2004 12:42:33 +0000 (12:42 +0000)]
Minor index tweakery.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4880 cda61777-01e9-0310-a592-d414129be87e

19 years agoTrivial bug fix pointed out by Paul Fox: potentially missing fclose().
simon [Mon, 22 Nov 2004 11:02:44 +0000 (11:02 +0000)]
Trivial bug fix pointed out by Paul Fox: potentially missing fclose().

git-svn-id: svn://svn.tartarus.org/sgt/putty@4877 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd missing backslash in "Unable to create registry key" messages.
jacob [Sat, 20 Nov 2004 19:07:34 +0000 (19:07 +0000)]
Add missing backslash in "Unable to create registry key" messages.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4855 cda61777-01e9-0310-a592-d414129be87e

19 years agoUI tweak from Malcolm Rowe: set IDM_VIEWKEYS as the default menu item and use
jacob [Sat, 20 Nov 2004 18:29:58 +0000 (18:29 +0000)]
UI tweak from Malcolm Rowe: set IDM_VIEWKEYS as the default menu item and use
that mechanism to invoke it on double-click; this emboldens it in the right-
click menu.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4851 cda61777-01e9-0310-a592-d414129be87e

19 years agoXXX comment in the logic which sends failed password auth back to username
jacob [Sat, 20 Nov 2004 17:47:40 +0000 (17:47 +0000)]
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.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@4850 cda61777-01e9-0310-a592-d414129be87e

19 years agoAs a result of the policy allowing changes of username to reset the
jacob [Sat, 20 Nov 2004 17:11:38 +0000 (17:11 +0000)]
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4849 cda61777-01e9-0310-a592-d414129be87e

19 years agoMake PSFTP use console_get_line() to fetch username, so that that prompt is
jacob [Fri, 19 Nov 2004 21:24:47 +0000 (21:24 +0000)]
Make PSFTP use console_get_line() to fetch username, so that that prompt is
affected by `-batch'.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4833 cda61777-01e9-0310-a592-d414129be87e

19 years agoconsole_get_line() returns failure iff console_batch_mode is set, whereas
jacob [Fri, 19 Nov 2004 21:05:31 +0000 (21:05 +0000)]
console_get_line() returns failure iff console_batch_mode is set, whereas
before is would return success and the empty string. IMO this makes `-batch'
much more useful; before, utilities such as Plink in `-batch' mode would
attempt to plough on using empty strings for usernames, passwords, and so on.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4832 cda61777-01e9-0310-a592-d414129be87e

19 years agoRemove FLAG_INTERACTIVE test from "login as:" prompt. Kelly John Carney
jacob [Fri, 19 Nov 2004 20:57:32 +0000 (20:57 +0000)]
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.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@4831 cda61777-01e9-0310-a592-d414129be87e

19 years ago"Connection reset by peer" is apparently not the only error that keepalives can
jacob [Thu, 18 Nov 2004 19:44:26 +0000 (19:44 +0000)]
"Connection reset by peer" is apparently not the only error that keepalives can
help with.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4819 cda61777-01e9-0310-a592-d414129be87e

19 years ago"Software caused connection abort": a couple of people now have got rid of
jacob [Thu, 18 Nov 2004 19:41:41 +0000 (19:41 +0000)]
"Software caused connection abort": a couple of people now have got rid of
this with keepalives. Also try to emphasise that this seems to be a generic
catch-all type of error.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4818 cda61777-01e9-0310-a592-d414129be87e

19 years ago*sigh* X11 forwarding to a local display (":0" or similar) specified in the
jacob [Thu, 18 Nov 2004 17:13:45 +0000 (17:13 +0000)]
*sigh* X11 forwarding to a local display (":0" or similar) specified in the
environment rather than the configuraton was failing as of 0.56 (introduced
in r4604). This probably only bit users of Unix PuTTY. Didn't spot in testing
as I was forwarding to already-forwarded displays. I really wasn't having a
good month that month, was I?

git-svn-id: svn://svn.tartarus.org/sgt/putty@4816 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd an extra appendix to the manual containing PuTTY's (hitherto)
simon [Thu, 18 Nov 2004 15:16:18 +0000 (15:16 +0000)]
Add an extra appendix to the manual containing PuTTY's (hitherto)
unwritten design principles, so would-be contributors won't have to
either read our minds or pay _very_ close attention to the code.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4815 cda61777-01e9-0310-a592-d414129be87e

19 years agoMove MODULE files out of individual project directories into a
simon [Thu, 18 Nov 2004 11:30:39 +0000 (11:30 +0000)]
Move MODULE files out of individual project directories into a
MODULES top-level directory, which is where the Tartarus website
scripts will (hopefully) start reading them from.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4813 cda61777-01e9-0310-a592-d414129be87e

19 years agomkunxarc.sh was still including (mostly empty) .svn directories, and
simon [Wed, 17 Nov 2004 18:27:04 +0000 (18:27 +0000)]
mkunxarc.sh was still including (mostly empty) .svn directories, and
that in turn was confusing the new doc/Makefile mechanism. Fixed the
former, and also put an additional safeguard in the latter in a
belt-and-braces sort of fashion.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4806 cda61777-01e9-0310-a592-d414129be87e

19 years agoNow we use Subversion, it seems excessive to have an individual $Id$
simon [Wed, 17 Nov 2004 18:16:59 +0000 (18:16 +0000)]
Now we use Subversion, it seems excessive to have an individual $Id$
line for every single .but file at the bottom of each page of the
HTML PuTTY docs. However, we can't _always_ replace that with a
single SVN revision, because there isn't always one available (SVN
still allows mixed working copies in which some files are
deliberately checked out against a different revision).

Hence, here's a mechanism for doing better. It uses `svnversion .'
to determine _whether_ a single revision number adequately describes
the current directory, and replaces all the version IDs with that if
so. If it can't do that, it uses the version IDs as before.

Also, this allows an explicit version string to be passed on the
make command line which will override _both_ these possibilities, so
that release documentation can be clearly labelled with the release
version number.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4804 cda61777-01e9-0310-a592-d414129be87e