cscvs to tla changeset 63
authorJonathan McDowell <noodles@earth.li>
Mon, 31 May 2004 23:47:31 +0000 (23:47 +0000)
committerJonathan McDowell <noodles@earth.li>
Mon, 31 May 2004 23:47:31 +0000 (23:47 +0000)
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

index 0c597c4b1b1e00584db0c6ebdf7ee50f370ac178..80a466117cfa91f6f657318334b14885d3c01d5e 100644 (file)
@@ -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.
  */