ssh: Improve key lookup for many keys.
authorWerner Koch <wk@gnupg.org>
Mon, 10 Dec 2012 17:27:23 +0000 (18:27 +0100)
committerWerner Koch <wk@gnupg.org>
Mon, 10 Dec 2012 17:27:23 +0000 (18:27 +0100)
commitd2777f84be0ded5906a9bec3bc23cfed0a9be02f
treea0b390a4c6cf1f0ade38cc5d9624daf1960670ab
parent25fb53ab4ae7e1c098500229c776d29b82713a20
ssh: Improve key lookup for many keys.

* agent/command-ssh.c: Remove dirent.h.
(control_file_s): Add struct item.
(rewind_control_file): New.
(search_control_file): Factor code out to ...
(read_control_file_item): New.
(ssh_handler_request_identities): Change to iterate over entries in
sshcontrol.
--

Formerly we scanned the private key directory for matches of entries
in sshcontrol.  This patch changes it to scan the sshcontrol file and
thus considers only keys configured there.  The rationale for this is
that it is common to have only a few ssh keys but many private keys.
Even if that assumption does not hold true, the scanning of the
sshcontrol file is faster than reading the directory and only then
scanning the ssh control for each directory entry.
agent/command-ssh.c