+ if(keystrlen()>8)
+ {
+ log_info(_("Signature made %s\n"),asctimestamp(sig->timestamp));
+ log_info(_(" using %s key %s\n"),
+ astr? astr: "?",keystr(sig->keyid));
+ }
+ else
+ log_info(_("Signature made %s using %s key ID %s\n"),
+ asctimestamp(sig->timestamp), astr? astr: "?",
+ keystr(sig->keyid));
+
+ rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
+
+ /* If the key isn't found, check for a preferred keyserver */
+
+ if(rc==G10ERR_NO_PUBKEY && sig->flags.pref_ks)
+ {
+ const byte *p;
+ int seq=0;
+ size_t n;
+
+ while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_PREF_KS,&n,&seq,NULL)))
+ {
+ /* According to my favorite copy editor, in English
+ grammar, you say "at" if the key is located on a web
+ page, but "from" if it is located on a keyserver. I'm
+ not going to even try to make two strings here :) */
+ log_info(_("Key available at: ") );
+ print_utf8_string( log_stream(), p, n );
+ putc( '\n', log_stream() );
+
+ if(opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE
+ && opt.keyserver_options.options&KEYSERVER_HONOR_KEYSERVER_URL)
+ {
+ struct keyserver_spec *spec;
+
+ spec=parse_preferred_keyserver(sig);
+ if(spec)
+ {
+ int res;
+
+ glo_ctrl.in_auto_key_retrieve++;
+ res=keyserver_import_keyid(sig->keyid,spec);
+ glo_ctrl.in_auto_key_retrieve--;
+ if(!res)
+ rc=do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
+ free_keyserver_spec(spec);
+
+ if(!rc)
+ break;
+ }
+ }
+ }
+ }
+
+
+ /* If the preferred keyserver thing above didn't work, our second
+ try is to use the URI from a DNS PKA record. */
+ if ( rc == G10ERR_NO_PUBKEY
+ && (opt.keyserver_options.options&KEYSERVER_AUTO_PKA_RETRIEVE))
+ {
+ const char *uri = pka_uri_from_sig (sig);
+
+ if (uri)
+ {
+ /* FIXME: We might want to locate the key using the
+ fingerprint instead of the keyid. */
+ int res;
+ struct keyserver_spec *spec;
+
+ spec = parse_keyserver_uri (uri, 0, NULL, 0);
+ if (spec)
+ {
+ glo_ctrl.in_auto_key_retrieve++;
+ res = keyserver_import_keyid (sig->keyid, spec);
+ glo_ctrl.in_auto_key_retrieve--;
+ free_keyserver_spec (spec);
+ if (!res)
+ rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
+ }
+ }
+ }
+
+
+ /* If the preferred keyserver thing above didn't work and we got
+ no information from the DNS PKA, this is a third try. */
+
+ if( rc == G10ERR_NO_PUBKEY && opt.keyserver
+ && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE))
+ {
+ int res;
+
+ glo_ctrl.in_auto_key_retrieve++;
+ res=keyserver_import_keyid ( sig->keyid, opt.keyserver );
+ glo_ctrl.in_auto_key_retrieve--;
+ if(!res)
+ rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
+ }