- snprintf(filename, 1023, "%s.%d.pgp", filenamebase, i);
- fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0640);
- if (fd == -1) {
- logthing(LOGTHING_ERROR,
- "Error opening keydump file (%s): %s",
- filename,
- strerror(errno));
- } else {
- memset(&key, 0, sizeof(key));
+ memset(&dbkey, 0, sizeof(dbkey));
+ memset(&data, 0, sizeof(data));
+ ret = cursor->c_get(cursor, &dbkey, &data, DB_NEXT);
+ while (ret == 0) {
+ fetchbuf.buffer = data.data;
+ fetchbuf.offset = 0;
+ fetchbuf.size = data.size;
+ read_openpgp_stream(buffer_fetchchar, &fetchbuf,
+ &packets, 0);
+ parse_keys(packets, &key);
+
+ iterfunc(ctx, key);
+
+ free_publickey(key);
+ key = NULL;
+ free_packet_list(packets);
+ packets = NULL;
+
+ memset(&dbkey, 0, sizeof(dbkey));