Author: noodles
Date: 2004/03/23 12:33:46
Add initial hooks for opening database in read-only mode (eg lookup/gpgwww).
13 files changed:
*
* Copyright 2002 Project Purple
*
*
* 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 $
&packets);
if (packets != NULL) {
parse_keys(packets, &keys);
&packets);
if (packets != NULL) {
parse_keys(packets, &keys);
printf("Got %d new keys.\n",
update_keys(&keys));
if (keys != NULL) {
printf("Got %d new keys.\n",
update_keys(&keys));
if (keys != NULL) {
*
* Copyright 2001-2002 Project Purple.
*
*
* 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 $
readconfig(NULL);
initlogthing("gpgwww", config.logfile);
readconfig(NULL);
initlogthing("gpgwww", config.logfile);
inithash();
dofindpath(from, to, true, 3);
destroyhash();
inithash();
dofindpath(from, to, true, 3);
destroyhash();
*
* Copyright 2002 Project Purple
*
*
* 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 $
/**
* initdb - Initialize the key database.
/**
* 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.
*/
*
* 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(bool readonly);
/**
* cleanupdb - De-initialize the key database.
/**
* cleanupdb - De-initialize the key database.
*
* Copyright 2002 Project Purple
*
*
* 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>
*/
#include <sys/types.h>
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
+void initdb(bool readonly)
{
DB_INFO keydbinfo;
int i;
{
DB_INFO keydbinfo;
int i;
*
* Copyright 2002 Project Purple
*
*
* 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 $
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
+void initdb(bool readonly)
{
char buf[1024];
FILE *numdb = NULL;
{
char buf[1024];
FILE *numdb = NULL;
*
* Copyright 2002 Project Purple
*
*
* 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>
*/
#include <sys/types.h>
*
* This is just a no-op for flat file access.
*/
*
* This is just a no-op for flat file access.
*/
+void initdb(bool readonly)
*
* Copyright 2002 Project Purple
*
*
* 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>
*/
#include <postgresql/libpq-fe.h>
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
+void initdb(bool readonly)
{
dbconn = PQsetdbLogin(config.pg_dbhost, // host
NULL, // port
{
dbconn = PQsetdbLogin(config.pg_dbhost, // host
NULL, // port
*
* Copyright 2003 Project Purple
*
*
* 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 $
* logs - if we're asked to log something below this level we won't output
* it.
*/
* 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.
/*
* logappname - the name of the application using us.
*
* Copyright 2002 Project Purple
*
*
* 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 $
} else {
readconfig(NULL);
initlogthing("lookup", config.logfile);
} else {
readconfig(NULL);
initlogthing("lookup", config.logfile);
switch (op) {
case OP_GET:
if (fetch_key(keyid, &publickey, false)) {
switch (op) {
case OP_GET:
if (fetch_key(keyid, &publickey, false)) {
key_index(keys, true, false, false);
key_index(keys, true, false, false);
fetch_key(get_keyid(keys), &newkeys);
cleanupdb();
fetch_key(get_keyid(keys), &newkeys);
cleanupdb();
*
* Copyright 2001-2002 Project Purple.
*
*
* 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 $
int main(int argc, char *argv[])
{
readconfig(NULL);
int main(int argc, char *argv[])
{
readconfig(NULL);
inithash();
findmaxpath(30);
printf("--------\n");
inithash();
findmaxpath(30);
printf("--------\n");
*
* Copyright 2002 Project Purple
*
*
* 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 $
if ((argc - optind) < 1) {
usage();
} else if (!strcmp("dump", argv[optind])) {
if ((argc - optind) < 1) {
usage();
} else if (!strcmp("dump", argv[optind])) {
dumpdb("keydump");
cleanupdb();
} else if (!strcmp("add", argv[optind])) {
dumpdb("keydump");
cleanupdb();
} else if (!strcmp("add", argv[optind])) {
logthing(LOGTHING_INFO, "Finished reading %d keys.",
result);
logthing(LOGTHING_INFO, "Finished reading %d keys.",
result);
logthing(LOGTHING_NOTICE, "Got %d new keys.",
update_keys(&keys));
if (keys != NULL && update) {
logthing(LOGTHING_NOTICE, "Got %d new keys.",
update_keys(&keys));
if (keys != NULL && update) {
if (!strcmp("index", argv[optind])) {
find_keys(search, keyid, ishex, fingerprint,
false, false);
if (!strcmp("index", argv[optind])) {
find_keys(search, keyid, ishex, fingerprint,
false, false);
*
* Copyright 2001-2002 Project Purple.
*
*
* 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 $
inithash();
sixdegrees(getfullkeyid(keyid));
destroyhash();
inithash();
sixdegrees(getfullkeyid(keyid));
destroyhash();