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

62 Коммитов

Автор SHA1 Сообщение Дата
Simon Tatham 5bd604f53f Phase 1a of SFTP re-engineering: fix the glaring memory and request
ID leak in the previous checkin. Oops :-)

[originally from svn r3319]
2003-06-29 14:47:14 +00:00
Simon Tatham 3e44064f32 First phase of SFTP re-engineering. Each base-level fxp_* function
has been split into a send half and a receive half, so that callers
can set several requests in motion at a time and deal with the
responses in whatever order they arrive.

[originally from svn r3318]
2003-06-29 14:26:09 +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 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 c399f8381f Fixing trivial warnings spotted by Mingw-2.0.0/gcc-3.2:
psftp.c: In function `sftp_cmd_chmod':
  psftp.c:835: warning: too many arguments for format

[originally from svn r2333]
2002-12-15 13:25:24 +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 7c95ea19c8 Robustness fixes for KEXINIT handling and others. In particular, I've
created a self-mallocing variant of sprintf, to obviate any future
need for paranoid %.100s type stuff in format strings.

[originally from svn r2199]
2002-11-07 19:49:03 +00:00
Simon Tatham c5114a92a6 Half of Lars Gunnarsson's iXplorer compatibility patch: the PSFTP
login prompt should be fflushed (presumably fgets fails to implicitly
do this when stdin and stdout are redirected weirdly).

[originally from svn r2186]
2002-11-03 08:46:35 +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 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 01e1450870 Fix pscp-cmdline-port-bug for PSFTP too. (Also removes what appears to be a
gratuitous re-implementation of the "-l user" option.)

[originally from svn r1997]
2002-10-07 17:31:52 +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 ae2599845c Fix major memory leak in sftp_cmd_ls (thanks to Hans-Juergen Petrich
for pointing it out).

[originally from svn r1612]
2002-03-31 16:26:13 +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 6e1ac92194 Oops - get the forward declaration right in that hack
[originally from svn r1566]
2002-02-27 22:30:57 +00:00
Simon Tatham 98dd3cb9f2 Fix silly segfault due to PSFTP thinking connection is fine even if
fxp_init() fails to get initial packet.

[originally from svn r1565]
2002-02-27 22:20:30 +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 811b9b7d18 Oops - fputs takes the file pointer second, not first!
[originally from svn r1513]
2001-12-20 14:19:10 +00:00
Simon Tatham e822f2b204 The alphabetical ordering in the psftp command list was broken. D'oh!
[originally from svn r1508]
2001-12-19 18:49:32 +00:00
Simon Tatham 0d7dc070d5 Add the `local' command set to PSFTP: lcd, lpwd, and ! to spawn a
Windows command.

[originally from svn r1501]
2001-12-16 13:33:04 +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 2f67503ad7 Fix trivial problems with PSFTP batch mode
[originally from svn r1483]
2001-12-14 10:06:09 +00:00
Simon Tatham 8ecf3e147d Tidied up PSFTP batch mode. The gross hack using fxp_error_message
to report command failures is now gone; instead each sftp_cmd_*
routine returns 0 or 1 depending on success, like they should have
done right from the start. This fixes problems with `ls' prematurely
terminating PSFTP batch files.

[originally from svn r1481]
2001-12-13 19:26:51 +00:00
Simon Tatham 9cfcab6cb6 Allow PSFTP to be run with no arguments, in which case it enters the
command-line state but all commands are disallowed except `open
host.name'. The idea is to provide marginal extra niceness for
people who double-click the icon without realising it's a cmdline app.

[originally from svn r1480]
2001-12-13 18:42:34 +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 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 39c3f9b8bc Fix pasting of newlines in local line editing mode. Possibly not a
very _good_ fix; something might want doing after the release.

[originally from svn r1277]
2001-09-19 20:07:15 +00:00
Simon Tatham 98af2ddc72 PSFTP: when choosing a default destination filename for `get' and
`put', it makes more sense to pick the _basename_ of the source
rather than use the whole path - particularly when the latter might
cause us to try to use a DOS pathname like `f:\stuff' in a Unix (or
worse, such as VMS!) file system.

[originally from svn r1265]
2001-09-12 20:16:45 +00:00
Simon Tatham 7692bf350a psftp and pscp should disable all forwarding (ports, X, agent).
Partly because that's a good idea _anyway_, and partly because it
seems to be causing trouble. (Specifically, their pathetic attempt
to emulate plink's proper select handling seems to get confused when
the back end tries to open a local listening socket.)

[originally from svn r1264]
2001-09-12 20:11:48 +00:00
Simon Tatham 89e59fc5a3 Add the `pwd' command in PSFTP.
[originally from svn r1262]
2001-09-09 16:31:26 +00:00
Simon Tatham 31eb324fd1 Add online help in PSFTP.
[originally from svn r1261]
2001-09-09 16:29:51 +00:00
Simon Tatham 716d2b1e04 psftp is an interactive program and the ssh.c flags should reflect
this (so we get login banners and a little more verbosity during
authentication).

[originally from svn r1257]
2001-09-09 10:41:42 +00:00
Simon Tatham 6dacf35120 Better yet, look for sftp-server on the user's PATH as well, which
allows individual users with shell access to install it without
reference to the admin.

[originally from svn r1229]
2001-09-05 19:58:25 +00:00
Simon Tatham cb1aa5d0f3 PSFTP will now attempt to find /usr/[local]/lib/sftp-server if it
can't start the sftp subsystem. This should enable convenient sftp
access to SSH1-only systems: all the admin needs is to install
sftp-server in the right place.

[originally from svn r1228]
2001-09-05 19:48:52 +00:00
Simon Tatham 306a13c025 Further tightening up in PSCP. Fixed a couple more holes whereby a
malicious SCP server could have written to areas other than the ones
the user requested; cleared up buffer overruns everywhere. Hopefully
we now do not use arbitrary buffer limits _anywhere_.

[originally from svn r1205]
2001-08-26 15:31:29 +00:00
Simon Tatham 9c5951ed35 More upgrades to psftp: it now supports mv, chmod, reget and reput.
[originally from svn r1203]
2001-08-26 11:35:11 +00:00