From a068c078307cee7aa58469074a0e4a59b3f48718 Mon Sep 17 00:00:00 2001
From: Jonathan McDowell <noodles@earth.li>
Date: Mon, 31 May 2004 23:47:31 +0000
Subject: [PATCH] cscvs to tla changeset 63 Author: noodles Date: 2003/02/16
 11:02:42 Made db2 backend read the num_keydb file to know how many key
 databases to read (pointed out by Jason Harris).

---
 keydb_db2.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/keydb_db2.c b/keydb_db2.c
index 0c597c4..80a4661 100644
--- a/keydb_db2.c
+++ b/keydb_db2.c
@@ -69,6 +69,20 @@ void initdb(void)
 	int i;
 	int ret;
 	char keydbname[20];
+	char buf[1024];
+	FILE *numdb = NULL;
+
+	snprintf(buf, sizeof(buf) - 1, "%s/num_keydb", config.db_dir);
+	numdb = fopen(buf, "r");
+	if (numdb != NULL) {
+		if (fgets(buf, sizeof(buf), numdb) != NULL) {
+			db2_numdb = atoi(buf);
+		}
+		fclose(numdb);
+	} else {
+		logthing(LOGTHING_ERROR, "Couldn't open num_keydb: %s",
+				strerror(errno));
+	}
 
 	memset(&db2_env, 0, sizeof(db2_env));
 
@@ -235,6 +249,22 @@ int delete_key(uint64_t keyid, bool intrans)
 	return (1);
 }
 
+/**
+ *	dumpdb - dump the key database
+ *	@filenamebase: The base filename to use for the dump.
+ *
+ *	Dumps the database into one or more files, which contain pure OpenPGP
+ *	that can be reimported into onak or gpg. filenamebase provides a base
+ *	file name for the dump; several files may be created, all of which will
+ *	begin with this string and then have a unique number and a .pgp
+ *	extension.
+ *          */
+int dumpdb(char *filenamebase)
+{
+	return 0;
+}
+
+
 /*
  * Include the basic keydb routines.
  */
-- 
2.39.5