X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=lookup.c;h=35c039bf906c8c9d59e8706e052261f9dd481cc9;hb=41b7047c909cb5d8243901080db4931ebf165acf;hp=12eb5a2b00ccf277355177003976464923186cc9;hpb=1a084272fd5c603f318d2c4dc0c70b2de0606f04;p=onak.git diff --git a/lookup.c b/lookup.c index 12eb5a2..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 @@ -147,8 +147,20 @@ 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 (j = 0; j < MAX_FINGERPRINT_LEN; j++) { + /* 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) + @@ -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);