summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2020-06-06 18:04:36 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2020-06-06 18:04:36 +0100
commitb8514d1960e259d49ab2c84c89eba52ab993da3f (patch)
tree518d70cf6119717cd896e40b5aa88a919fca7751 /src
parent4a7dca52352d0976f200b89a50825433b7551554 (diff)
Sqlite: new-style option to specify db file
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c2
-rw-r--r--src/src/functions.h2
-rw-r--r--src/src/match.c2
-rw-r--r--src/src/search.c17
4 files changed, 18 insertions, 5 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 37be216bb..34e32325e 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -4875,7 +4875,7 @@ while (*s)
file types, the query (i.e. "key") starts with a file name. */
if (!key)
- key = search_args(stype, name, filename, &filename);
+ key = search_args(stype, name, filename, &filename, opts);
/* If skipping, don't do the next bit - just lookup_value == NULL, as if
the entry was not found. Note that there is no search_close() function.
diff --git a/src/src/functions.h b/src/src/functions.h
index e6b78dbe6..1f0c30d0e 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -448,7 +448,7 @@ extern void route_init(void);
extern gstring * route_show_supported(gstring *);
extern void route_tidyup(void);
-extern uschar *search_args(int, uschar *, uschar *, uschar **);
+extern uschar *search_args(int, uschar *, uschar *, uschar **, const uschar *);
extern uschar *search_find(void *, const uschar *, uschar *, int,
const uschar *, int, int, int *, const uschar *);
extern int search_findtype(const uschar *, int);
diff --git a/src/src/match.c b/src/src/match.c
index 45537413d..2f6c92251 100644
--- a/src/src/match.c
+++ b/src/src/match.c
@@ -286,7 +286,7 @@ if (!cb->use_partial) partial = -1;
/* Set the parameters for the three different kinds of lookup. */
-keyquery = search_args(search_type, s, semicolon+1, &filename);
+keyquery = search_args(search_type, s, semicolon+1, &filename, opts);
/* Now do the actual lookup; throw away the data returned unless it was asked
for; partial matching is all handled inside search_find(). Note that there is
diff --git a/src/src/search.c b/src/src/search.c
index 061a9e864..421d9c789 100644
--- a/src/src/search.c
+++ b/src/src/search.c
@@ -223,18 +223,31 @@ Arguments:
search the search-type string
query argument for the search; filename or query
fnamep pointer to return filename
+ opts options
Return: keyquery the search-type (for single-key) or query (for query-type)
*/
uschar *
-search_args(int search_type, uschar * search, uschar * query, uschar ** fnamep)
+search_args(int search_type, uschar * search, uschar * query, uschar ** fnamep,
+ const uschar * opts)
{
Uskip_whitespace(&query);
if (mac_islookup(search_type, lookup_absfilequery))
{ /* query-style but with file (sqlite) */
- uschar * s = query;
+ int sep = ',';
+
+ /* Check options first for new-style file spec */
+ if (opts) for (uschar * s; s = string_nextinlist(&opts, &sep, NULL, 0); )
+ if (Ustrncmp(s, "file=", 5) == 0)
+ {
+ *fnamep = s+5;
+ return query;
+ }
+
+ /* If no filename from options, use old-tyle space-sep prefix on query */
if (*query == '/')
{
+ uschar * s = query;
while (*query && !isspace(*query)) query++;
*fnamep = string_copyn(s, query - s);
Uskip_whitespace(&query);