X-Git-Url: https://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=onak.c;h=a27ff983e78908d6de2e57013173d7b97d7118cf;hp=717402ee41137e0e90aa6862d87c8a4396d3f552;hb=a2979c20e1ab2d52e3a961ac7dad45fee9d6345a;hpb=00e37c36f214bf9d2e9794d3089e64522a6275a2 diff --git a/onak.c b/onak.c index 717402e..a27ff98 100644 --- a/onak.c +++ b/onak.c @@ -56,7 +56,10 @@ void find_keys(struct onak_dbctx *dbctx, if (ishex) { count = dbctx->fetch_key_id(dbctx, keyid, &publickey, false); - } else if (isfp) { + } else if (isfp && exact) { + count = dbctx->fetch_key(dbctx, fingerprint, + &publickey, false); + } else if (isfp && !exact) { count = dbctx->fetch_key_fp(dbctx, fingerprint, &publickey, false); } else { @@ -165,6 +168,7 @@ int main(int argc, char *argv[]) char *end = NULL; uint64_t keyid = 0; int i; + bool exact = false; bool ishex = false; bool isfp = false; bool update = false; @@ -177,7 +181,7 @@ int main(int argc, char *argv[]) struct onak_dbctx *dbctx; struct openpgp_fingerprint fingerprint; - while ((optchar = getopt(argc, argv, "bc:fsuv")) != -1 ) { + while ((optchar = getopt(argc, argv, "bc:efsuv")) != -1 ) { switch (optchar) { case 'b': binary = true; @@ -185,6 +189,9 @@ int main(int argc, char *argv[]) case 'c': configfile = strdup(optarg); break; + case 'e': + exact = true; + break; case 'f': dispfp = true; break; @@ -366,11 +373,11 @@ int main(int argc, char *argv[]) if (!strcmp("index", argv[optind])) { find_keys(dbctx, search, keyid, &fingerprint, ishex, isfp, dispfp, skshash, - false, false); + exact, false); } else if (!strcmp("vindex", argv[optind])) { find_keys(dbctx, search, keyid, &fingerprint, ishex, isfp, dispfp, skshash, - false, true); + exact, true); } else if (!strcmp("getphoto", argv[optind])) { if (!ishex) { puts("Can't get a key on uid text."