+ return op;
+}
+
+int getkeyspath(uint64_t have, uint64_t want, int count)
+{
+ struct openpgp_publickey *publickey = NULL;
+ struct openpgp_packet_list *packets = NULL;
+ struct openpgp_packet_list *list_end = NULL;
+ struct stats_key *keyinfoa, *keyinfob, *curkey;
+ uint64_t fullhave, fullwant;
+ int rec;
+ int pathlen = 0;
+
+ fullhave = getfullkeyid(have);
+ fullwant = getfullkeyid(want);
+
+ /*
+ * Make sure the keys we have and want are in the cache.
+ */
+ cached_getkeysigs(fullhave);
+ cached_getkeysigs(fullwant);
+
+ if ((keyinfoa = findinhash(fullhave)) == NULL) {
+ return 1;
+ }
+ if ((keyinfob = findinhash(fullwant)) == NULL) {
+ return 1;
+ }
+
+ while (pathlen < count) {
+ /*
+ * Fill the tree info up.
+ */
+ initcolour(true);
+ rec = findpath(keyinfoa, keyinfob);
+ keyinfob->parent = 0;
+ if (keyinfoa->colour == 0) {
+ pathlen = count;
+ } else {
+ /*
+ * Skip the first key, as the remote user will already
+ * have it
+ */
+ curkey = findinhash(keyinfoa->parent);
+ while (curkey != NULL && curkey->keyid != 0) {
+ if (curkey->keyid != fullwant && fetch_key(
+ curkey->keyid,
+ &publickey, false)) {
+ flatten_publickey(publickey,
+ &packets,
+ &list_end);
+ free_publickey(publickey);
+ publickey = NULL;
+ }
+ if (curkey != keyinfoa && curkey != keyinfob) {
+ curkey->disabled = true;
+ }
+ curkey = findinhash(curkey->parent);
+ }
+ }
+ pathlen++;
+ }
+
+ /*
+ * Add the destination key to the list of returned keys.
+ */
+ if (fetch_key(fullwant, &publickey, false)) {
+ flatten_publickey(publickey,
+ &packets,
+ &list_end);
+ free_publickey(publickey);
+ publickey = NULL;
+ }
+
+ armor_openpgp_stream(stdout_putchar, NULL, packets);
+ free_packet_list(packets);
+ packets = list_end = NULL;
+
+ return 0;