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

492 Commits

Author SHA1 Message Date
Simon Tatham
3f6dfdaa61 David Damerell tells me I should be using Ctrl-hjklyubn rather than
Shift-hjklyubn for batch movement in NetHack, because they have
subtly different behaviour within the game and the Ctrl-moves are
more useful. Unfortunately, PuTTY's NetHack keypad mode doesn't
support Ctrl-moves. Therefore, it does now :-)

[originally from svn r6593]
2006-03-08 18:10:12 +00:00
Simon Tatham
be93024bf2 Do proper select-for-write on ptys. Currently, pasting a
sufficiently large string into pterm in any circumstances in which
it's echoed back to the terminal will cause a deadlock once the
pty's write buffer fills up.

[originally from svn r6582]
2006-02-23 13:38:44 +00:00
Jacob Nevins
dd73d2a836 Fix `restart-reset-terminal': terminal now restored to a sensible state when
reusing a window to restart a session.

[originally from svn r6577]
[this svn revision also touched putty-wishlist]
2006-02-19 14:59:48 +00:00
Jacob Nevins
5e59d81947 Fix up documentation/usage messages for r6572.
[originally from svn r6574]
[r6572 == c2b2d9c539]
2006-02-19 12:52:28 +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
Owen Dunn
d526e3bb33 Preserve more attributes of text copied as RTF. Thanks to Stephen Balousek.
[originally from svn r6555]
2006-02-13 22:18:17 +00:00
Jacob Nevins
2e06985445 Failure to connect to a Unix-domain socket could cause a segfault. Fixed.
[originally from svn r6550]
2006-02-11 18:29:55 +00:00
Jacob Nevins
6a596c736a It's a new year.
[originally from svn r6513]
[this svn revision also touched halibut,putty-website,puzzles]
2006-01-08 18:18:11 +00:00
Simon Tatham
0a4b6612fb A few small changes to make the PuTTY source base more usable as a
basis for other terminal-involving applications: a stub
implementation of the printing interface, an additional function in
notiming.c, and also I've renamed the front-end function beep() to
do_beep() so as not to clash with beep() in lib[n]curses.

[originally from svn r6479]
2005-12-09 20:04:19 +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
Ben Harris
9d31462c52 Fix 256-colours-match-xterm, based on 256colres.pl from xterm-205.
Largely untested -- may not even compile on Windows.

[originally from svn r6393]
2005-10-13 21:56:43 +00:00
Simon Tatham
8cde1bc7fe dlg_listbox_select() now scrolls the list box to ensure that the
item it's just selected is visible.

[originally from svn r6338]
2005-09-21 17:09:07 +00:00
Ben Harris
f0dfa73982 AIX 5.1 has <utmpx.h> but no updwtmpx(). Treat the latter as a reason to
OMIT_UTMP.  Reported by Mike Protts.

[originally from svn r6311]
2005-09-14 11:00:34 +00:00
Ben Harris
3bfb6ad651 Some systems (HP-UX) don't yet have <sys/select.h>, putting select() in
<sys/time.h>.  Cope with this.  Where <sys/select.h> _is_ available, though,
use it (since it's where POSIX puts select()).  Problem reported by Mike
Protts.

[originally from svn r6310]
2005-09-14 10:53:39 +00:00
Ben Harris
059e409c82 The ANSI-C constant FILENAME_MAX is ludicrously small on some systems.
Use the POSIX PATH_MAX if it exists, and fall back to 1024 otherwise.
We should really allocate filenames dynamically if PATH_MAX isn't defined.

[originally from svn r6307]
2005-09-13 20:08:25 +00:00
Ben Harris
e115d1cc90 Some hosts don't have TIOCSCTTY. Don't try to use it on them.
Patch from Mike Protts.

[originally from svn r6306]
2005-09-13 19:57:37 +00:00
Ben Harris
4598889284 A couple of places in sk_newlistener were using AF_INET6 even with NO_IPV6.
Correct them.

[originally from svn r6305]
2005-09-13 19:54:01 +00:00
Jacob Nevins
36ff0a38f4 Patch from Colin Watson: we were sometimes passing stack storage to putenv(),
which is Bad (in his case, it caused TERM to end up unset). Use malloc()'d
storage instead.

[originally from svn r6095]
2005-07-15 11:47:28 +00:00
Ben Harris
ab855b74c5 Add experimental support for detecting BREAK on input and propagating it as
TS_BRK on output.  This is tested to the extent that other data survive the
escaping performed by PARMRK, at least on my system.  Actual passing on
of BREAK is as-yet untested.

[originally from svn r5779]
2005-05-14 22:01:10 +00:00
Jacob Nevins
1d4705d9c8 Make Makefile.gtk build again on Linux (assume <utmpx.h>).
[originally from svn r5764]
2005-05-09 13:27:51 +00:00
Simon Tatham
ea2cac08e9 Fix what looks like a cut-and-paste error which was stopping Unix
Plink building on MacOS X.

[originally from svn r5762]
2005-05-08 11:47:59 +00:00
Jacob Nevins
1f2f60de04 Correct apparent misspelling of `SIOCATMARK'.
[originally from svn r5749]
2005-05-05 22:47:30 +00:00
Ben Harris
61199b6a04 On monochrome displays, display the cursor in reverse video so that it's
visible on reversed out text.  This only applies to active block cursors for
now.

[originally from svn r5698]
2005-04-27 21:42:51 +00:00
Ben Harris
1aee4d81e0 Tiny manual CSE of previous commit.
[originally from svn r5697]
2005-04-27 21:22:40 +00:00
Ben Harris
5a980feac9 On 1bpp displays, ignore colour attributes. This makes pterm minimally useful
there, though (e.g.) switching to using reverse video for the cursor would
probably also help.  Displays with other silly depths (e.g. 2bpp) aren't
catered for, but I suspect they're rare in the X world.

[originally from svn r5696]
2005-04-27 21:09:45 +00:00
Ben Harris
7b72634c27 Make palette changes use "best match" colours too.
[originally from svn r5695]
2005-04-27 20:30:47 +00:00
Ben Harris
62cdb81e0a Rather than checking for <sys/sockio.h>, just include it if our other
attempts at finding SIOCATMARK have failed.  This removes one of our
Autoconf tests, which is always nice.

[originally from svn r5690]
2005-04-27 15:42:10 +00:00
Ben Harris
55865685a9 According to the termio(7I) on Solaris, OLCUC is overridden by OPOST, so we
should send it with the SSH terminal modes too.

[originally from svn r5680]
2005-04-26 00:03:50 +00:00
Ben Harris
12d8a02aad Squash OPOST locally when we're not in line-editing mode, and propagate
the other output flags with SSH.  This means that when I log into a remote
system using Plink and then run "stty -onlcr" I get the expected
stair-stepping.

[originally from svn r5679]
2005-04-25 23:57:45 +00:00
Ben Harris
62b943922e Use pututxline() in place of pututline(), since the former is standardised by
X/Open and actually seems to be more common (NetBSD has it).  Also use
updwtmpx() rather than directly writing to the wtmpx file, though more for
reasons of aesthetics than anything practical.

[originally from svn r5678]
2005-04-25 23:28:25 +00:00
Ben Harris
318913822d Ask GDK to give us reasonable approximations if it can't get precisely the
colours we asked it for.  This means that I can run pterm on an 8-bit
PseudoColor display even if I have another program running.

[originally from svn r5677]
2005-04-25 22:46:08 +00:00
Ben Harris
4cb79827c6 Check for <sys/sockio.h> and include it in uxnet.c if we find it. It's
necessary on Solaris if we want to use SIOCATMARK.  Using sockatmark() might
be preferable, but despite being notionally standard it's missing on
Solaris 9 and Mac OS X 10.3.9, whereas everyone seems to have SIOCATMARK
somewhere.

[originally from svn r5676]
2005-04-25 18:51:15 +00:00
Ben Harris
b0d3cceb99 uxpty.c uses non-X/Open facilities (notably strsignal()), so don't define
_XOPEN_SOURCE.  We do still need _GNU_SOURCE in order to get grantpt()
on GNU systems.  This allows uxpty.c to compile on NetBSD.

[originally from svn r5675]
2005-04-25 17:21:08 +00:00
Ben Harris
0227bfdbc7 Add a mechanism for using autoconf to detect the quirks of Unix systems
rather than relying on the user to edit the Makefile.  Makefile.gtk
still works as well as it ever did, but now we get a Makefile.in alongside
it.  mkunxarc.sh now relies on autoconf and friends to build the configure
script for the Unix source distribution.

[originally from svn r5673]
2005-04-25 15:55:06 +00:00
Ben Harris
38b266727a On some systems (NetBSD 1.6 and Solaris 9, at least), GCC doesn't understand
the semantics of assert(0) and believes it can return.  Add a gratuitous
exit(1) to convince it that this won't happen, and hence quell a couple of
warnings about variables' being used uninitialised.

[originally from svn r5669]
2005-04-24 14:43:00 +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
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
Jacob Nevins
62faf61d6e Oops, forgot to credit Ahmad Khalifa of arabeyes.org for the bidi/shaping work.
[originally from svn r5612]
[this svn revision also touched putty-website]
2005-04-07 12:00:01 +00:00
Jacob Nevins
52a17ab04a If a new session was saved from Change Settings, a side-effect on Windows was
that the global `sesslist' got out of sync with the saved-sessions submenu,
causing the latter to launch the wrong sessions.

Also, Change Settings wasn't getting a fresh session list, so if the set of
sessions had changed since session startup it wouldn't reflect that (at least
until a session was saved). Fixed (on all platforms).

Therefore, since the global sesslist didn't seem to be useful, I've got rid
of it; config.c creates one as needed, as do the frontends. (Not tried
compiling Mac changes.)

Also, we now build the saved-sessions submenu on demand on Windows and Unix.
(This should probably also be done on the Mac.)

[originally from svn r5609]
2005-04-07 01:36:28 +00:00
Ben Harris
96e9a65e99 NULL needs to be cast to void * when passed to a variadic function like
execl().  Spotted by Damien Miller.

[originally from svn r5592]
2005-04-04 13:44:45 +00:00
Simon Tatham
d0beed9aba Render timing.c robust in the face of strangeness. The strangenesses
in question vary per OS: on Windows the problem is that WM_TIMER
sometimes goes off too early, so that GetTickCount() is right and
the callback time is wrong, whereas on Unix the problem is that my
GETTICKCOUNT implementation comes from the system clock which means
it can change suddenly and non-monotonically if the sysadmin is
messing about (meaning that the timing of callbacks from GTK or
select timeouts is _more_ likely to be right than GETTICKCOUNT).
This checkin provides band-aid workarounds for both problems, which
aren't pretty but ought to at least prevent catastrophic assertion
failure.

[originally from svn r5556]
2005-03-28 17:48:24 +00:00
Jacob Nevins
2d379524c3 Since Markus Kuhn no longer explicitly places wcwidth.c in the public domain,
it'd probably be generous to list him in the copyrights.

[originally from svn r5548]
[this svn revision also touched putty-website]
2005-03-23 20:23:07 +00:00
Ben Harris
616f220472 Revert last change: Some versions of the GNU C Library (notably SUSE
glibc-2.3.3-118 and Debian libc6 2.3.2.ds1-20) have clock_gettime() and
CLOCK_MONOTONIC in their headers, but not in libc itself, which we can't
detect easily.

[originally from svn r5529]
2005-03-19 19:23:49 +00:00
Ben Harris
f812865ceb If it's available, try to use clock_gettime(CLOCK_MONOTONIC) rather than
gettimeofday(), since the former shouldn't warp when the user resets the clock.

[originally from svn r5528]
2005-03-19 19:02:53 +00:00
Jacob Nevins
36fc6c0a76 Try to make our PGP signing more useful:
* All the PuTTY tools for Windows and Unix now contain the fingerprints of
   the Master Keys. The method for accessing them is crude but universal:
   a new "-pgpfp" command-line option. (Except Unix PuTTYgen, which takes
   "--pgpfp" just to be awkward.)

 * Move the key policy discussion from putty-website/keys.html to
   putty/doc/pgpkeys.but, and autogenerate the former from the latter.
   Also tweak the text somewhat and include the fingerprints of the
   Master Keys themselves.
   (I've merged the existing autogeneration scripts into a single new
   one; I've left the old scripts and keys.html around until such time
   as the webmonster reviews the changes and plumbs in the new script;
   he should remove the old files then.)

[originally from svn r5524]
[this svn revision also touched putty-website]
2005-03-19 02:26:58 +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
Owen Dunn
c7e71fe2ec Protect against multiple Change Settings dialogues. We should probably also
arrange to switch to an existing Change Settings if the user selects the
menu item and we already have a Change Settings.

[originally from svn r5475]
2005-03-10 10:07:27 +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
Simon Tatham
5c5dc61522 Fixes for NO_IPV6 compilation under Unix.
[originally from svn r5443]
2005-03-05 15:04:48 +00:00
Ben Harris
16c3026b28 Explicitly set MIN and TIME when in raw mode to request single characters
with no timeout.  This seems to make Plink work better on Solaris.

[originally from svn r5436]
2005-03-03 13:07:25 +00:00
Jacob Nevins
f538bd6d4c Make it clearer that `-m' is only usable with SSH.
[originally from svn r5416]
2005-03-01 00:33:18 +00:00
Simon Tatham
6d47285462 Fallout from my change in the semantics of cfg.remote_cmd_ptr.
Spotted by Alano na Alania.

[originally from svn r5386]
2005-02-23 09:25:39 +00:00
Simon Tatham
ee56a6b48f Remove the two logevent calls passing NULL as the first argument.
This was copied straight from winnet.c and I don't believe it's
_ever_ been valid in the Unix front end.

[originally from svn r5384]
2005-02-22 23:30:09 +00:00
Jacob Nevins
62f83a3666 Rearrange verify_ssh_host_key() for robustness in the face of strangeness, in
the same manner as windows/windlg.c (but tested this time :)

[originally from svn r5380]
2005-02-21 23:43:49 +00:00
Simon Tatham
f73fcb0424 Add asynchronous callback capability to the askappend() alert box.
This was harder than verify_ssh_host_key() and askalg() put
together, because:
 (a) askappend() can be called at any time, since it's a side effect
     of data-logging functions. Therefore there can be an unfinished
     askappend() alert at any time, and hence the OS X front end has
     to be prepared to _queue_ other alerts which occur during that
     time.
 (b) logging.c has to do something with data that comes in while
     it's waiting for an answer to askappend(). It buffers it until
     it knows what the user wants done with it. This involved
     something of a reorganisation of logging.c.

[originally from svn r5344]
2005-02-18 18:33:31 +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
70de40ba0a Simon suggests a better solution to valgrind's complaining about
(struct Socket_tag).connected -- it should be entirely irrelevant to
listening sockets. Valgrind is still happy.

[originally from svn r5317]
2005-02-16 11:44:44 +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
680869b866 Initialise (struct Socket_tag).connected in sk_register().
Again, the value could do with review.

[originally from svn r5300]
2005-02-14 15:30:09 +00:00
Jacob Nevins
01c4c363d9 Initialise (struct Socket_tag).connected in sk_newlistener() since Valgrind
complained.
(I _think_ this is the correct initialisation.)

[originally from svn r5299]
2005-02-14 15:03:32 +00:00
Simon Tatham
7109d413b4 Oh, and (there's always one) remove the unnecessary extra parameter
from unix_setup_config_box().

[originally from svn r5293]
2005-02-14 07:44:50 +00:00
Simon Tatham
b75856edfa Saw uxcfg.c in half down the middle, to separate out config changes
that apply to all Unix-like systems from those which apply
specifically to the GTK front end.

[originally from svn r5292]
2005-02-14 07:41:41 +00:00
Simon Tatham
471624882b Reinstate the broken -e option in pterm. Also I've just worked out a
much better way of handling pty_argv which doesn't require uxpty.c
to be linked in to Unix PuTTY and PuTTYtel.

[originally from svn r5262]
2005-02-06 15:52:00 +00:00
Simon Tatham
f5442209d4 Encapsulated most of the pty backend's variables into a proper data
structure, in preparation for wanting more than one of them in a
single process. This can't be done cleanly, because the whole
business with pty_pre_init pre-allocating the pty rather assumes we
want a known number of the things before we drop privileges; so
there's a horrid hack to make pty_pre_init work on platforms that
have at most one pty instance per process, but at the same time
things ought to work sensibly with more than one per process _if_
pty_pre_init isn't required.

[originally from svn r5261]
2005-02-06 15:14:34 +00:00
Simon Tatham
3fb9e2326d The pty backend won't _always_ be running under X, so it should be
possible to compile it without the WINDOWID variable.

[originally from svn r5259]
2005-02-06 13:33:41 +00:00
Simon Tatham
fd961b398a When allocating BSD-style ptys, we should not be satisfied with a
/dev/ptyXX we can open: we must also check that we can open and use
the corresponding /dev/ttyXX, because if it's been left in the wrong
mode then we will look terribly silly when we fork and _then_
discover our pty is unusable.

[originally from svn r5257]
2005-02-05 15:33:36 +00:00
Ben Harris
3d44cb23c8 Use AF_UNIX, not AF_LOCAL, since the former is in POSIX and the latter is not.
[originally from svn r5220]
2005-01-28 11:47:33 +00:00
Ben Harris
865fbaa8ce Overhaul of client-side XDM-AUTHORIZATION-1:
* Make sk_getxdmdata() return an arbitrary string rather than two integers.
  This better matches the spec, even if the current version always returns
  six bytes
* On Unix, for PF_UNIX sockets, return a counter rather than a constant along
  with the PID.  This should allow multiple clients to connect within one
  second, and is what Xlib does.
* On Unix, interpret AF_INET6 addresses like Xlib does, returning the
  embedded IPv4 address for v4-mapped addresses, and six bytes of zeroes
  otherwise.  The latter is silly, but if I'm going to do anything more sane
  I need to check that X servers won't reject it.

[originally from svn r5219]
2005-01-28 11:39:45 +00:00
Ben Harris
5e35aa383a Buffer overruns are embarassing (even if caused by user error), so assert
that this one can't happen until I actually fix it.

[originally from svn r5217]
2005-01-26 23:49:56 +00:00
Ben Harris
3f725a56ef Move sockaddr_is_loopback() to before sk_address_is_local(), and define the
latter in terms of the former.  Also adjust the definition of
ipv4_is_loopback() to avoid using the non-standard inet_netof() and
IN_LOOPBACKNET, and move it next to its remaining uses.

[originally from svn r5215]
2005-01-26 20:18:33 +00:00
Ben Harris
15e7d71f39 When checking if a connection comes from localhost, don't assume it's an IPv4
connection.  Instead, correctly check IPv4 and IPv6 connections, assume that
AF_LOCAL is always local, and anything else is always remote.

This makes trivial local-to-remote forwarding work on my system.

[originally from svn r5180]
2005-01-23 14:31:08 +00:00
Ben Harris
30fae9ffcb When calling getaddrinfo() for a listening socket, pass in a suggested type
of SOCK_STREAM, since that's what we'll be using.

[originally from svn r5170]
2005-01-22 15:32:10 +00:00
Ben Harris
a54961fe87 Stupid typo, spotted by GCC.
[originally from svn r5168]
2005-01-22 15:20:35 +00:00
Ben Harris
258a87361a If getaddrinfo() fails, it's not safe to dereference the struct addrinfo* it
passes back to us, so don't.

[originally from svn r5167]
2005-01-22 15:19:21 +00:00
Ben Harris
961319c14c Dispose of a variable whose only use was being set to zero.
[originally from svn r5156]
2005-01-20 21:45:42 +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
Simon Tatham
8167dfd406 Rewrite of Unix sk_newlistener() which should fix any possible
problems involving trying to bind an IPv6 socket to an IPv4 address.

[originally from svn r5115]
2005-01-16 12:37:19 +00:00
Ben Harris
178a66ea0f Turn of ICRNL in the client tty when we're not in editing mode. This
means that we send literal CRs and let the remote pty layer work out what to
do with them, so that if it wants raw mode it can have it.

[originally from svn r5114]
2005-01-15 20:39:27 +00:00
Ben Harris
b4f0ffc2bf INADDR_NONE is nonstandard. Use (in_addr_t)(-1) instead.
[originally from svn r5109]
2005-01-14 19:28:18 +00:00
Simon Tatham
378dbbb06b sk_namelookup() on Unix was failing to translate from our platform-
independent ADDRTYPE_* constants to real AF_* ones, causing explicit
protocol specification to fail.

[originally from svn r5089]
2005-01-09 14:55:55 +00:00
Owen Dunn
06434ffc71 New function ltime() returns a struct tm of the current local time.
Fixes crashes when time() returns (time_t)-1 on Windows by using the
Win32 GetLocalTime() function.  (The Unix implementation still just 
uses time() and localtime().)

[originally from svn r5086]
2005-01-09 14:27:48 +00:00
Simon Tatham
3669401216 Having laboriously constructed a hints parameter for getaddrinfo, it
would help to _use_ it!

[originally from svn r5085]
2005-01-09 11:58:36 +00:00
Simon Tatham
e6dd93c25a Don't forget to initialise ret->ai to NULL in sk_nonamelookup. Was
causing segfaults in IPv6-enabled Unix PuTTY connecting through a
proxy when letting the proxy do the DNS.

[originally from svn r5064]
2005-01-04 17:39:35 +00:00
Ben Harris
8053aea360 If we're going to use select(), we need <sys/select.h>.
[originally from svn r5063]
2005-01-04 14:37:32 +00:00
Simon Tatham
b93e12d477 It's a new year!
[originally from svn r5061]
[this svn revision also touched putty-website]
2005-01-02 09:19:14 +00:00
Simon Tatham
c64ad3bb0c Rename some of the more stupidly named files in the Unix back end.
Notably pterm.c, which was a sensible name right at the start but
became a misnomer as soon as I created Unix PuTTY.

[originally from svn r5053]
2004-12-31 13:02:46 +00:00
Ben Harris
bb4b9039b4 If we're going to define _XOPEN_SOURCE, we should at least define it to a
version that includes putenv().  Make it 600 (the current one) for good
measure.

[originally from svn r5048]
2004-12-30 17:29:54 +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
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
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
Jacob Nevins
a27ce0492b Fix line cursor colours (fallout from `256-colours'), on both Windows and Unix.
[originally from svn r5012]
2004-12-19 22:37:05 +00:00
Simon Tatham
b3b70d749f 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.

[originally from svn r5006]
2004-12-17 14:25:53 +00:00
Simon Tatham
ebf507497d 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.

[originally from svn r4997]
2004-12-17 09:43:09 +00:00
Simon Tatham
6c81ee6706 General mechanism for ensuring a dodgy SFTP server can't return
malicious filenames via FXP_READDIR.

[originally from svn r4995]
2004-12-16 19:36:47 +00:00
Simon Tatham
f1585f8f46 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.

[originally from svn r4993]
2004-12-16 19:15:38 +00:00
Simon Tatham
a4fe439184 Implement mget and mput in PSFTP, supporting wildcards.
[originally from svn r4991]
[this svn revision also touched putty-wishlist]
2004-12-16 17:35:20 +00:00
Simon Tatham
6ef62aacfc 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.

[originally from svn r4965]
2004-12-10 11:41:14 +00:00
Owen Dunn
30e94b6a5c Fix segfault when HOME not set on Unix.
[originally from svn r4948]
2004-12-07 11:50:44 +00:00
Jacob Nevins
4cb0ead447 Another default-background fix for 256-colour mode
[originally from svn r4931]
2004-11-30 01:07:29 +00:00
Simon Tatham
0600e8cf75 Bah, there's always one thing I miss. Correct the background-colour
handling in Unix PuTTY.

[originally from svn r4918]
2004-11-28 15:18:23 +00:00
Simon Tatham
e4e10e494b Implement xterm 256-colour mode.
[originally from svn r4917]
[this svn revision also touched putty-wishlist]
2004-11-28 15:13:34 +00:00
Simon Tatham
92f3b101f5 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.

[originally from svn r4911]
2004-11-27 19:34:45 +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
1aa64afc30 I think rjk meant setpgid', not setpgrp'.
[originally from svn r4897]
2004-11-24 11:42:45 +00:00
Simon Tatham
4f197b872e 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.

[originally from svn r4896]
2004-11-24 11:36:08 +00:00
Jacob Nevins
739de21c6d 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.

[originally from svn r4832]
2004-11-19 21:05:31 +00:00
Simon Tatham
8a99993c88 Remove .cvsignore files on all active branches.
[originally from svn r4788]
[this svn revision also touched bmbm,caltrap,charset,enigma,filter,fonts,golem,grunge,halibut,html,lj,local,misc,polyhedra,putty-website,putty-wishlist,puzzles,pycee,sdlgames,svn-tools,timber,tweak]
2004-11-16 15:29:14 +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
4482a79162 Telnet specials menu was not being reinstated after a session was restarted in
the same window (Windows version only).

Policy change: it's now the backend's responsibility to call
update_specials_menu() at the start of a session (or whenever it feels ready),
if it has any special commands. Otherwise the menu won't be displayed.

[originally from svn r4649]
2004-10-17 14:44:27 +00:00
Simon Tatham
1b3eb3e20d Markus Kuhn's UTF-8 page
http://www.cl.cam.ac.uk/~mgk25/unicode.html#activate
feels strongly that it should be easy to make _all_ your
applications work in UTF-8 mode, without having to remember a switch
for each one. Every application should simply note a UTF-8 locale
setting and switch into UTF-8 mode automatically.

Therefore, for the Unix port only, there's now a checkbox, enabled
by default, which causes the drop-down Translation box to be
overridden if the locale indicates UTF-8. Anyone who doesn't like
this, or doesn't like MGK, is welcome to turn it straight back off.

I'm not _completely_ convinced by MGK's argument myself; for
xterm/pterm to do _useful_ UTF-8 you also need to specify a decently
Unicode-capable font, and there's no way _that_ can be automagically
done on noticing a locale setting. But it's a de facto standard
(i.e. xterm does it :-) so I might as well at least be _able_ to
support it.

[originally from svn r4648]
2004-10-16 14:17:58 +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
Jacob Nevins
94546cdc2a Mention plink's new -N option in usage and man page.
[originally from svn r4643]
2004-10-15 23:32:01 +00:00
Simon Tatham
aa3c6302b1 And fix _cursor_ display on double-width double-width characters (as
it were).

[originally from svn r4637]
2004-10-15 12:25:51 +00:00
Simon Tatham
4eef9ce190 Double-height and double-width line attributes (ESC#3, ESC#4, ESC#6)
were not working correctly with double-width Unicode characters (CJK).

[originally from svn r4636]
2004-10-15 12:17:48 +00:00
Simon Tatham
db54732e38 Fix cursor display on a combined character cell.
[originally from svn r4625]
2004-10-15 08:51:57 +00:00
Simon Tatham
089775eb02 First-stage support for Unicode combining characters. The `chars'
array of each `termline' structure now contains optional additional
entries after the normal number of columns, which are used to chain
a linked list of combining characters off any primary termchar that
needs it. This means we support arbitrarily many combining
characters per cell (unlike xterm's hard limit of 2).

Cut and paste works correctly (selecting a character cell containing
multiple code points causes all those code points to be cut and
pasted). Display works by simply overlaying all the relevant
characters on top of one another; this is good enough for Unix
(xterm does the same thing), and mostly seems OK for Windows except
that the Windows Unicode fonts have a nasty habit of not containing
most of the combining characters and thus overlaying an
unknown-code-point box on your perfectly good base glyph.

I had no idea how to add support in the Mac do_text(), so I've
simply stuck in an assertion that will trigger the first time a
combining character is displayed, and hopefully this will bite
someone with the clue to fix it.

[originally from svn r4622]
2004-10-14 16:42:43 +00:00
Simon Tatham
709a94e5f2 Re-engineering of terminal emulator, phase 1.
The active terminal screen is no longer an array of `unsigned long'
encoding 16-bit Unicode plus 16 attribute bits. Now it's an array of
`termchar' structures, which currently have 32-bit Unicode and 32
attribute bits but which will probably expand further in future.

To prevent bloat of the memory footprint, I've introduced a mostly
RLE-like compression scheme for storing scrollback: each line is
compressed into a compact (but hard to modify) form when it moves
into the term->scrollback tree, and is temporarily decompressed when
the user wants to scroll back over it. My initial tests suggest that
this compression averages about 1/4 of the previous (32 bits per
character cell) data size in typical output, which means this is an
improvement even without counting the new ability to extend the
information stored in each character cell.

Another beneficial side effect is that the insane format in which
Unicode was passed to front ends through do_text() has now been
rendered sane.

Testing is incomplete; this _may_ still have instabilities. Windows
and Unix front ends both seem to work as far as I've looked, but I
haven't yet looked very hard. The Mac front end I've edited (it
seemed obvious how to change it) but I can't compile or test it.

As an immediate functional effect, the terminal emulator now
supports full 32-bit Unicode to whatever extent the host platform
allows it to. For example, if you output a 4-or-more-byte UTF-8
character in Unix pterm, it will not display it properly, but it
will correctly paste it back out in a UTF8_STRING selection. Windows
is more restricted, sadly.

[originally from svn r4609]
2004-10-13 11:50:16 +00:00
Jacob Nevins
98028c746f X forwarding changes:
- new function platform_get_x_display() to find a sensible local display.
   On Unix, the Gtk apps weren't taking account of --display when
   determining where to send forwarded X traffic.
 - explicitly document that leaving X display location blank in config tries
   to do something sensible (and that it's now blank by default)
 - don't override X11Display setting in plink, since that's more properly
   done later

[originally from svn r4604]
2004-10-06 22:31:07 +00:00
Jacob Nevins
3a11379597 Line (as opposed to block) cursors were being displayed when they shouldn't
have been, including when they were blinked off. Fixes Debian bug #272877.

[originally from svn r4586]
2004-09-28 20:42:39 +00:00
Jacob Nevins
43c4ff62d7 ampersat-in-username': tweak strchr' to `strrchr' where necessary to
consistently support usernames containing `@'.

[originally from svn r4563]
2004-09-21 16:49:51 +00:00
Simon Tatham
5d5ffc274f Credit Malcolm Smith in the copyrights.
[originally from svn r4518]
2004-08-30 13:23:23 +00:00
Jacob Nevins
b892d14103 Patch to use enum constants for cfg.funky_type instead of numeric
literals, from "Anthony" <410C2A86.2010003@mail2004.ajrh.net>.

[originally from svn r4491]
2004-08-20 14:04:13 +00:00
Jacob Nevins
97fb4184d8 Fix an annoying inconsistency that's been bugging me for years: "plink host"
and "plink user@host" differed in that the former attempted to load session
`host' while the latter didn't. Now both forms attempt to load a session.
Someone will probably complain, but hey.

[originally from svn r4485]
2004-08-19 15:05:31 +00:00
Jacob Nevins
87ecc7e052 Remove claim in usage text that Plink defaults to SSH, since it's not true
in a number of situations.

[originally from svn r4484]
2004-08-19 13:15:02 +00:00
Jacob Nevins
df66432b5d Patch from Kurt Roeckx: apparently on Debian amd64, the ut_time member of
struct utmp is not equivalent to time_t (it's 32-bit). From Debian bug#265910.

[originally from svn r4459]
2004-08-16 09:38:12 +00:00
Simon Tatham
0047bbe70f Implement `Restart Session', in both Unix and Windows PuTTY. Largely
because Owen questioned whether it was really easy enough to be
labelled `fun' in the bug database :-)

[originally from svn r4453]
2004-08-14 13:04:18 +00:00
Simon Tatham
3b647115a5 Fix double-free in X selection code.
[originally from svn r4367]
2004-07-27 15:20:37 +00:00
Jacob Nevins
c2914f2191 Fix for `psftp-pscp-ignore-load': Default Settings is now loaded
before "-load" is processed so that it doesn't clobber it.

I've also changed the semantics of "-load" slightly for PSCP, PSFTP,
and Plink: if it's specified at all, it overrides (disables) the
implicit loading of session details based on a supplied hostname
elsewhere (on the grounds that the user is more likely to want the
"-load" session than the implicit session). (PuTTY itself doesn't do
implicit loading at all, so I haven't changed it.)

This means that all the PuTTY tools' behaviour is now consistent iff
"-load" is specified (otherwise, some tools have implicit-session, and
others don't).

However, I've not documented this behaviour, as there's a good chance
it will be swept away if and when we get round to sorting out how we
deal with settings from multiple sources. It's intended as a "do
something sensible" change.

[originally from svn r4352]
2004-07-25 14:00:26 +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
a2acc6ae0d RJK's patch to enable PuTTY's X forwarding to connect to local X
servers using Unix sockets (on Unix only, obviously!).

[originally from svn r4263]
2004-05-31 14:01:52 +00:00
Simon Tatham
be5133f376 Arnaud Desitter points out a silly mistake in retrieve_cutbuffer()
(don't test for `int *nbytes' being <= 0, test for the integer it
points to being <= 0!).

[originally from svn r4254]
2004-05-24 11:30:15 +00:00
Simon Tatham
2ff7b4385f Fix indentation after Richard B's patch in rev 1.137 [r3409].
[originally from svn r4241]
[r3409 == 7798a59987]
2004-05-22 14:21:27 +00:00
Jacob Nevins
2b4e286954 Tweak documentation of -V option.
[originally from svn r4132]
2004-04-24 12:25:09 +00:00
Owen Dunn
6863377b72 Add -V for version information to plink, pscp, and psftp.
[originally from svn r4092]
2004-04-17 20:25:09 +00:00
Simon Tatham
ff6e3bc94d Now that Halibut is capable of generating man pages better than I
can do it by hand, I've converted the man page set from Unix PuTTY
into Halibut format, and enhanced the Makefile so it will build
them. At some future point this will also allow me to include the
man pages as an appendix in the main manual (once I _have_ a main
manual for Unix PuTTY).

[originally from svn r3966]
2004-03-24 19:36:04 +00:00
Jacob Nevins
e9ae739b9a Add (probably frustratingly) bare-bones man pages for pscp and psftp.
[originally from svn r3890]
2004-02-22 15:05:29 +00:00
Jacob Nevins
866cd6126c Fix typo in -C
[originally from svn r3887]
2004-02-22 14:40:40 +00:00
Jacob Nevins
a5ea485d0f Tart up, fix outright lies, mention web docs
[originally from svn r3886]
2004-02-22 14:37:54 +00:00
Jacob Nevins
c6d8ab8bd3 Remove claim that there's no Unix puttygen
[originally from svn r3860]
2004-02-13 00:21:35 +00:00
Jacob Nevins
5e2a33caec Patch from Theo Markettos: apparently "BSD-derived IP stacks fall over when
trying to bind to the localhost interface with a sockaddr_in which has non-zero
sin_zero fields." Zero sockaddr_in (and sockaddr_in6) before any use.

[originally from svn r3793]
2004-02-03 14:47:43 +00:00
Jacob Nevins
8472b1c8d7 Patch from Colin Watson: document pterm.WarnOnClose
[originally from svn r3792]
2004-02-03 14:36:01 +00:00
Simon Tatham
3f199bfe5c Add a man page for the new command-line PuTTYgen.
[originally from svn r3766]
2004-01-23 13:21:25 +00:00
Simon Tatham
2d1287b9ca Added a command-line key generation tool. Currently builds and runs
on Linux, but the (very few) platform-specific bits are already
abstracted out of the main code, so it should port to other
platforms with a minimum of fuss.

[originally from svn r3762]
2004-01-22 19:15:32 +00:00
Simon Tatham
4dec95f80f Theo Markettos's unsigned-vs-signed-char pedantry patch.
[originally from svn r3753]
2004-01-21 19:45:44 +00:00
Jacob Nevins
352ec6a486 `portfwd-loopback-choice' was not consistently documented.
- update usage info in tools
   - ack, plink is over 24 lines now
 - update man pages for Unix version
 - Doc changes:
   - move long description from (GUI) "config" to "using"
     - sorry if complete specification isn't what this section is meant for,
       but if you only read "using" it was hard to find.
   - ensure enough references to this made in other sections (GUI,
     command-line)
   - update instance of plink usage info

[originally from svn r3740]
2004-01-20 12:46:36 +00:00
Simon Tatham
2dd7514b07 Idiot me _twice_! The new store_host_key() was failing in the
absence of an existing host key file. Duhh.

[originally from svn r3737]
2004-01-19 09:37:17 +00:00
Simon Tatham
0f259c23ea Various uninitialised-variable accesses picked up by valgrind.
[originally from svn r3723]
2004-01-17 14:25:36 +00:00
Simon Tatham
276c8335af Idiot me! store_host_key() was blindly _appending_ new host keys to
the end of the host key file. This is perfectly all right if a host
key never changes, but it's completely useless if you need to
replace an existing entry. This version should do better.

[originally from svn r3719]
2004-01-17 13:00:18 +00:00
Simon Tatham
2817a7e150 It's a new year.
[originally from svn r3679]
[this svn revision also touched putty-website]
2004-01-01 16:47:55 +00:00
Simon Tatham
d76a39d547 Close the host keys file after use. Well spotted Theo Markettos.
[originally from svn r3526]
2003-10-31 21:45:15 +00:00