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

9 Коммитов

Автор SHA1 Сообщение Дата
Simon Tatham c6c23ed84b Unix Pageant: support -D, to delete all keys. 2015-05-12 14:56:39 +01:00
Simon Tatham e533097e15 Unix Pageant: provide public-key extraction options.
I've decided against implementing an option exactly analogous to
'ssh-add -L' (printing the full public key of everything in the
agent). Instead, you can identify a specific key to display in full,
by any of the same means -d lets you use, and then print it in either
of the public key formats we support.
2015-05-12 14:56:39 +01:00
Simon Tatham 4d88fe3dde Unix Pageant: support -d, to delete a key from the agent.
Unlike ssh-add, we can identify the key by its comment or by a prefix
of its fingerprint as well as using a public key file on disk. The
string given as an argument to -d is interpreted as whichever of those
things matches; disambiguating prefixes are available if needed.
2015-05-12 14:56:25 +01:00
Simon Tatham 511d967d25 Unix Pageant: first draft of -l key list option.
It doesn't look very pretty at the moment, but it lists the keys and
gets the fingerprints right.
2015-05-11 18:45:34 +01:00
Simon Tatham 2069de8c8f Pageant: factor out cross-platform parts of add_keyfile().
I've now centralised into pageant.c all the logic about trying to load
keys of any type, with no passphrase or with the passphrases used in
previous key-loading actions or with a new user-supplied passphrase,
whether we're the main Pageant process ourself or are talking to
another one as a client. The only part of that code remaining in
winpgnt.c is the user interaction via dialog boxes, which of course is
the part that will need to be done differently on other platforms.
2015-05-11 15:49:09 +01:00
Simon Tatham 47c9a6ef0b Clean up Unix Pageant's setup and teardown.
I've moved the listening socket setup back to before the lifetime
preparations, so in particular we find out that we couldn't bind to
the socket _before_ we fork. The only part that really needed to come
after lifetime setup was the logging setup, so that's now a separate
function called later.

Also, the random exit(0)s in silly places like x11_closing have turned
into setting a time_to_die flag, so that all clean exits funnel back
to the end of main() which at least tries to tidy up a bit afterwards.

(Finally, fixed a small bug in testing the return value of waitpid(),
which only showed up once we didn't exit(0) after the first wait.
Ahem.)
2015-05-07 19:06:12 +01:00
Simon Tatham bc4066e454 Put proper logging into Pageant.
Now it actually logs all its requests and responses, the fingerprints
of keys mentioned in all messages, and so on.

I've also added the -v option, which causes Pageant in any mode to
direct that logging information to standard error. In --debug mode,
however, the logging output goes to standard output instead (because
when debugging, that information changes from a side effect to the
thing you actually wanted in the first place :-).

An internal tweak: the logging functions now take a va_list rather
than an actual variadic argument list, so that I can pass it through
several functions.
2015-05-06 19:45:04 +01:00
Simon Tatham 7b6078533e Cross-platform support for speaking SSH agent protocol on a Socket.
The exact nature of the Socket is left up to the front end to decide,
so that we can use a Unix-domain socket on Unix and a Windows named
pipe on Windows. But the logic of how we receive data and what we send
in response is all cross-platform.
2015-05-05 20:16:20 +01:00
Simon Tatham 5ba2d611f9 Move half of Pageant out into a cross-platform source file.
I'm aiming for windows/winpgnt.c to only contain the parts of Windows
Pageant that are actually to do with handling the Windows API, and for
all the actual agent logic to be cross-platform.

This commit is a start: I've moved every function and internal
variable that was easy to move. But it doesn't get all the way there -
there's still a lot of logic in add_keyfile() and get_keylist*() that
would be good to move out to cross-platform code, but it's harder
because that code is currently quite intertwined with details of
Windows OS interfacing such as printing message boxes and passphrase
prompts and calling back out to agent_query if the Pageant doing that
job isn't the primary one.
2015-05-05 20:16:19 +01:00