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

3555 Commits

Author SHA1 Message Date
Jacob Nevins
5eb70af8b1 Remove an unused variable (should shut up a warning from GCC 4.6).
[originally from svn r9111]
2011-03-01 23:04:37 +00:00
Jacob Nevins
1c28be2056 Use pid_t more consistently. Should shut up a warning from GCC 4.6, and may
conceivably help on platforms where int and pid_t aren't sufficiently similar.

[originally from svn r9110]
2011-03-01 23:00:32 +00:00
Simon Tatham
7957ca1153 Rejig the bottom-level loops in internal_mul_* to use pointers instead
of array indices. You'd hope that compilers could automatically turn
the one representation into the other if it was faster to do so, but
apparently not: even on gcc -O3, this source transformation gains over
15% performance.

[originally from svn r9105]
2011-02-22 19:09:27 +00:00
Simon Tatham
9d4005e5c1 Make bignum.py self-contained, by importing versions of the two
functions I was depending on from my personal Python maths utility
module.

[originally from svn r9104]
2011-02-22 00:06:12 +00:00
Simon Tatham
77180221bd Move the malloc and free of scratch space out of the internal_mul
routines into their callers, where they'll be done once for a whole
modpow rather than many times within each multiply. Doesn't save much
time as far as I can see - perhaps a couple of percent, one second in
the minute it takes to run the new bignum test suite - but seems like
a sensible idea anyway on general principles.

[originally from svn r9103]
2011-02-21 19:47:28 +00:00
Simon Tatham
7a0bd8247c A few more modpow tests, exercising the fallback option. This is
mostly so I can valgrind both and make sure they free all their
workspace - a memory leak in this code would be not merely an
inconvenience but a security hazard.

[originally from svn r9101]
2011-02-20 15:42:44 +00:00
Simon Tatham
15d7f8bb3e Add tests of modpow.
[originally from svn r9100]
2011-02-20 15:27:48 +00:00
Simon Tatham
1b47322c3b Nearly forgot. Reinstate the original unoptimised modpow, as a
fallback for when Montgomery is inapplicable.

(I may also at some point switch to using it for small exponents, if
speed testing should reveal that there's a noticeable threshold beyond
which preparing the Montgomery setup is uneconomical.)

[originally from svn r9099]
2011-02-20 15:14:02 +00:00
Simon Tatham
260cee498e Fix bug in Karatsuba multiplication, which affected propagation of a
carry by more than one word. Now the current set of test cases all
pass again.

[originally from svn r9098]
2011-02-20 15:06:39 +00:00
Simon Tatham
01d365b626 Beginnings of a test suite for the bignum code. The output of
testdata/bignum.py is twice the size of the rest of the PuTTY source
put together, so I'm not checking it in.

This reveals bugs in the new multiplication code, which I have yet to
fix.

[originally from svn r9097]
2011-02-20 14:59:00 +00:00
Simon Tatham
b22bdb2b0d Prompt for a remote username in rlogin connections, if one wasn't
specified in the configuration. Jacob's userpass abstraction proves
its worth in making this a trivial job.

(Actually reported by a user - somebody's still using rlogin!)

[originally from svn r9096]
2011-02-18 19:12:20 +00:00
Simon Tatham
fa85085640 Implement the Chinese Remainder Theorem optimisation for speeding up
RSA private key operations by making use of the fact that we know the
factors of the modulus.

[originally from svn r9095]
2011-02-18 08:25:39 +00:00
Simon Tatham
61875b87e3 Implement the Montgomery technique for speeding up modular
exponentiation by replacing the modulo operation by a cleverly chosen
multiplication. This was not worth doing in the previous state of the
code (because my multiply was about as slow as my modulo), but now
that multiplication has been sped up by the Karatsuba optimisation,
Montgomery becomes worthwhile.

[originally from svn r9094]
2011-02-18 08:25:38 +00:00
Simon Tatham
d9c3353176 Implement the Karatsuba technique for recursive divide-and-conquer
optimisation of large multiplies.

[originally from svn r9093]
2011-02-18 08:25:37 +00:00
Simon Tatham
8b4c50be45 Add some appropriate bignum typedefs for generic 64-bit systems,
setting BignumInt to 32 bits. gcc defines _LP64 on x86-64 and
presumably on other 64-bit architectures, so I've conditioned my
defines on that in the hope that they won't need redoing for the next
few such architectures.

I've also added a set for _LLP64, but it's untested as yet.

[originally from svn r9092]
2011-02-18 08:25:36 +00:00
Simon Tatham
7c61c07eb8 Allow setting the WM_CLASS X window property as a configuration option
in saved sessions, so that a programmable window manager can
distinguish different PuTTYs/pterms on startup and assign them
different window management properties.

[originally from svn r9078]
2011-01-15 11:39:44 +00:00
Jacob Nevins
b570f28224 Tweak to r7635: when changing between protocols in the configuration dialog
and avoiding trashing a non-default port, don't treat a port of 0 as special;
this was causing defaults to "freeze in" for sequences of clicks like SSH,
Raw, Telnet.
Arrange that a port of 0 (which in a backend indicates no default) is displayed
as a blank in the port box, to make this less jarring.

[originally from svn r9077]
[r7635 == db7cc1cba6]
2011-01-14 19:57:00 +00:00
Jacob Nevins
c5228adce3 It's a new year.
[originally from svn r9072]
[this svn revision also touched putty-website]
2011-01-05 12:01:00 +00:00
Jacob Nevins
28ef3c91c4 Remove references to the now-dead Mac OS 9 port.
[originally from svn r9071]
2011-01-05 11:58:52 +00:00
Jacob Nevins
99db81f2e7 When iterating over all channels for a dead SSH connection, don't miss out
those in the CHAN_SOCKDATA_DORMANT state (i.e., local-to-remote forwardings
which the SSH server had not yet acknowledged).
Marcel Kilgus has been running with the ssh_do_close() patch for nearly two
years (*cough*) and reports that it has eliminated frequent
'unclean-close-crash' symptoms for him (due to the unclosed socket generating
a pfd_closing() which accessed freed memory), although I've not reproduced
that. The patch to ssh_free() is mine and not known to fix any symptoms.

[originally from svn r9069]
[this svn revision also touched putty-wishlist]
2011-01-03 16:50:41 +00:00
Simon Tatham
a45f984c75 Stop general_textout() from trying to slice up the input clipping
rectangle into smaller ones: it doesn't work any more, since the new
variable-pitch code can now call general_textout() with a larger
clipping rectangle than the text it's meant to be displaying. Instead,
general_textout() now uses the same semantics as the next loop up in
do_text_internal(): the first piece of text it displays uses the
opacity setting passed in, which blanks the entire clipping rectangle
if necessary, and then subsequent overlays are non-opaque. And the
same clipping rectangle is used throughout.

[originally from svn r9067]
2010-12-30 00:06:43 +00:00
Simon Tatham
a418e0d2dc Rationalise the mechanism in do_text_internal for providing the 'lpDx'
array to ExtTextOut:
 - move it inside the new big loop (this should fix a potential bug
   whereby the DBCS handling altered some elements of it but the loop
   did not actually step along it)
 - initialise it more sensibly
 - rename it to lpDx rather than IpDx, since as far as I can tell the
   latter name was derived from a misreading of the former in the
   Windows API docs.

[originally from svn r9066]
2010-12-29 23:48:54 +00:00
Jacob Nevins
46355d29ae Move some not-compiled-in debug code somewhere more useful.
[originally from svn r9065]
2010-12-29 22:38:36 +00:00
Simon Tatham
3a691b5e0d Fix segfault in general_textout with variable-pitch fonts: we can't
pass null lpDx, because general_textout depends on it being filled in.
Instead we null it out in the calls to subroutines _from_
general_textout.

[originally from svn r9064]
2010-12-29 16:00:58 +00:00
Simon Tatham
00b32eda3c Support for using variable-pitch fonts for the terminal on Windows.
Done in much the same way as it is in the GTK front end: the character
cell width is determined using the font's digits (which seems to give
generally not-too-offensive spacing in most cases, at the expense of
Ms and Ws typically overhanging a bit into adjacent cells) and each
character is centred in its cell. Overhangs never leave permanent
droppings on the window, because the existing work done in r5003
handles them just fine even in this stressful scenario.

There's a hacky new checkbox in the Appearance panel to make
variable-pitch fonts appear in the font selector (they still don't by
default, because I still think it's _usually_ not What You Want); the
checkbox state is not actually stored as part of a saved session, but
it should be automatically ticked when reloading a session that's got
a variable pitch font selected.

(I'm half-expecting a potential flurry of requests for this feature in
the wake of http://xkcd.com/840/ , so I thought I'd pre-empt them :-)

[originally from svn r9063]
[r5003 == ba470dec5e]
2010-12-29 14:11:25 +00:00
Simon Tatham
7dab9e5573 Vyacheslav Andrejev points out a heap management goof in the new jump
list code. Free the old value of the pointer variable we just
overwrote, not the new one!

[originally from svn r9062]
2010-12-29 13:35:44 +00:00
Simon Tatham
6538793a72 Thou shalt not suffer a misplaced apostrophe to live.
[originally from svn r9061]
2010-12-29 11:57:04 +00:00
Simon Tatham
0adb957784 Fix resize handling when enabling and disabling full-screen mode.
I'm not sure whether I broke this in the recent revamp or whether it
was always broken, but: transitions in and out of full-screen mode
work by first maximising or restoring the window, which triggers a
WM_SIZE, whose handler then fiddles with the window style to disable
or re-enable all the furniture, which in turn triggers a recursive
WM_SIZE. The trouble is, after returning from the handler for the
inner WM_SIZE, the rest of the outer handler runs, and its client area
size is now out of date.

So I've added a flag which is set when a resize is handled 'properly',
so that after returning from the inner WM_SIZE handler the outer one
knows not to try to redo badly work that's already been done well.

[originally from svn r9056]
2010-12-27 12:58:39 +00:00
Jacob Nevins
af1060856e Add an option to disable SSH-2 banners.
[originally from svn r9055]
2010-12-27 01:19:13 +00:00
Jacob Nevins
526aff23b6 Fix up svn:eol-style and svn:keywords on new files.
[originally from svn r9054]
2010-12-27 00:24:48 +00:00
Jacob Nevins
69090b86da Remove a couple of unused variables.
[originally from svn r9053]
2010-12-26 23:23:11 +00:00
Jacob Nevins
ed80dcc3cf Try to delete jump lists in "-cleanup".
[originally from svn r9050]
2010-12-26 20:00:45 +00:00
Jacob Nevins
301d30c68e Optionally define PropVariantInit() locally to restore ability to build with
MinGW after r9046, and munge the COMPTR() macro to remove a couple of warnings
with my MinGW GCC (3.4.5).

[originally from svn r9049]
[r9046 == 1a03fa9292]
2010-12-26 18:29:53 +00:00
Jacob Nevins
b54a8eaef5 Document the behaviour of Alt in the "hybrid" resizing mode alluded to in
r9045.

[originally from svn r9047]
[r9045 == 6cd24c839d]
2010-12-23 22:19:13 +00:00
Simon Tatham
1a03fa9292 Support for Windows 7 jump lists (right-click on a program's taskbar
icon, even if the program isn't running at the time, to be presented
with an application-defined collection of helpful links). The current
jump list is updated every time a saved session is loaded, and shows
the last few launchable saved sessions (i.e. not those like Default
Settings) that were loaded. Also, if Pageant or PuTTYgen or both is in
the same directory as the PuTTY binary, the jump list will present
links to launch those too.

Based on a patch sent last year by Daniel B. Roy, though it's barely
recognisable any more...

[originally from svn r9046]
2010-12-23 17:32:28 +00:00
Simon Tatham
6cd24c839d The special treatment of Alt-resize (to cause resizing to affect the
font instead of the terminal size) should only be active in
RESIZE_EITHER mode - in RESIZE_TERM it is worse than useless.

[originally from svn r9045]
2010-12-23 17:16:19 +00:00
Simon Tatham
674f68f1ef Another fix to yesterday's window-resizing revamp: when restoring from
maximised state, we must be sure to disable the window offset used to
centre the terminal in cases where the window is non-negotiably the
wrong size (e.g. maximised). Hence we must call reset_window after our
terminal resize.

[originally from svn r9044]
2010-12-23 15:44:20 +00:00
Simon Tatham
05f22632eb More careful owner SID selection in the Pageant client code. This
should solve some of the SID-mismatch issues we've occasionally had
reported. Because it's a modification on the client side, it doesn't
affect the security of Pageant itself.

[originally from svn r9043]
2010-12-23 15:22:50 +00:00
Simon Tatham
17f6ca0360 Pay attention to the width and height provided in WM_SIZE even when
restoring a maximised window.

Failure to do this was noticeable in the following scenario (again
using Aero UI enhancements):
 1. resize window using topmost resize handle, and move pointer to top
    of screen which 'maximises' the window vertically
 2. now maximise the window properly using the maximise button in top
    right
 3. now restore. Notepad restores to its position before step 1,
    because Aero remembers that position for the purpose, but PuTTY
    thinks it knows better. Only now it doesn't any more.

[originally from svn r9041]
2010-12-22 16:14:11 +00:00
Simon Tatham
0b6407878a Reorganise handling of WM_SIZE to fix two generality problems.
Firstly, maximise and restore events were expected never to occur
during an interactive resize process (i.e. between WM_ENTERSIZEMOVE
and WM_EXITSIZEMOVE), but in fact Aero now allows this to happen if
you move the pointer to the top of the screen while dragging the
window.

Secondly, plain old WM_SIZE events were expected never to occur
_outside_ interactive resizes, but Aero permits that too (e.g.
Windows-left and Windows-right), and also third-party window
repositioning tools will send these.

[originally from svn r9040]
2010-12-22 15:49:33 +00:00
Simon Tatham
094459a7e6 Protect against a (non-security-related) buffer overrun if PuTTY is
installed somewhere with an exceptionally long pathname.

[originally from svn r9039]
2010-12-21 10:11:32 +00:00
Simon Tatham
d31d1f4bb5 Add an 'XLFLAGS' make variable to Makefile.vc, permitting user-
supplied extra link flags. This makes it reasonably convenient to
compile for Visual Studio debugging: just build using

  nmake /f Makefile.vc XFLAGS="/Zi /Od" XLFLAGS="/debug"

then load the resulting executable into Visual Studio (using 'Open
Project' rather than 'Open File') and the debugger should be able to
access the source.

[originally from svn r9038]
2010-12-20 13:04:34 +00:00
Jacob Nevins
3e8287839a Add more possible baud rates to the Unix serial backend. These are the
union of rates found in the termios.h of Linux 2.6.24 and "SunOS 5.6
Generic_105181-29 sun4u sparc SUNW,Ultra-4" machines. After a patch by
Thomas Bechtold.

[originally from svn r9028]
2010-12-08 14:21:35 +00:00
Simon Tatham
d0d647b965 More sensible (and also more idiomatic) bounds checking on esc_args.
[originally from svn r9027]
2010-12-07 00:21:42 +00:00
Simon Tatham
0fc1f78677 David Laight reports that sometimes reads on a serial port will
attempt to block, and hence return EAGAIN/EWOULDBLOCK, in spite of
the port having been reported readable by select(2). Don't treat
those errors as fatal.

[originally from svn r9020]
2010-11-06 17:22:38 +00:00
Jacob Nevins
942ac83108 Bah, r9008 caused an assertion failure on Windows due to a clash with the
shortcuts for the preference list buttons. That'll teach me to only test the
Gtk version.

[originally from svn r9010]
[r9008 == 5981b5e99d]
2010-09-27 11:33:40 +00:00
Jacob Nevins
196ca8b041 Add index terms for GSSAPI stuff. Mention GSSAPI in "use system username"
section and other tweaks.

[originally from svn r9009]
2010-09-25 16:18:02 +00:00
Jacob Nevins
5981b5e99d Since GSSAPI is now on its own panel, we may as well have a full set of
keyboard shortcuts.

[originally from svn r9008]
2010-09-25 15:51:14 +00:00
Simon Tatham
ffe40202a4 Oops: r9004 should have removed various pieces from the Makefile and
header file setup too.

[originally from svn r9005]
[r9004 == 7ac1f17aab]
2010-09-25 08:37:30 +00:00
Simon Tatham
7ac1f17aab Retire the old Mac Classic port directory! It's been unused for
ages, is increasingly irrelevant now that 'Mac' pretty much
universally means something running OS X, is probably bit-rotted
past usefulness already, and certainly will be after the next time
some major reengineering takes place.

[originally from svn r9004]
2010-09-25 07:30:08 +00:00