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

81 Коммитов

Автор SHA1 Сообщение Дата
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 e30aed9a6f The WinSock library is now loaded at run-time, which means we can
attempt to load WS2 and then fall back to WS1 if that fails. This
should allow us to use WS2-specific functionality to find out the
local system's list of IP addresses, thus fixing winnet-if2lo, while
degrading gracefully back to the previous behaviour if that
functionality is unavailable. (I haven't yet actually done this; I've
just laid the groundwork.)
This checkin _may_ cause instability; it seemed fine to me on
initial testing, but it's a bit of an upheaval and I wouldn't like
to make bets on it just yet.

[originally from svn r3502]
2003-10-12 13:46:12 +00:00
Jacob Nevins 8e2fd15bd5 Remove all the "assert(len>0)" which forbade zero-length writes across the
from_backend() interface, after having made all implementations safe against
being called with len==0 and possibly-NULL/undefined "data".

(This includes making misc.c:bufchain_add() more robust in this area.)

Assertion was originally added 2002-03-01; e.g., see plink.c:1.53 [r1571].

I believe this now shouldn't break anything.

This should hopefully make `ppk-empty-comment' finally GO AWAY. (Tested
with Unix PuTTY.)

[originally from svn r3500]
[r1571 == fdbd697801]
2003-10-12 13:16:39 +00:00
Jacob Nevins 5690a72640 New option for plink: "-s" specifies that the remote command is an SSH-2
subsystem. (pinched from OpenSSH)

[originally from svn r3426]
2003-08-29 19:06:22 +00:00
Simon Tatham 6bb121ecb9 Colin's const-fixing Patch Of Death. Seems to build fine on Windows
as well as Unix, so it can go in.

[originally from svn r3162]
2003-05-04 14:18:18 +00:00
Simon Tatham 135abf2445 Asynchronous agent requests on Windows. Actually, I've kept the
ability to do synchronous ones as well, because PSCP and PSFTP don't
really need async ones and it would have been a serious pain to
implement them. Also, Pageant itself when run as a client of its
primary instance doesn't benefit noticeably from async agent
requests.

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

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

[originally from svn r3014]
2003-03-29 16:14:26 +00:00
Simon Tatham bd16b29a7a Oops, Ben is quite right about the rather appalling design of
filename_from_str. Here's a better fix, with some const
repercussions too.

[originally from svn r2768]
2003-02-01 17:24:27 +00:00
Jacob Nevins 36f133b374 Fix "-v" in the Windows console utilities (plink, pscp, psftp).
I'm not convinced I've done this the right way (I've introduced a static for
logctx in console.c) but it will do for now.

[originally from svn r2674]
2003-01-21 19:18:06 +00:00
Simon Tatham 6af1a9e4e9 Having laid all the groundwork, we can now remove the global `cfg'
completely from putty.h. It's now static in each of the command-line
front ends, shared only between window.c and windlg.c in PuTTY
proper (I've tested this by doing #define cfg cfgsillyname in those
two files only, and it still links so nobody else is using that
symbol!), and part of the `inst' structure in pterm. I think that
only leaves the Unicode module as the last stubborn holdout in the
anti-global-variables campaign.

[originally from svn r2568]
2003-01-12 15:32:31 +00:00
Simon Tatham 2d469ba497 The logging module now contains a local copy of cfg too.
[originally from svn r2566]
2003-01-12 15:10:27 +00:00
Simon Tatham f49c8c5a07 The back ends now contain their own copies of the Config structure,
and have a function to pass in a new one. (Well, actually several
back ends don't actually bother to do this because they need nothing
out of Config after the initial setup phase, but they could if they
wanted to.)

[originally from svn r2561]
2003-01-12 14:48:29 +00:00
Simon Tatham 5738dc219b The command-line routines now take a pointer to `cfg' as an
argument, so they don't depend on it being a global any more.

[originally from svn r2555]
2003-01-12 14:17:03 +00:00
Jacob Nevins 6f5012dfa6 Fixing trivial warnings spotted by Mingw-2.0.0/gcc-3.2:
plink.c:65: warning: `password' defined but not used
(introduced in 1.50 [r1525])

[originally from svn r2332]
[r1525 == 466b1c82d5]
2002-12-15 13:23:13 +00:00
Jacob Nevins e891f79c12 Fixing trivial warnings spotted by Mingw-2.0.0/gcc-3.2:
plink.c: In function `from_backend':
  plink.c:172: warning: unused variable `h'
(introduced in 1.35 [r1198])

[originally from svn r2331]
[r1198 == c87fa98d09]
2002-12-15 13:19:59 +00:00
Simon Tatham 0c110dcd10 Fixes for more robust handling of command-line parse errors.
[originally from svn r2236]
2002-11-20 20:09:02 +00:00
Simon Tatham 4756c15fc9 Yet more global-removal. The static variables in logging.c are now
absent, and also (I think) all the frontend request functions (such
as request_resize) take a context pointer, so that multiple windows
can be handled sensibly. I wouldn't swear to this, but I _think_
that only leaves the Unicode stuff as the last stubborn holdout.

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

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

[originally from svn r2141]
2002-10-26 10:16:19 +00:00
Simon Tatham 72ff571148 Major destabilisation, phase 2. This time it's the backends' turn:
each backend now stores all its internal variables in a big struct,
and each backend function gets a pointer to this struct passed to
it. This still isn't the end of the work - lots of subsidiary things
still use globals, notably all the cipher and compressor modules and
the X11 forwarding authentication stuff. But ssh.c itself has now
been transformed, and that was the really painful bit, so from here
on it all ought to be a sequence of much smaller and simpler pieces
of work.

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

[originally from svn r2115]
2002-10-22 16:11:33 +00:00
Simon Tatham a24d9d3029 Fix for `hostname-whitespace'; thanks to Justin Bradford.
[originally from svn r2080]
2002-10-16 11:35:13 +00:00
Simon Tatham 6d0e9b205d First phase of porting. pterm now compiles and runs under Linux+gtk.
The current pty.c backend is temporarily a loopback device for
terminal emulator testing, the display handling is only just enough
to show that terminal.c is functioning, the keyboard handling is
laughable, and most features are absent. Next step: bring output and
input up to a plausibly working state, and put a real pty on the
back to create a vaguely usable prototype. Oh, and a scrollbar would
be nice too.
In _theory_ the Windows builds should still work fine after this...

[originally from svn r2010]
2002-10-09 18:09:42 +00:00
Jacob Nevins 8d5f7e293e Remove "-log" option from Plink. AFAICT this code has been dead since Roman
Pompejus' improved logging (Jan 2001).

[originally from svn r2000]
2002-10-07 17:43:07 +00:00
Jacob Nevins c7fa2f6183 Updated usage messages for command-line utilities to reflect new options.
Updated manual to reflect reality (e.g. usage messages, '-p port' not actually
  implemented, sprinkle references to '-i keyfile').
(I've put "Release 0.53" in the messages; let's hope this doesn't cause a
  flood of "where is 0.53?" email.)
I don't guarantee that the result is entirely sane and sensible in all
  respects, but it is at least consistent.

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

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

[originally from svn r1574]
2002-03-06 20:13:22 +00:00
Simon Tatham fdbd697801 from_backend() should always be called with len > 0. Only rlogin
mode ever failed to do this, and only Plink actually had a problem
with it, so this didn't become obvious for a while. rlogin mode is
fixed, and all implementations of from_backend() now contain an
assertion so that we should spot errors of this type more quickly in
future.

[originally from svn r1571]
2002-03-01 13:17:45 +00:00
Simon Tatham a05d76fb1f Patch to enable >512-character command lines. Thanks to Thomas Halling.
[originally from svn r1567]
2002-02-27 22:31:23 +00:00
Simon Tatham 290e08ae76 Plink's front-end select loop was failing to send error messages to
winnet.c. The result was that complete failures to make an SSH
connection (connection refused, for example) were causing a hang
instead of a proper error report.

[originally from svn r1539]
2002-01-10 13:06:26 +00:00
Simon Tatham 466b1c82d5 Create the long-awaited console.c, and move the common routines out
of scp.c, psftp.c and plink.c into it. Additionally, add `batch
mode', in which all the interactive prompts (bad host key, log file
exists, insecure cipher, password prompt) are disabled and safe
responses are assumed. (The idea being that if you run PSCP, for
example, in a cron job then you'd probably rather it failed and
exited instead of leaving the cron job wedged while it waits for
user input that will never arrive.)

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

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

[originally from svn r1493]
2001-12-14 14:57:50 +00:00
Simon Tatham 5d2488a58e Add -rlogin to Plink, for orthogonality (and because I documented it
yesterday!).

[originally from svn r1462]
2001-12-07 20:36:56 +00:00
Simon Tatham 3270c74f9e Configurable TCP_NODELAY option on network connections
[originally from svn r1428]
2001-11-29 21:47:11 +00:00
Simon Tatham 6608016fc2 INCOMPATIBLE CHANGE to the SSH2 private key file format. There is
now a passphrase-keyed MAC covering _all_ important data in the
file, including the public blob and the key comment. Should
conclusively scupper any attacks based on nobbling the key file in
an attempt to sucker the machine that decrypts it. MACing the
comment field also protects against a key-substitution attack (if
someone's worked out a way past our DSA protections and can extract
the private key from a signature, swapping key files and
substituting comments might just enable them to get the signature
they need to do this. Paranoid, but might as well).

[originally from svn r1413]
2001-11-25 14:31:46 +00:00
Simon Tatham 9d814fd26e Oops - fix another segfault in that -L and -R code
[originally from svn r1412]
2001-11-25 12:23:34 +00:00
Simon Tatham 14ab514528 Rob Wood's patch to provide standard -L and -R options for port
forwarding in Plink. Cleaned up a bit to remove segfaults and work
correctly with saved sessions.

[originally from svn r1411]
2001-11-25 11:36:49 +00:00
Simon Tatham a7f196263e The other utilities should do the same processing of the hostname
(parsing `user@' prefixes etc) that PuTTY proper does.

[originally from svn r1346]
2001-10-30 21:45:27 +00:00
Simon Tatham f9bbdc1226 Don't quit the plink main loop until the stdout and stderr buffers
are empty.

[originally from svn r1313]
2001-10-23 19:22:01 +00:00
Simon Tatham 7d27dbe4c7 Extra line in the help text to mention you can use a saved session
as well as a hostname.

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

[originally from svn r1239]
2001-09-07 22:39:01 +00:00
Simon Tatham ea27f048f9 Fix various small compiler warnings, mostly unused local variables
[originally from svn r1218]
2001-08-28 08:08:43 +00:00
Simon Tatham ff9a038cdd PSCP now uses the modern SFTP protocol if it can, and falls back to
scp1 if it can't. Currently not very tested - I checked it in as
soon as it completed a successful recursive copy in both directions.
Also, one known bug: you can't specify a remote wildcard, because by
the nature of SFTP we'll need to implement the wildcard engine on
the client side. I do intend to do this (and use the same wildcard
engine in PSFTP as well) but I haven't got round to it yet.

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

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

[originally from svn r1198]
2001-08-25 17:09:23 +00:00
Simon Tatham 50766ce729 SSH port forwarding! How cool is that?
Only currently works on SSH1; SSH2 should be doable but it's late
and I have other things to do tonight. The Cool Guy award for this
one goes to Nicolas Barry, for doing most of the work and actually
understanding the code he was adding to.

[originally from svn r1176]
2001-08-08 20:44:35 +00:00
Simon Tatham 865760106f Make sure the default protocol doesn't ever end up undefined in Plink.
[originally from svn r1140]
2001-05-19 15:59:02 +00:00
Simon Tatham 52a688abd1 The host-key-unknown prompt now offers the same three options as the
host-key-changed prompt: update-cache-and-connect, connect-without-
updating-cache, and abandon-connection. (Previously the middle one
was missing.)

[originally from svn r1122]
2001-05-13 14:11:49 +00:00