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

4648 Коммитов

Автор SHA1 Сообщение Дата
Simon Tatham 7705fc4470 Fix buffer management in strbuf_catfv.
Thanks to Tim Kosse for pointing out that I had _completely_ cocked up
all the code that was supposed to enlarge the buffer in the strbuf
structure, by failing to pass in 'oldsize' to the innermost
dupvprintf_inner function by reference, so that the size was never
updated.

Fortunately, this whole mechanism was something I dashed off for the
purposes of buildinfo(), which means it's only ever used to glue
together a fixed number of compile-time string constants, for which
there turns out to be plenty to spare in the standard 512 bytes
allocated to a new strbuf. So it's at least not dangerous, though it
clearly needs to be fixed before I make the mistake of using
strbuf_catf[v] for anything else!
2017-02-20 20:46:04 +00:00
Jacob Nevins bd65d47792 New FAQ entry for 32-bit vs 64-bit. 2017-02-19 16:46:23 +00:00
Owen Dunn 4455604dbc Make Windows sockets non-inheritable
When we create a socket with socket() (in try_connect, sk_newlistener, and
ipv4_is_local_addr) also call SetHandleInformation to disable handle
inheritance for this socket.  This fixes dup-sessions-dont-close.
2017-02-19 14:04:58 +00:00
Jacob Nevins efb4996d31 Unix settings can live elsewhere than ~/.putty. 2017-02-18 23:39:14 +00:00
Jacob Nevins 23841fd85e pocketputty.net seems linksquatted.
Get rid of the non-nofollow link in the FAQ. (I doubt anyone's that
interested any more, anyway.)
2017-02-18 23:39:14 +00:00
Owen Dunn 988e26068e Regard dir/ls on non-existent directory as an error.
sftp_cmd_ls - return an error if attempting to open the directory
fails.
2017-02-18 22:51:03 +00:00
Jacob Nevins 4b372b0877 Fix a broken gitweb link. 2017-02-18 09:19:24 +00:00
Simon Tatham 92d855d0fe Implement deferred closing of Windows handle-sockets.
When a handle socket is in THAWING state and handle_socket_unfreeze is
gradually passing the backlogged data on to the plug, the plug might
suddenly turn round and close the socket in the course of handling
plug_receive(), which means that handle_socket_unfreeze had better be
careful not to have had everything vanish out from under it when that
call returns. To solve this, I've added a 'deferred close' flag which
handle_socket_unfreeze can set around its call to plug_receive, and
handle_socket_close will detect that and not actually free the socket,
instead leaving that for handle_socket_unfreeze to do under its own
control.
2017-02-17 08:40:57 +00:00
Jacob Nevins 8d48caa849 Note the interaction of jump lists and -cleanup.
Also note that recent installers don't prompt to -cleanup (this started
with 0.67's MSI installer).
2017-02-17 00:03:11 +00:00
Jacob Nevins 2e5212fb41 Document VS2015 impact on very old Windows.
(In a XXX-REVIEW-BEFORE-RELEASE form.)

Also, note the effect of compilation with different Visual Studio
versions on Windows version compatibility in the source README, for the
sake of having it written down somewhere.
2017-02-16 23:47:03 +00:00
Jacob Nevins 808aa643e6 MSI installer: add version info to product name.
This appears to be conventional, and the full version info for builds
like development snapshots is not visible elsewhere in Control Panel.
2017-02-16 10:08:14 +00:00
Jacob Nevins 2718165f01 Remove references to "Win32" and "32-bit Windows".
They were there mainly to distinguish from 16-bit Windows, which hasn't
been a thing since before a noticeable fraction of the userbase were
born, probably. These days the obvious comparison is with 64-bit
Windows.

Also tweak some wording to reflect that official PuTTY executables are
not necessarily 32-bit any more, and add some XXX-REVIEW-BEFORE-RELEASE
in the same vein.
2017-02-15 23:58:25 +00:00
Simon Tatham 7fd8915ce9 sink(): finish waiting for remote EOF after a local error.
We responded to a local error writing out the destination file by
going into a mode where we just looped round receiving and throwing
away data until our count of the file size reached the file size we
expected - but once we were in that mode, we never actually
incremented the count!
2017-02-15 21:41:28 +00:00
Simon Tatham 5d852585a1 scp_recv_filedata: handle EOF more sensibly.
xfer_download_data could return actuallen as either 0 or -1 to
indicate EOF. Now it's always 0, and scp_recv_filedata actually checks
for that case and reports an error.
2017-02-15 21:39:23 +00:00
Owen Dunn 717129b0f2 Return an error if there's an error doing pscp -ls 2017-02-15 20:54:10 +00:00
Owen Dunn 52a4ccad27 Return zero when reporting our version.
When called with -V to ask for our version, return 0 rather than 1.
This is the usual behaviour observed by ssh(1) and other Unix commands.
Also use exit() rather than cleanup_exit() in pscp.c and psftp.c ; at
this point we have nothing to cleanup!
2017-02-15 20:54:10 +00:00
Simon Tatham fb839a27fb Include the compile-time GTK version in the build info.
It's obvious to the trained eye whether GTK PuTTY was compiled against
GTK2 or GTK3, but the untrained eye would probably appreciate a little
help, and even the trained eye probably can't tell GTK 3.18 from 3.19
at a glance :-)
2017-02-15 19:32:42 +00:00
Simon Tatham 2fb3e26584 Fix multiple bugs in freeze/thaw of Windows handle-sockets.
Firstly, I had asserted that data would never arrive on a handle
socket in state FREEZING, which is just an error, because FREEZING is
precisely the state of not being quite frozen _yet_ because one last
read is still expected to arrive from the winhandl.c reading subthread
which it's too late to cancel. I meant to assert that it wasn't
FROZEN.

Secondly, when the handle socket was in state FREEZING, I failed to
actually _set_ it to FROZEN.

And thirdly, when the handle socket starts thawing again (i.e. there's
now outgoing buffer space so we can start sending our backlogged
data), I forgot to ever call bufchain_consume, so that the same block
of data would get sent repeatedly.

I can only assume that nothing I've ever done has actually exercised
this code!
2017-02-15 19:19:38 +00:00
Simon Tatham 24c9cfc800 Windows Plink: treat EOF at host key prompt as 'abort connection'.
Thanks to Didrik Nordström for pointing out that we currently treated
it as 'whatever happened to be in line[0] before ReadFile didn't get
any data'.
2017-02-15 06:03:50 +00:00
Simon Tatham 1266ac0e30 uxpgnt: correct control flow in find_key().
If we try to interpret a string argument as the name of a key file,
sometimes we it's in circumstances where we _know_ it's a key file, so
we must print an error message and return failure if the file can't be
loaded. Other times it's not, and we just fall back to interpreting
the argument in some other way (e.g. as a pattern match against the
comment or fingerprint of a key already in the agent).

My code dealing with failure returns from the public-key loading
functions were mishandling the latter case, if they identified a file
as existing and looking more or less like some kind of key file but
then it turned out to have a format error; they would try to copy and
return a public key that they didn't actually have. Even if
pageant_pubkey_copy avoided crashing as a result, this would still
inhibit the fallback to treating the input string as some other kind
of pattern match.
2017-02-15 05:47:16 +00:00
Simon Tatham 54720b2c5a Remove a redundant ?: in the nethack_keypad code.
I think all of the cases in this switch must have originally said
(shift_state ? 'this' : 'that'), and in all but the VK_NUMPAD5 case
the two options were different, and I left VK_NUMPAD5 containing a
redundant ?: just to make it line up in a nice table with the others.
But now the others all have more options than that because I had to
support Ctrl as well as Shift modifiers, so there's no reason to have
that silly ?: lingering around (and it annoys Coverity).
2017-02-15 05:47:16 +00:00
Simon Tatham efdbe568e2 A few more missing frees.
Naturally I didn't quite manage to catch _everything_ Coverity
reported to me in my first pass through the results.
2017-02-15 05:47:16 +00:00
Simon Tatham 991d30412d Fixes for winelib building (used by our Coverity build).
Avoided referring to some functions and header files that aren't there
in the winelib world (_vsnprintf, _stricmp, SecureZeroMemory,
multimon.h), and worked around a really amazingly annoying issue in
which Winelib objects to you using the type 'fd_set' unless you
included winsock2.h before stdlib.h.
2017-02-14 23:25:26 +00:00
Simon Tatham bec33b2311 Properly check the lengths of Unix-socket pathnames.
If something is too long to fit in a sun_addr, we should spot that
well in advance and not try.
2017-02-14 23:25:26 +00:00
Simon Tatham a146ab2e7a Tighten up bounds-checking of agent responses.
I think an agent sending a string length exceeding the buffer bounds
by less than 4 could have made PuTTY read beyond its own buffer end.
Not that I really think a hostile SSH agent is likely to be attacking
PuTTY, but it's as well to fix these things anyway!
2017-02-14 23:25:26 +00:00
Simon Tatham 50965a6411 Fix completely broken dialog-building functions.
The loops that were supposed to count up the number of buttons in the
variadic argument list forgot to increment the counter.

On the other hand, these functions aren't actually _used_ anywhere in
the current code - looks as if commit 616c837cf was the last time they
were seen - but manual dialog stuff like PuTTYgen might yet find a use
for them in future.
2017-02-14 23:25:25 +00:00
Simon Tatham 2247065d0f Put in some explicit null-pointer checks.
I think these were not strictly necessary, since passing a null
pointer to access(2) would have resulted in EINVAL rather than a
segfault. But it's clearer to put them in (and keeps static checkers a
bit happier).
2017-02-14 23:25:25 +00:00
Simon Tatham bda87b39e4 Fix a typoed end-of-string check in testbn.
I was testing the actual pointer against NULL instead of testing the
pointed-to character against NUL.
2017-02-14 23:25:25 +00:00
Simon Tatham 2a2434e0cc wintime: add a precautionary memset to zero.
Coverity observes that sometimes 'struct tm' can have other fields
(e.g. glibc's tm_gmtoff), so it's as well to make sure we initialise
the whole thing to zero.
2017-02-14 23:25:25 +00:00
Simon Tatham b6b52269e1 uxpgnt: fix an uninitialised structure field in find_key().
Thanks, Coverity - I must have been lucky that Unix Pageant in client
mode hasn't so far happened to have this field come out non-NULL, or
else pageant_pubkey_copy would have tried to dupstr a garbage pointer.
2017-02-14 23:25:25 +00:00
Simon Tatham ac5b13398f lz77_compress: change scope of variable 'hash'.
This makes it clearer that it doesn't persist beyond this block, and
would have made it much more obvious that the assignment to it removed
in the previous commit was pointless.
2017-02-14 23:25:22 +00:00
Simon Tatham f2e76e07da Remove assorted dead code.
Assignments that are overwritten shortly afterwards and never used,
and a completely unused variable. Also, the bogus array access in
testbn.c could have actually accessed one beyond the array limit
(though of course it's only in a test harness).
2017-02-14 22:18:01 +00:00
Simon Tatham b03020cab9 Fix freeing of retkey in openssh_new_read.
Now it's always freed in the cleanup epilogue (unless we're returning
it), rather than ad-hoc earlier in the code. That should make it more
reliably freed on error paths.
2017-02-14 22:14:49 +00:00
Simon Tatham 12a080874f Add an assortment of missing frees and closes.
Coverity's resource-leak checker is on the ball as usual.
2017-02-14 22:14:25 +00:00
Jacob Nevins 33f4c8303f Document proxy logging control.
(This was added in 7c65b9c57.)
2017-02-11 23:30:52 +00:00
Jacob Nevins b14c3443d3 Document -proxycmd in help and man pages.
Also, in the main documentation, note the hazard that backslashes in the
command argument must be doubled.
2017-02-11 23:03:46 +00:00
Jacob Nevins 7e9cb921f6 Add -c/-s to Unix 'pageant --help'. 2017-02-11 22:12:33 +00:00
Jacob Nevins def7d9a3f6 Add 'plink -shareexists' to man page. 2017-02-11 22:08:06 +00:00
Jacob Nevins bb97e17473 Fix missing options in man pages.
None of them documented -4, -6, -noagent, or -agent.
Ask document 'plink -nc host:port'.
2017-02-11 22:04:41 +00:00
Jacob Nevins bee656c1b0 Document cmdgen ability to read public-only keys.
(This was added in 3935cc3af.)
2017-02-11 21:12:16 +00:00
Jacob Nevins df441398ab Update man page for puttygen --random-device. 2017-02-11 20:39:27 +00:00
Jacob Nevins 9dc9cca226 Unix 'puttygen --help' was a mess.
Bring it into line with the other PuTTY tools: --help goes to stdout,
has a one-line purpose and brief version information, --version ends
with a newline.

(Also, tweak text bring the help message under 80 columns.)
2017-02-11 20:39:27 +00:00
Jacob Nevins 9a2730806c Log when -restrict-acl is in use.
Partly to reassure the user that they got what they asked for, and
partly so that's a clue for us in the logs when we get bug reports.

This involved repurposing platform_psftp_post_option_setup() (no longer
used since e22120fe) as platform_psftp_pre_conn_setup(), and moving it
to after logging is set up.
2017-02-11 00:44:00 +00:00
Jacob Nevins 415224eab5 Start logging earlier in PSCP and PSFTP.
We were missing log messages about the start of the network connection.
2017-02-11 00:23:36 +00:00
Jacob Nevins 18f98bae21 Remove -cleanup-during-uninstall option.
It was never a documented option, and hasn't been used for anything
since d0399966.
2017-02-10 00:22:18 +00:00
Simon Tatham a3d14d77f5 One more warning fix: spurious 'const' on functions.
These must have been absent-mindedly copied from function declarations
of the form 'const type *fn(args)', where the 'const' is meaningful
and describes the data pointed to by the returned pointer, to
functions of the form 'const type fn(args)' where the 'const' is
completely pointless.
2017-02-05 12:08:13 +00:00
Simon Tatham ca8876f004 Fix a few more clang-generated warnings.
These are benign, I think. clang warns about casting non-pointer-sized
integers to pointers, but the Windows API actually does sometimes
involve values that are either pointers or _small_ integers, so in the
two cases involved I just cast through ULONG_PTR to silence the
warning. And clang insists that the integer whose address I give to
sk_getxdmdata is still uninitialised afterwards, which is just a lie.
2017-02-05 11:53:58 +00:00
Simon Tatham c7f466309c Stop using MS-deprecated names stricmp and strnicmp.
clang-cl generates warnings saying they're deprecated, in favour of
the same names but prefixed with an underscore. The warnings are
coming from the standard MS headers, and I'm already #defining those
names differently on Unix, so I'll honour them.
2017-02-05 11:53:58 +00:00
Simon Tatham 730a9fdfe3 clang-specific pragmas to suppress -Wmissing-braces.
When I added some extra braces in commit 095072fa4 to suppress this
warning, I think in fact I did the wrong thing, because the
declaration syntax I was originally using is the Microsoft-recommended
one in spite of clang not liking it - I think MS would be within their
rights (should they feel like it) to add those missing braces in a
later version of the WinSock headers, which would make the current
warning-clean code stop compiling. So it's better to put the code back
as it was, and avoid the clang warning by using clang's
warning-suppression pragmas for just those declarations.

I've also done the same thing in winnet.c, for two initialisers of
IPv6 well-known addresses which had the same problem (but which I
didn't notice yesterday because a misjudged set of Windows version
macros had prevented me from compiling that file successfully at all).
2017-02-05 11:53:58 +00:00
Simon Tatham 2e229cb179 New makefile, for Windows cross-builds with clang-cl.
This was very strange to write, because it's a bizarre combination of
the GNU-make-isms and rc commands of Makefile.mgw with the cl and link
commands of Makefile.vc (but also the latter thankfully doesn't need
those horrible response files).

I've added a big comment in mkfiles.pl about what the build
requirements for this makefile actually are, which _hopefully_ will be
usable by people other than me.
2017-02-05 11:53:58 +00:00