- /*
- * If we already have the key stored in the DB then merge it
- * with the new one that's been supplied. Otherwise the key
- * we've just got is the one that goes in the DB and also the
- * one that we send out.
- */
- if (oldkey != NULL) {
- fprintf(stderr, "merge_keys: %d\n",
- merge_keys(oldkey, curkey));
- if (curkey->revocations == NULL &&
- curkey->uids == NULL &&
- curkey->subkeys == NULL) {
- fprintf(stderr, "No new info.\n");
- if (prev == NULL) {
- keys = curkey->next;
- } else {
- prev->next = curkey->next;
- prev = curkey->next;
- }
- } else {
- prev = curkey;
- }
- /* TODO: store_key(oldkey); */
- free_publickey(oldkey);
- oldkey = NULL;
- } else {
- store_key(curkey);
- newkeys++;
- }
+ initdb();
+ fprintf(stderr, "Got %d new keys.\n",
+ update_keys(&keys));
+ cleanupdb();
+ } else {
+ rc = 1;
+ fprintf(stderr, "No keys read.\n");