*
* Copyright 2002 Project Purple
*
- * $Id: add.c,v 1.11 2003/10/15 21:15:20 noodles Exp $
+ * $Id: add.c,v 1.12 2004/03/23 12:33:46 noodles Exp $
*/
#include <errno.h>
&packets);
if (packets != NULL) {
parse_keys(packets, &keys);
- initdb();
+ initdb(false);
printf("Got %d new keys.\n",
update_keys(&keys));
if (keys != NULL) {
*
* Copyright 2001-2002 Project Purple.
*
- * $Id: gpgwww.c,v 1.12 2003/10/15 21:15:20 noodles Exp $
+ * $Id: gpgwww.c,v 1.13 2004/03/23 12:33:46 noodles Exp $
*/
#include <inttypes.h>
readconfig(NULL);
initlogthing("gpgwww", config.logfile);
- initdb();
+ initdb(true);
inithash();
dofindpath(from, to, true, 3);
destroyhash();
*
* Copyright 2002 Project Purple
*
- * $Id: keydb.h,v 1.9 2003/06/08 21:11:00 noodles Exp $
+ * $Id: keydb.h,v 1.10 2004/03/23 12:33:46 noodles Exp $
*/
#ifndef __KEYDB_H__
/**
* initdb - Initialize the key database.
+ * @readonly: If we'll only be reading the DB, not writing to it.
*
* This function should be called before any of the other functions in
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
-void initdb(void);
+void initdb(bool readonly);
/**
* cleanupdb - De-initialize the key database.
*
* Copyright 2002 Project Purple
*
- * $Id: keydb_db2.c,v 1.10 2003/09/30 20:40:10 noodles Exp $
+ * $Id: keydb_db2.c,v 1.11 2004/03/23 12:33:46 noodles Exp $
*/
#include <sys/types.h>
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
-void initdb(void)
+void initdb(bool readonly)
{
DB_INFO keydbinfo;
int i;
*
* Copyright 2002 Project Purple
*
- * $Id: keydb_db3.c,v 1.22 2003/10/10 16:57:27 noodles Exp $
+ * $Id: keydb_db3.c,v 1.23 2004/03/23 12:33:46 noodles Exp $
*/
#include <assert.h>
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
-void initdb(void)
+void initdb(bool readonly)
{
char buf[1024];
FILE *numdb = NULL;
*
* Copyright 2002 Project Purple
*
- * $Id: keydb_file.c,v 1.10 2003/09/30 20:40:10 noodles Exp $
+ * $Id: keydb_file.c,v 1.11 2004/03/23 12:33:46 noodles Exp $
*/
#include <sys/types.h>
*
* This is just a no-op for flat file access.
*/
-void initdb(void)
+void initdb(bool readonly)
{
}
*
* Copyright 2002 Project Purple
*
- * $Id: keydb_pg.c,v 1.13 2003/09/30 20:40:11 noodles Exp $
+ * $Id: keydb_pg.c,v 1.14 2004/03/23 12:33:47 noodles Exp $
*/
#include <postgresql/libpq-fe.h>
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
-void initdb(void)
+void initdb(bool readonly)
{
dbconn = PQsetdbLogin(config.pg_dbhost, // host
NULL, // port
*
* Copyright 2003 Project Purple
*
- * $Id: log.c,v 1.4 2003/06/04 20:57:10 noodles Exp $
+ * $Id: log.c,v 1.5 2004/03/23 12:33:47 noodles Exp $
*/
#include <stdarg.h>
* logs - if we're asked to log something below this level we won't output
* it.
*/
-static loglevels logthres = LOGTHING_DEBUG;
+static loglevels logthres = LOGTHING_NOTICE;
/*
* logappname - the name of the application using us.
*
* Copyright 2002 Project Purple
*
- * $Id: lookup.c,v 1.12 2003/10/15 21:15:21 noodles Exp $
+ * $Id: lookup.c,v 1.13 2004/03/23 12:33:47 noodles Exp $
*/
#include <inttypes.h>
} else {
readconfig(NULL);
initlogthing("lookup", config.logfile);
- initdb();
+ initdb(true);
switch (op) {
case OP_GET:
if (fetch_key(keyid, &publickey, false)) {
key_index(keys, true, false, false);
- initdb();
+ initdb(true);
fetch_key(get_keyid(keys), &newkeys);
cleanupdb();
*
* Copyright 2001-2002 Project Purple.
*
- * $Id: maxpath.c,v 1.10 2003/10/15 21:15:21 noodles Exp $
+ * $Id: maxpath.c,v 1.11 2004/03/23 12:33:47 noodles Exp $
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
readconfig(NULL);
- initdb();
+ initdb(true);
inithash();
findmaxpath(30);
printf("--------\n");
*
* Copyright 2002 Project Purple
*
- * $Id: onak.c,v 1.18 2003/10/15 21:15:21 noodles Exp $
+ * $Id: onak.c,v 1.19 2004/03/23 12:33:47 noodles Exp $
*/
#include <stdio.h>
if ((argc - optind) < 1) {
usage();
} else if (!strcmp("dump", argv[optind])) {
- initdb();
+ initdb(true);
dumpdb("keydump");
cleanupdb();
} else if (!strcmp("add", argv[optind])) {
logthing(LOGTHING_INFO, "Finished reading %d keys.",
result);
- initdb();
+ initdb(false);
logthing(LOGTHING_NOTICE, "Got %d new keys.",
update_keys(&keys));
if (keys != NULL && update) {
ishex = true;
}
}
- initdb();
+ initdb(false);
if (!strcmp("index", argv[optind])) {
find_keys(search, keyid, ishex, fingerprint,
false, false);
*
* Copyright 2001-2002 Project Purple.
*
- * $Id: sixdegrees.c,v 1.5 2003/10/15 21:15:21 noodles Exp $
+ * $Id: sixdegrees.c,v 1.6 2004/03/23 12:33:47 noodles Exp $
*/
#include <stdio.h>
}
readconfig(NULL);
- initdb();
+ initdb(true);
inithash();
sixdegrees(getfullkeyid(keyid));
destroyhash();