diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2007-01-04 21:41:38 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2007-01-04 21:41:38 +0000 |
commit | 1d88fc608533f55ea47a0978e4b19767327d9868 (patch) | |
tree | 289789c5193e3655f2c7a45e2f96cc42d3d660d7 /libexec/spamlogd | |
parent | 9b6643396e32c30a97ef7a70fce259762fbdcbcd (diff) |
Using DB_BTREE for spamd is wrong, order is never required
and the rebalancing really slags big databases. Make spamd use DB_HASH
instead, and convert if the old type is noticed on startup.
Testing by me, djm, ian, others
ok deraadt@, millert@, djm@
Diffstat (limited to 'libexec/spamlogd')
-rw-r--r-- | libexec/spamlogd/spamlogd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libexec/spamlogd/spamlogd.c b/libexec/spamlogd/spamlogd.c index 21d31c98a87..5e1f316df77 100644 --- a/libexec/spamlogd/spamlogd.c +++ b/libexec/spamlogd/spamlogd.c @@ -1,9 +1,9 @@ -/* $OpenBSD: spamlogd.c,v 1.14 2006/11/03 19:39:33 henning Exp $ */ +/* $OpenBSD: spamlogd.c,v 1.15 2007/01/04 21:41:37 beck Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> * Copyright (c) 2006 Berk D. Demir. - * Copyright (c) 2004 Bob Beck. + * Copyright (c) 2004-2007 Bob Beck. * Copyright (c) 2001 Theo de Raadt. * Copyright (c) 2001 Can Erkin Acar. * All rights reserved @@ -187,7 +187,7 @@ logpkt_handler(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) int dbupdate(char *dbname, char *ip) { - BTREEINFO btreeinfo; + HASHINFO hashinfo; DBT dbk, dbd; DB *db; struct gdata gd; @@ -196,8 +196,8 @@ dbupdate(char *dbname, char *ip) struct in_addr ia; now = time(NULL); - memset(&btreeinfo, 0, sizeof(btreeinfo)); - db = dbopen(dbname, O_EXLOCK|O_RDWR, 0600, DB_BTREE, &btreeinfo); + memset(&hashinfo, 0, sizeof(hashinfo)); + db = dbopen(dbname, O_EXLOCK|O_RDWR, 0600, DB_HASH, &hashinfo); if (db == NULL) { logmsg(LOG_ERR, "Can not open db %s: %s", dbname, strerror(errno)); |