Handle save/load of set-typed config items.

I'm about to introduce a configuration option which is really a _set_
of string values (rather than an ordered list), and I'm going to
represent it in Conf as a string->string map (since that's a data type
we already support) in which every key which exists at all maps to the
empty string.

This change modifies settings.c so that it can write out such options
into the saved session as a comma-separated list of the key strings
only, rather than the form 'string1=,string2=,string3=' which you'd
get if you just used the existing wmap().

(Reading the result back in turns out not to need a code change - the
existing code already does what we want if it's reading a list of
key=value pairs and one of them doesn't have an = sign at all.)


git-svn-id: svn://svn.tartarus.org/sgt@10217 cda61777-01e9-0310-a592-d414129be87e
Move base64_decode_atom into misc.c.

I'm about to need to refer to it from a source file that won't
necessarily always be linked against sshpubk.c, so it needs to live
somewhere less specialist. Now it sits alongside base64_encode_atom
(already in misc.c for another reason), which is neater anyway.


git-svn-id: svn://svn.tartarus.org/sgt@10218 cda61777-01e9-0310-a592-d414129be87e
Add an option to suppress horizontal scroll bars in list boxes.

I'm about to add a list box which expects to contain some very long
but uninformative strings, and which is also quite vertically squashed
so there's not much room for a horizontal scroll bar to appear in it.
So here's an option in the list box specification structure which
causes the constructed GTKTreeView to use the 'ellipsize' option for
all its cell renderers, i.e. too-long strings are truncated with an
ellipsis.

Windows needs no change, because its list boxes already work this way.


git-svn-id: svn://svn.tartarus.org/sgt@10219 cda61777-01e9-0310-a592-d414129be87e
New option to manually configure the expected host key(s).

This option is available from the command line as '-hostkey', and is
also configurable through the GUI. When enabled, it completely
replaces all of the automated host key management: the server's host
key will be checked against the manually configured list, and the
connection will be allowed or disconnected on that basis, and the host
key store in the registry will not be either consulted or updated.

The main aim is to provide a means of automatically running Plink,
PSCP or PSFTP deep inside Windows services where HKEY_CURRENT_USER
isn't available to have stored the right host key in. But it also
permits you to specify a list of multiple host keys, which means a
second use case for the same mechanism will probably be round-robin
DNS names that select one of several servers with different host keys.

Host keys can be specified as the standard MD5 fingerprint or as an
SSH-2 base64 blob, and are canonicalised on input. (The base64 blob is
more unwieldy, especially with Windows command-line length limits, but
provides a means of specifying the _whole_ public key in case you
don't trust MD5. I haven't bothered to provide an analogous mechanism
for SSH-1, on the basis that anyone worrying about MD5 should have
stopped using SSH-1 already!)


git-svn-id: svn://svn.tartarus.org/sgt@10220 cda61777-01e9-0310-a592-d414129be87e
Change the naming policy for connection-sharing Unix sockets.

I had initially assumed that, since all of a user's per-connection
subdirectories live inside a top-level putty-connshare.$USER directory
that's not accessible to anyone else, there would be no need to
obfuscate the names of the internal directories for privacy, because
nobody would be able to look at them anyway.

Unfortunately, that's not true: 'netstat -ax' run by any user will
show up the full pathnames of Unix-domain sockets, including pathname
components that you wouldn't have had the access to go and look at
directly. So the Unix connection sharing socket names do need to be
obfuscated after all.

Since Unix doesn't have Windows's CryptProtectMemory, we have to do
this manually, by creating a file of random salt data inside the
top-level putty-connshare directory (if there isn't one there already)
and then hashing that salt with the "user@host" connection identifier
to get the socket directory name. What a pain.


git-svn-id: svn://svn.tartarus.org/sgt@10222 cda61777-01e9-0310-a592-d414129be87e
Fix a FIXME and a markup error in the manual host key docs.


git-svn-id: svn://svn.tartarus.org/sgt@10224 cda61777-01e9-0310-a592-d414129be87e
Repair GTK timer handling

The bug eventually makes PuTTY take 100% of a CPU.

1) This patch stops run_timers returning with a next timer interval
of zero ms.

2) The code called from run_timers is likely to create a new timer
when it runs before timer_trigger adds the next timer that run_timers
returns. This would mean that two timers get scheduled with gtk.

3) Alter terminal.c to turn off the text blink timer when we don't
have focus and turn it on, synched with the cursor when we get it back.

NB: Windows calls 'term_set_focus' a lot .. Yes you still have focus
Revert almost duplicate change.

This isn't quite the same, but it should be almost as good.
Pango font performance update

This change improves the speed of the best case pango font
processing.  It removes multiple calls to pango_layout_set_text and
pango_layout_get_pixel_extents that were used to check that every prefix
string of a given draw_text is actually the correct size.

Instead the function now checks just once before painting the text
that the size of the whole region is correct. If it's not correct it
falls back to painting one character at a time immediatly rather than
optimistically trying lots of substrings; this normally improves the
draw time of complex screens and proportional fonts too.

If there are compensating layout issues within the string they won't
cause problems because terminal.c already has code to redraw any row
of text that was drawn as one operation if it's split.
Minimise, maximise, etc are as annoying as other terminal resize operations.

Note they ARE resize operations so treat them as such and disable them
if requested.
Add XTerm extensions for VTTEST and reverse BS

Codes to enable and disable the DECCOLM 132/80 column switching DEC
control and XTerm's reverse BS hack to 'pass' the vttest option 1.

This means that PuTTY uses the same modal hack as XTerm to pass the vttest
'end of line' test, (Actually the reverse part) and Thomas can stop lying
about PuTTY in the xterm FAQ.  The second part prevents the default xterm
'init' sequence from terminfo clearing the screen.

In addition most applications realise that terminal resizes are requests
and that you likely won't get what you ask for.  Programs (like vttest)
that use the sequence DECCOLM aren't so smart so the change is immediatly
enacted.
Adjust DEC-MCS character set.

U+2426 "␦" is defined as the substitution character in DEC-MCS

Note: dec_mcs is a 94 character set so 0xA0 and 0xFF are not defined in
a different way when it's mapped into GR.
Optimisation to delete windows code on unix

Changed is_dbcs_leadbyte to a macro on unix so the compiler knows
it's always zero.
This is a fix for the direct to font DBCS cursor.

If we're sitting on a DBCS lead byte it extends the cursor to two
characters rather then just one.
Windows codepages do not have C1 controls
Fix the scoasc translation on unix

There should be a set of VGA ROM characters in the first 32 positions
of the character set to match with Linux, scoansi and Windows PuTTY.
Function x11font_draw_text uses the UCS2 character set
SCO Ansi Keyboard correction
Correct Window title character set on windows.

The characters are converted to unicode before use.
Changes to the internal usage of unicode areas for character set conversion.

The unix port is using the U+D800 range for the same jobs as the windows
port uses the U+F100 range. Set it to use the same range of characters.

Note: unlike windows this is ONLY used if the font doesn't have a
recognised character set so this change doesn't make the DTF range
compatible with the Linux console.

In a similar issue terminal.c is using the CSET_* codes for two different
tasks; the screen map characters and the line characters. Making the
distinction explicit should clarify things.

We now have a 32bit space for the characters so the hack of placing
the CSET_* code overlapping the surrogates is no longer required. We
can instead place them past the end of the valid unicode characters
(ie U+180000). Note I've chosen 0x180000 rather than 0x200000 to preserve
the compression of the scrollback.

Unfortunatly I can't do the same for the DTF range as it wouldn't work
for the UTF-16 platform. I can, however, move it to the "Low Surrogates"
area where it shouldn't interfere with the normal use of surrogates.

Added Linux DTF range (U+F000 -> CP437) explicitly into the emulation
because we no longer have the "happy coincidence" of the OEMCP being
mapped to U+F000. This means it could now be disabled for pure utf8 mode.