/* need to insert it, so move all the other items up
(last slot is still empty, of course) */
- memmove(&lookup_list[pos+1],
- &lookup_list[pos],
+ memmove(&lookup_list[pos+1], &lookup_list[pos],
sizeof(lookup_info *) * (lookup_list_count-pos-1));
}
lookup_list[pos] = info;
extern void route_show_supported(FILE *);
extern void route_tidyup(void);
-extern uschar *search_find(void *, uschar *, uschar *, int, const uschar *, int,
- int, int *);
+extern uschar *search_find(void *, const uschar *, uschar *, int,
+ const uschar *, int, int, int *);
extern int search_findtype(const uschar *, int);
extern int search_findtype_partial(const uschar *, int *, const uschar **, int *,
int *);
-extern void *search_open(uschar *, int, int, uid_t *, gid_t *);
+extern void *search_open(const uschar *, int, int, uid_t *, gid_t *);
extern void search_tidyup(void);
extern void set_process_info(const char *, ...) PRINTF_FUNCTION(1,2);
extern void sha1_end(hctx *, const uschar *, int, uschar *);
uschar *name; /* e.g. "lsearch" */
int type; /* query/singlekey/abs-file */
void *(*open)( /* open function */
- uschar *, /* file name for those that have one */
+ const uschar *, /* file name for those that have one */
uschar **); /* for error message */
BOOL (*check)( /* file checking function */
void *, /* handle */
- uschar *, /* file name */
+ const uschar *, /* file name */
int, /* modemask for file checking */
uid_t *, /* owners for file checking */
gid_t *, /* owngroups for file checking */
uschar **); /* for error messages */
int (*find)( /* find function */
void *, /* handle */
- uschar *, /* file name or NULL */
+ const uschar *, /* file name or NULL */
const uschar *, /* key or query */
int, /* length of key or query */
uschar **, /* for returning answer */
static uint32
cdb_unpack(uschar *buf)
{
- uint32 num;
- num = buf[3]; num <<= 8;
- num += buf[2]; num <<= 8;
- num += buf[1]; num <<= 8;
- num += buf[0];
- return num;
+uint32 num;
+num = buf[3]; num <<= 8;
+num += buf[2]; num <<= 8;
+num += buf[1]; num <<= 8;
+num += buf[0];
+return num;
}
static void cdb_close(void *handle);
static void *
-cdb_open(uschar *filename,
- uschar **errmsg)
+cdb_open(const uschar * filename, uschar ** errmsg)
{
- int fileno;
- struct cdb_state *cdbp;
- struct stat statbuf;
- void * mapbuf;
-
- fileno = Uopen(filename, O_RDONLY, 0);
- if (fileno == -1) {
- int save_errno = errno;
- *errmsg = string_open_failed(errno, "%s for cdb lookup", filename);
- errno = save_errno;
- return NULL;
+int fileno;
+struct cdb_state *cdbp;
+struct stat statbuf;
+void * mapbuf;
+
+if ((fileno = Uopen(filename, O_RDONLY, 0)) < 0)
+ {
+ int save_errno = errno;
+ *errmsg = string_open_failed(errno, "%s for cdb lookup", filename);
+ errno = save_errno;
+ return NULL;
}
- if (fstat(fileno, &statbuf) == 0) {
- /* If this is a valid file, then it *must* be at least
- * CDB_HASH_TABLE bytes long */
- if (statbuf.st_size < CDB_HASH_TABLE) {
- int save_errno = errno;
- *errmsg = string_open_failed(errno,
- "%s too short for cdb lookup",
- filename);
- errno = save_errno;
- return NULL;
- }
- } else {
- int save_errno = errno;
- *errmsg = string_open_failed(errno,
- "fstat(%s) failed - cannot do cdb lookup",
- filename);
- errno = save_errno;
- return NULL;
+if (fstat(fileno, &statbuf) != 0)
+ {
+ int save_errno = errno;
+ *errmsg = string_open_failed(errno,
+ "fstat(%s) failed - cannot do cdb lookup",
+ filename);
+ errno = save_errno;
+ return NULL;
+ }
+
+/* If this is a valid file, then it *must* be at least
+CDB_HASH_TABLE bytes long */
+
+if (statbuf.st_size < CDB_HASH_TABLE)
+ {
+ int save_errno = errno;
+ *errmsg = string_open_failed(errno,
+ "%s too short for cdb lookup",
+ filename);
+ errno = save_errno;
+ return NULL;
}
- /* Having got a file open we need the structure to put things in */
- cdbp = store_get(sizeof(struct cdb_state), FALSE);
- /* store_get() does not return if memory was not available... */
- /* preload the structure.... */
- cdbp->fileno = fileno;
- cdbp->filelen = statbuf.st_size;
- cdbp->cdb_map = NULL;
- cdbp->cdb_offsets = NULL;
+/* Having got a file open we need the structure to put things in */
+cdbp = store_get(sizeof(struct cdb_state), FALSE);
+/* store_get() does not return if memory was not available... */
+/* preload the structure.... */
+cdbp->fileno = fileno;
+cdbp->filelen = statbuf.st_size;
+cdbp->cdb_map = NULL;
+cdbp->cdb_offsets = NULL;
- /* if we are allowed to we use mmap here.... */
+/* if we are allowed to we use mmap here.... */
#ifdef HAVE_MMAP
- mapbuf = mmap(NULL,
- statbuf.st_size,
- PROT_READ,
- MAP_SHARED,
- fileno,
- 0);
- if (mapbuf != MAP_FAILED) {
- /* We have an mmap-ed section. Now we can just use it */
- cdbp->cdb_map = mapbuf;
- /* The offsets can be set to the same value since they should
- * effectively be cached as well
- */
- cdbp->cdb_offsets = mapbuf;
-
- /* Now return the state struct */
- return(cdbp);
- } else
- /* If we got here the map failed. Basically we can ignore
- * this since we fall back to slower methods....
- * However lets debug log it...
- */
- DEBUG(D_lookup) debug_printf_indent("cdb mmap failed - %d\n", errno);
+if ((mapbuf = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fileno, 0))
+ != MAP_FAILED)
+ {
+ /* We have an mmap-ed section. Now we can just use it */
+ cdbp->cdb_map = mapbuf;
+ /* The offsets can be set to the same value since they should
+ * effectively be cached as well
+ */
+ cdbp->cdb_offsets = mapbuf;
+
+ /* Now return the state struct */
+ return(cdbp);
+ }
+
+/* If we got here the map failed. Basically we can ignore this since we fall
+back to slower methods.... However lets debug log it... */
+
+DEBUG(D_lookup) debug_printf_indent("cdb mmap failed - %d\n", errno);
#endif /* HAVE_MMAP */
- /* In this case we have either not got MMAP allowed, or it failed */
-
- /* get a buffer to stash the basic offsets in - this should speed
- * things up a lot - especially on multiple lookups */
- cdbp->cdb_offsets = store_get(CDB_HASH_TABLE, FALSE);
-
- /* now fill the buffer up... */
- if (cdb_bread(fileno, cdbp->cdb_offsets, CDB_HASH_TABLE) == -1) {
- /* read of hash table failed, oh dear, oh.....
- * time to give up I think....
- * call the close routine (deallocs the memory), and return NULL */
- *errmsg = string_open_failed(errno,
- "cannot read header from %s for cdb lookup",
- filename);
- cdb_close(cdbp);
- return NULL;
+/* In this case we have either not got MMAP allowed, or it failed */
+
+/* get a buffer to stash the basic offsets in - this should speed
+things up a lot - especially on multiple lookups */
+
+cdbp->cdb_offsets = store_get(CDB_HASH_TABLE, FALSE);
+
+/* now fill the buffer up... */
+
+if (cdb_bread(fileno, cdbp->cdb_offsets, CDB_HASH_TABLE) == -1)
+ {
+ /* read of hash table failed, oh dear, oh..... time to give up I think....
+ call the close routine (deallocs the memory), and return NULL */
+
+ *errmsg = string_open_failed(errno,
+ "cannot read header from %s for cdb lookup",
+ filename);
+ cdb_close(cdbp);
+ return NULL;
}
- /* Everything else done - return the cache structure */
- return cdbp;
+/* Everything else done - return the cache structure */
+return cdbp;
}
*************************************************/
static BOOL
-cdb_check(void *handle,
- uschar *filename,
- int modemask,
- uid_t *owners,
- gid_t *owngroups,
- uschar **errmsg)
+cdb_check(void * handle, const uschar * filename, int modemask,
+ uid_t * owners, gid_t * owngroups, uschar ** errmsg)
{
- struct cdb_state * cdbp = handle;
- return lf_check_file(cdbp->fileno,
- filename,
- S_IFREG,
- modemask,
- owners,
- owngroups,
- "cdb",
- errmsg) == 0;
+struct cdb_state * cdbp = handle;
+return lf_check_file(cdbp->fileno, filename, S_IFREG, modemask,
+ owners, owngroups, "cdb", errmsg) == 0;
}
*************************************************/
static int
-cdb_find(void *handle,
- uschar *filename,
- const uschar *keystring,
- int key_len,
- uschar **result,
- uschar **errmsg,
- uint *do_cache)
+cdb_find(void * handle, const uschar * filename, const uschar * keystring,
+ int key_len, uschar ** result, uschar ** errmsg, uint * do_cache)
{
struct cdb_state * cdbp = handle;
uint32 item_key_len,
/* See local README for interface description */
static void *
-dbmdb_open(uschar *filename, uschar **errmsg)
+dbmdb_open(const uschar * filename, uschar ** errmsg)
{
uschar * dirname = string_copy(filename);
uschar * s;
if ((s = Ustrrchr(dirname, '/'))) *s = '\0';
EXIM_DBOPEN(filename, dirname, O_RDONLY, 0, &yield);
-if (yield == NULL)
+if (!yield)
{
int save_errno = errno;
*errmsg = string_open_failed(errno, "%s as a %s file", filename, EXIM_DBTYPE);
*/
static BOOL
-dbmdb_check(void *handle, uschar *filename, int modemask, uid_t *owners,
+dbmdb_check(void *handle, const uschar *filename, int modemask, uid_t *owners,
gid_t *owngroups, uschar **errmsg)
{
int rc;
the keylength in order to include the terminating zero. */
static int
-dbmdb_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+dbmdb_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
EXIM_DB *d = (EXIM_DB *)handle;
EXIM_DATUM key, data;
/* See local README for interface description */
-int
-static dbmnz_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+static int
+dbmnz_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
return dbmdb_find(handle, filename, keystring, length-1, result, errmsg,
do_cache);
*/
static int
-dbmjz_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+dbmjz_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
uschar *key_item, *key_buffer, *key_p;
const uschar *key_elems = keystring;
/* beware that dbmdb_find() adds 1 to length to get back terminating NUL, so
because we've calculated the real length, we need to subtract one more here */
-return dbmdb_find(handle, filename,
- key_buffer, key_item_len - 1,
+
+return dbmdb_find(handle, filename, key_buffer, key_item_len - 1,
result, errmsg, do_cache);
}
/* See local README for interface description. */
static void *
-dnsdb_open(uschar *filename, uschar **errmsg)
+dnsdb_open(const uschar * filename, uschar **errmsg)
{
filename = filename; /* Keep picky compilers happy */
errmsg = errmsg; /* Ditto */
separator, as always, is colon. */
static int
-dnsdb_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+dnsdb_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
int rc;
int sep = 0;
actually scanning through the list of files. */
static void *
-dsearch_open(uschar *dirname, uschar **errmsg)
+dsearch_open(const uschar * dirname, uschar ** errmsg)
{
DIR * dp = exim_opendir(dirname);
if (!dp)
integer as this gives warnings on 64-bit systems. */
static BOOL
-dsearch_check(void *handle, uschar *filename, int modemask, uid_t *owners,
- gid_t *owngroups, uschar **errmsg)
+dsearch_check(void * handle, const uschar * filename, int modemask,
+ uid_t * owners, gid_t * owngroups, uschar ** errmsg)
{
handle = handle;
return lf_check_file(-1, filename, S_IFDIR, modemask, owners, owngroups,
for us. */
static int
-dsearch_find(void *handle, uschar *dirname, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+dsearch_find(void * handle, const uschar * dirname, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
struct stat statbuf;
int save_errno;
/* See local README for interface description. */
-static void *ibase_open(uschar * filename, uschar ** errmsg)
+static void *ibase_open(const uschar * filename, uschar ** errmsg)
{
- return (void *) (1); /* Just return something non-null */
+return (void *) (1); /* Just return something non-null */
}
deferred with a retryable error. */
static int
-ibase_find(void *handle, uschar * filename, uschar * query, int length,
+ibase_find(void * handle, const uschar * filename, uschar * query, int length,
uschar ** result, uschar ** errmsg, uint *do_cache)
{
- int sep = 0;
- uschar *server;
- uschar *list = ibase_servers;
- uschar buffer[512];
-
- /* Keep picky compilers happy */
- do_cache = do_cache;
-
- DEBUG(D_lookup) debug_printf_indent("Interbase query: %s\n", query);
-
- while ((server =
- string_nextinlist(&list, &sep, buffer,
- sizeof(buffer))) != NULL) {
- BOOL defer_break = FALSE;
- int rc = perform_ibase_search(query, server, result, errmsg,
- &defer_break);
- if (rc != DEFER || defer_break)
- return rc;
- }
+int sep = 0;
+uschar *server;
+uschar *list = ibase_servers;
+uschar buffer[512];
- if (ibase_servers == NULL)
- *errmsg = US "no Interbase servers defined (ibase_servers option)";
+/* Keep picky compilers happy */
+do_cache = do_cache;
- return DEFER;
+DEBUG(D_lookup) debug_printf_indent("Interbase query: %s\n", query);
+
+while ((server = string_nextinlist(&list, &sep, buffer,
+ sizeof(buffer))))
+ {
+ BOOL defer_break = FALSE;
+ int rc = perform_ibase_search(query, server, result, errmsg, &defer_break);
+ if (rc != DEFER || defer_break)
+ return rc;
+ }
+
+if (!ibase_servers)
+ *errmsg = US "no Interbase servers defined (ibase_servers option)";
+
+return DEFER;
}
/* See local README for interface description */
static void *
-json_open(uschar *filename, uschar **errmsg)
+json_open(const uschar * filename, uschar ** errmsg)
{
FILE * f;
*************************************************/
static BOOL
-json_check(void *handle, uschar *filename, int modemask, uid_t *owners,
+json_check(void *handle, const uschar *filename, int modemask, uid_t *owners,
gid_t *owngroups, uschar **errmsg)
{
return lf_check_file(fileno((FILE *)handle), filename, S_IFREG, modemask,
/* See local README for interface description */
static int
-json_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+json_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
FILE * f = handle;
json_t * j, * j0;
The handle and filename arguments are not used. */
static int
-eldap_find(void *handle, uschar *filename, const uschar *ldap_url, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+eldap_find(void * handle, const uschar * filename, const uschar * ldap_url,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
/* Keep picky compilers happy */
do_cache = do_cache;
}
static int
-eldapm_find(void *handle, uschar *filename, const uschar *ldap_url, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+eldapm_find(void * handle, const uschar * filename, const uschar * ldap_url,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
/* Keep picky compilers happy */
do_cache = do_cache;
}
static int
-eldapdn_find(void *handle, uschar *filename, const uschar *ldap_url, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+eldapdn_find(void * handle, const uschar * filename, const uschar * ldap_url,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
/* Keep picky compilers happy */
do_cache = do_cache;
}
int
-eldapauth_find(void *handle, uschar *filename, const uschar *ldap_url, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+eldapauth_find(void * handle, const uschar * filename, const uschar * ldap_url,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
/* Keep picky compilers happy */
do_cache = do_cache;
/* See local README for interface description. */
static void *
-eldap_open(uschar *filename, uschar **errmsg)
+eldap_open(const uschar * filename, uschar ** errmsg)
{
return (void *)(1); /* Just return something non-null */
}
*/
int
-lf_check_file(int fd, uschar *filename, int s_type, int modemask, uid_t *owners,
- gid_t *owngroups, const char *type, uschar **errmsg)
+lf_check_file(int fd, const uschar * filename, int s_type, int modemask,
+ uid_t * owners, gid_t * owngroups, const char * type, uschar ** errmsg)
{
struct stat statbuf;
/* Header for the functions that are shared by the lookups */
-extern int lf_check_file(int, uschar *, int, int, uid_t *, gid_t *,
+extern int lf_check_file(int, const uschar *, int, int, uid_t *, gid_t *,
const char *, uschar **);
extern gstring *lf_quote(uschar *, uschar *, int, gstring *);
extern int lf_sqlperform(const uschar *, const uschar *, const uschar *,
*************************************************/
static void *
-lmdb_open(uschar * filename, uschar ** errmsg)
+lmdb_open(const uschar * filename, uschar ** errmsg)
{
MDB_env * db_env = NULL;
Lmdbstrct * lmdb_p;
*************************************************/
static int
-lmdb_find(void * handle, uschar * filename,
+lmdb_find(void * handle, const uschar * filename,
const uschar * keystring, int length, uschar ** result, uschar ** errmsg,
uint * do_cache)
{
/* See local README for interface description */
static void *
-lsearch_open(uschar *filename, uschar **errmsg)
+lsearch_open(const uschar * filename, uschar ** errmsg)
{
FILE *f = Ufopen(filename, "rb");
if (f == NULL)
*************************************************/
static BOOL
-lsearch_check(void *handle, uschar *filename, int modemask, uid_t *owners,
+lsearch_check(void *handle, const uschar *filename, int modemask, uid_t *owners,
gid_t *owngroups, uschar **errmsg)
{
return lf_check_file(fileno((FILE *)handle), filename, S_IFREG, modemask,
but people do occasionally do weird things. */
static int
-internal_lsearch_find(void *handle, uschar *filename, const uschar *keystring,
- int length, uschar **result, uschar **errmsg, int type)
+internal_lsearch_find(void * handle, const uschar * filename,
+ const uschar * keystring, int length, uschar ** result, uschar ** errmsg,
+ int type)
{
FILE *f = (FILE *)handle;
BOOL last_was_eol = TRUE;
/* See local README for interface description */
static int
-lsearch_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+lsearch_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
do_cache = do_cache; /* Keep picky compilers happy */
return internal_lsearch_find(handle, filename, keystring, length, result,
/* See local README for interface description */
static int
-wildlsearch_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+wildlsearch_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
do_cache = do_cache; /* Keep picky compilers happy */
return internal_lsearch_find(handle, filename, keystring, length, result,
/* See local README for interface description */
static int
-nwildlsearch_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+nwildlsearch_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
do_cache = do_cache; /* Keep picky compilers happy */
return internal_lsearch_find(handle, filename, keystring, length, result,
/* See local README for interface description */
static int
-iplsearch_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+iplsearch_find(void * handle, uschar const * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
do_cache = do_cache; /* Keep picky compilers happy */
+
if ((length == 1 && keystring[0] == '*') ||
string_is_ip_address(keystring, NULL) != 0)
- {
return internal_lsearch_find(handle, filename, keystring, length, result,
errmsg, LSEARCH_IP);
- }
-else
- {
- *errmsg = string_sprintf("\"%s\" is not a valid iplsearch key (an IP "
- "address, with optional CIDR mask, is wanted): "
- "in a host list, use net-iplsearch as the search type", keystring);
- return DEFER;
- }
+
+*errmsg = string_sprintf("\"%s\" is not a valid iplsearch key (an IP "
+"address, with optional CIDR mask, is wanted): "
+"in a host list, use net-iplsearch as the search type", keystring);
+return DEFER;
}
/* See local README for interface description. */
static void *
-mysql_open(uschar *filename, uschar **errmsg)
+mysql_open(const uschar * filename, uschar ** errmsg)
{
return (void *)(1); /* Just return something non-null */
}
shared with other SQL lookups. */
static int
-mysql_find(void *handle, uschar *filename, const uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+mysql_find(void * handle, const uschar * filename, const uschar * query,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
return lf_sqlperform(US"MySQL", US"mysql_servers", mysql_servers, query,
result, errmsg, do_cache, perform_mysql_search);
the "nis" and "nis0" lookup types. */
static void *
-nis_open(uschar *filename, uschar **errmsg)
+nis_open(const uschar * filename, uschar ** errmsg)
{
char *nis_domain;
if (yp_get_default_domain(&nis_domain) != 0)
code. */
static int
-nis_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+nis_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
int rc;
uschar *nis_data;
/* See local README for interface description. */
static int
-nis0_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+nis0_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
int rc;
uschar *nis_data;
/* See local README for interface description. */
static void *
-nisplus_open(uschar *filename, uschar **errmsg)
+nisplus_open(const uschar * filename, uschar ** errmsg)
{
return (void *)(1); /* Just return something non-null */
}
equals sign. */
static int
-nisplus_find(void *handle, uschar *filename, const uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+nisplus_find(void * handle, const uschar * filename, const uschar * query,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
int error_error = FAIL;
const uschar * field_name = NULL;
/* See local README for interface description. */
static void *
-oracle_open(uschar *filename, uschar **errmsg)
+oracle_open(const uschar * filename, uschar ** errmsg)
{
return (void *)(1); /* Just return something non-null */
}
deferred with a retryable error. */
static int
-oracle_find(void *handle, uschar *filename, uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+oracle_find(void * handle, const uschar * filename, uschar * query, int length,
+ uschar ** result, uschar ** errmsg, uint * do_cache)
{
int sep = 0;
uschar *server;
/* See local README for interface description */
static void *
-passwd_open(uschar *filename, uschar **errmsg)
+passwd_open(const uschar * filename, uschar ** errmsg)
{
filename = filename; /* Keep picky compilers happy */
errmsg = errmsg;
/* See local README for interface description */
static int
-passwd_find(void *handle, uschar *filename, const uschar *keystring, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+passwd_find(void * handle, const uschar * filename, const uschar * keystring,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
struct passwd *pw;
/* See local README for interface description. */
static void *
-pgsql_open(uschar *filename, uschar **errmsg)
+pgsql_open(const uschar * filename, uschar ** errmsg)
{
return (void *)(1); /* Just return something non-null */
}
shared with other SQL lookups. */
static int
-pgsql_find(void *handle, uschar *filename, const uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+pgsql_find(void * handle, const uschar * filename, const uschar * query,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
return lf_sqlperform(US"PostgreSQL", US"pgsql_servers", pgsql_servers, query,
result, errmsg, do_cache, perform_pgsql_search);
static void *
-redis_open(uschar *filename, uschar **errmsg)
+redis_open(const uschar * filename, uschar ** errmsg)
{
return (void *)(1);
}
*/
static int
-redis_find(void *handle __attribute__((unused)),
- uschar *filename __attribute__((unused)),
- const uschar *command, int length, uschar **result, uschar **errmsg,
- uint *do_cache)
+redis_find(void * handle __attribute__((unused)),
+ const uschar * filename __attribute__((unused)),
+ const uschar * command, int length, uschar ** result, uschar ** errmsg,
+ uint * do_cache)
{
return lf_sqlperform(US"Redis", US"redis_servers", redis_servers, command,
result, errmsg, do_cache, perform_redis_search);
static void *
-spf_open(uschar *filename, uschar **errmsg)
+spf_open(const uschar * filename, uschar ** errmsg)
{
SPF_dns_server_t * dc;
SPF_server_t *spf_server = NULL;
}
static int
-spf_find(void *handle, uschar *filename, const uschar *keystring, int key_len,
- uschar **result, uschar **errmsg, uint *do_cache)
+spf_find(void * handle, const uschar * filename, const uschar * keystring,
+ int key_len, uschar ** result, uschar ** errmsg, uint * do_cache)
{
SPF_server_t *spf_server = handle;
SPF_request_t *spf_request;
/* See local README for interface description. */
static void *
-sqlite_open(uschar *filename, uschar **errmsg)
+sqlite_open(const uschar * filename, uschar ** errmsg)
{
sqlite3 *db = NULL;
int ret;
-ret = sqlite3_open(CS filename, &db);
-if (ret != 0)
+if ((ret = sqlite3_open(CCS filename, &db)) != 0)
{
*errmsg = (void *)sqlite3_errmsg(db);
debug_printf_indent("Error opening database: %s\n", *errmsg);
static int
-sqlite_find(void *handle, uschar *filename, const uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+sqlite_find(void * handle, const uschar * filename, const uschar * query,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
int ret;
gstring * res = NULL;
/* See local README for interface description. */
static void *
-testdb_open(uschar *filename, uschar **errmsg)
+testdb_open(const uschar * filename, uschar ** errmsg)
{
filename = filename; /* Keep picky compilers happy */
errmsg = errmsg;
/* See local README for interface description. */
static int
-testdb_find(void *handle, uschar *filename, const uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+testdb_find(void * handle, const uschar * filename, const uschar * query,
+ int length, uschar ** result, uschar ** errmsg, uint * do_cache)
{
handle = handle; /* Keep picky compilers happy */
filename = filename;
/* See local README for interface description. */
static void *
-whoson_open(uschar *filename, uschar **errmsg)
+whoson_open(const uschar * filename, uschar ** errmsg)
{
filename = filename; /* Keep picky compilers happy */
errmsg = errmsg;
/* See local README for interface description. */
static int
-whoson_find(void *handle, uschar *filename, uschar *query, int length,
- uschar **result, uschar **errmsg, uint *do_cache)
+whoson_find(void * handle, const uschar * filename, uschar * query, int length,
+ uschar ** result, uschar ** errmsg, uint * do_cache)
{
uschar buffer[80];
handle = handle; /* Keep picky compilers happy */
*/
void *
-search_open(uschar *filename, int search_type, int modemask, uid_t *owners,
- gid_t *owngroups)
+search_open(const uschar * filename, int search_type, int modemask,
+ uid_t * owners, gid_t * owngroups)
{
void *handle;
tree_node *t;
*/
static uschar *
-internal_search_find(void *handle, uschar *filename, uschar *keystring)
+internal_search_find(void * handle, const uschar * filename, uschar * keystring)
{
tree_node * t = (tree_node *)handle;
search_cache * c = (search_cache *)(t->data.ptr);
*/
uschar *
-search_find(void *handle, uschar *filename, uschar *keystring, int partial,
- const uschar *affix, int affixlen, int starflags, int *expand_setup)
+search_find(void * handle, const uschar * filename, uschar * keystring,
+ int partial, const uschar * affix, int affixlen, int starflags,
+ int * expand_setup)
{
tree_node *t = (tree_node *)handle;
BOOL set_null_wild = FALSE;