X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Flookups%2Fcdb.c;h=ba925dc12cb7cda6ca2bba60ac0609a3d4d1ed3c;hb=de78e2d59e3924238648b8fb363a1412fa9e499d;hp=1daa2bbd4888d2f28c4395848973c5f6fbc7ffb5;hpb=0756eb3cb50d73a77b486e47528f7cb1bffdb299;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/lookups/cdb.c b/src/src/lookups/cdb.c index 1daa2bbd4..ba925dc12 100644 --- a/src/src/lookups/cdb.c +++ b/src/src/lookups/cdb.c @@ -1,5 +1,3 @@ -/* $Cambridge: exim/src/src/lookups/cdb.c,v 1.1 2004/10/07 13:10:01 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ @@ -20,6 +18,9 @@ * Changed over to using unsigned chars * Makes use of lf_check_file() for file checking * -------------------------------------------------------------- + * Modified by The Exim Maintainers 2015: + * const propagation + * -------------------------------------------------------------- * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -56,7 +57,6 @@ #include "../exim.h" #include "lf_functions.h" -#include "cdb.h" #ifdef HAVE_MMAP # include @@ -144,7 +144,9 @@ cdb_unpack(uschar *buf) return num; } -void * +static void cdb_close(void *handle); + +static void * cdb_open(uschar *filename, uschar **errmsg) { @@ -167,7 +169,7 @@ cdb_open(uschar *filename, if (statbuf.st_size < CDB_HASH_TABLE) { int save_errno = errno; *errmsg = string_open_failed(errno, - "%s to short for cdb lookup", + "%s too short for cdb lookup", filename); errno = save_errno; return NULL; @@ -245,7 +247,7 @@ cdb_open(uschar *filename, * Check entry point * *************************************************/ -BOOL +static BOOL cdb_check(void *handle, uschar *filename, int modemask, @@ -270,14 +272,14 @@ cdb_check(void *handle, * Find entry point * *************************************************/ -int +static int cdb_find(void *handle, uschar *filename, - uschar *keystring, + const uschar *keystring, int key_len, uschar **result, uschar **errmsg, - BOOL *do_cache) + uint *do_cache) { struct cdb_state * cdbp = handle; uint32 item_key_len, @@ -418,7 +420,7 @@ cdb_find(void *handle, /* See local README for interface description */ -void +static void cdb_close(void *handle) { struct cdb_state * cdbp = handle; @@ -431,7 +433,45 @@ struct cdb_state * cdbp = handle; } #endif /* HAVE_MMAP */ - close(cdbp->fileno); + (void)close(cdbp->fileno); } + + +/************************************************* +* Version reporting entry point * +*************************************************/ + +/* See local README for interface description. */ + +#include "../version.h" + +void +cdb_version_report(FILE *f) +{ +#ifdef DYNLOOKUP +fprintf(f, "Library version: CDB: Exim version %s\n", EXIM_VERSION_STR); +#endif +} + + +lookup_info cdb_lookup_info = { + US"cdb", /* lookup name */ + lookup_absfile, /* uses absolute file name */ + cdb_open, /* open function */ + cdb_check, /* check function */ + cdb_find, /* find function */ + cdb_close, /* close function */ + NULL, /* no tidy function */ + NULL, /* no quoting function */ + cdb_version_report /* version reporting */ +}; + +#ifdef DYNLOOKUP +#define cdb_lookup_module_info _lookup_module_info +#endif + +static lookup_info *_lookup_list[] = { &cdb_lookup_info }; +lookup_module_info cdb_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 }; + /* End of lookups/cdb.c */