X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=lookup.c;h=35c039bf906c8c9d59e8706e052261f9dd481cc9;hb=85187675424f3854869f1607afd8a1e84e536946;hp=9815cbb419922faeec85859b055b57e29720d8d8;hpb=5cb3cfdb9d8caa6d7a4a1979c50c46896957b934;p=onak.git diff --git a/lookup.c b/lookup.c index 9815cbb..35c039b 100644 --- a/lookup.c +++ b/lookup.c @@ -13,8 +13,7 @@ * more details. * * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * this program. If not, see . */ #include @@ -24,6 +23,8 @@ #include #include +#include "build-config.h" + #include "armor.h" #include "charfuncs.h" #include "cleankey.h" @@ -37,7 +38,6 @@ #include "onak-conf.h" #include "parsekey.h" #include "photoid.h" -#include "version.h" #define OP_UNKNOWN 0 #define OP_GET 1 @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) { char **params = NULL; int op = OP_UNKNOWN; - int i; + int i, j; int indx = 0; bool dispfp = false; bool skshash = false; @@ -147,12 +147,24 @@ int main(int argc, char *argv[]) params[i+1] = NULL; if (search != NULL && strlen(search) == 42 && search[0] == '0' && search[1] == 'x') { - fingerprint.length = MAX_FINGERPRINT_LEN; - for (i = 0; i < MAX_FINGERPRINT_LEN; i++) { - fingerprint.fp[i] = (hex2bin( - search[2 + i * 2]) + /* v4 fingerprint */ + fingerprint.length = 20; + for (j = 0; j < 20; j++) { + fingerprint.fp[j] = (hex2bin( + search[2 + j * 2]) + << 4) + + hex2bin(search[3 + j * 2]); + } + isfp = true; + } else if (search != NULL && strlen(search) == 66 && + search[0] == '0' && search[1] == 'x') { + /* v5 fingerprint */ + fingerprint.length = 32; + for (j = 0; j < 32; j++) { + fingerprint.fp[j] = (hex2bin( + search[2 + j * 2]) << 4) + - hex2bin(search[3 + i * 2]); + hex2bin(search[3 + j * 2]); } isfp = true; } else if (search != NULL) { @@ -215,7 +227,7 @@ int main(int argc, char *argv[]) readconfig(NULL); initlogthing("lookup", config.logfile); catchsignals(); - dbctx = config.dbinit(false); + dbctx = config.dbinit(config.backend, false); switch (op) { case OP_GET: case OP_HGET: @@ -240,7 +252,7 @@ int main(int argc, char *argv[]) result, search); puts("
");
-				cleankeys(publickey);
+				cleankeys(&publickey, config.clean_policies);
 				flatten_publickey(publickey,
 							&packets,
 							&list_end);