2016-05-22 21:22:39 +01:00
|
|
|
diff --git a/smtpd/parse.y b/smtpd/parse.y
|
|
|
|
index ab02719..c1c77d9 100644
|
|
|
|
--- a/smtpd/parse.y
|
|
|
|
+++ b/smtpd/parse.y
|
|
|
|
@@ -2534,13 +2534,19 @@ create_filter_proc(char *name, char *prog)
|
2015-11-14 20:32:51 +00:00
|
|
|
{
|
|
|
|
struct filter_conf *f;
|
|
|
|
char *path;
|
2016-05-22 21:22:39 +01:00
|
|
|
+ const char *proc_path;
|
2015-11-14 20:32:51 +00:00
|
|
|
|
|
|
|
if (dict_get(&conf->sc_filters, name)) {
|
|
|
|
yyerror("filter \"%s\" already defined", name);
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (asprintf(&path, "%s/filter-%s", PATH_LIBEXEC, prog) == -1) {
|
2016-05-22 21:22:39 +01:00
|
|
|
+ proc_path = getenv("OPENSMTPD_PROC_PATH");
|
|
|
|
+ if (proc_path == NULL) {
|
|
|
|
+ proc_path = PATH_LIBEXEC;
|
|
|
|
+ }
|
2015-11-14 20:32:51 +00:00
|
|
|
+
|
|
|
|
+ if (asprintf(&path, "%s/filter-%s", proc_path, prog) == -1) {
|
|
|
|
yyerror("filter \"%s\" asprintf failed", name);
|
|
|
|
return (0);
|
|
|
|
}
|
2016-05-22 21:22:39 +01:00
|
|
|
diff --git a/smtpd/smtpd.c b/smtpd/smtpd.c
|
|
|
|
index afc8891..9b0a80f 100644
|
|
|
|
--- a/smtpd/smtpd.c
|
|
|
|
+++ b/smtpd/smtpd.c
|
|
|
|
@@ -795,6 +795,7 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
|
2015-11-14 20:32:51 +00:00
|
|
|
char path[PATH_MAX];
|
|
|
|
char name[PATH_MAX];
|
|
|
|
char *arg;
|
2016-05-22 21:22:39 +01:00
|
|
|
+ char *proc_path;
|
2015-11-14 20:32:51 +00:00
|
|
|
|
|
|
|
if (strlcpy(name, conf, sizeof(name)) >= sizeof(name)) {
|
|
|
|
log_warnx("warn: %s-proc: conf too long", key);
|
2016-05-22 21:22:39 +01:00
|
|
|
@@ -805,7 +806,12 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
|
2015-11-14 20:32:51 +00:00
|
|
|
if (arg)
|
|
|
|
*arg++ = '\0';
|
|
|
|
|
|
|
|
- if (snprintf(path, sizeof(path), PATH_LIBEXEC "/%s-%s", key, name) >=
|
2016-05-22 21:22:39 +01:00
|
|
|
+ proc_path = getenv("OPENSMTPD_PROC_PATH");
|
|
|
|
+ if (proc_path == NULL) {
|
|
|
|
+ proc_path = PATH_LIBEXEC;
|
|
|
|
+ }
|
2015-11-14 20:32:51 +00:00
|
|
|
+
|
|
|
|
+ if (snprintf(path, sizeof(path), "%s/%s-%s", proc_path, key, name) >=
|
|
|
|
(ssize_t)sizeof(path)) {
|
|
|
|
log_warn("warn: %s-proc: exec path too long", key);
|
|
|
|
return (-1);
|
2016-05-22 21:22:39 +01:00
|
|
|
diff --git a/smtpd/table.c b/smtpd/table.c
|
|
|
|
index 21ee237..95b5164 100644
|
|
|
|
--- a/smtpd/table.c
|
|
|
|
+++ b/smtpd/table.c
|
|
|
|
@@ -193,6 +193,7 @@ table_create(const char *backend, const char *name, const char *tag,
|
2015-11-14 20:32:51 +00:00
|
|
|
struct table_backend *tb;
|
|
|
|
char buf[LINE_MAX];
|
|
|
|
char path[LINE_MAX];
|
2016-05-22 21:22:39 +01:00
|
|
|
+ const char *proc_path;
|
2015-11-14 20:32:51 +00:00
|
|
|
size_t n;
|
|
|
|
struct stat sb;
|
|
|
|
|
2016-05-22 21:22:39 +01:00
|
|
|
@@ -207,11 +208,16 @@ table_create(const char *backend, const char *name, const char *tag,
|
2015-11-14 20:32:51 +00:00
|
|
|
if (name && table_find(name, NULL))
|
|
|
|
fatalx("table_create: table \"%s\" already defined", name);
|
|
|
|
|
2016-05-22 21:22:39 +01:00
|
|
|
+ proc_path = getenv("OPENSMTPD_PROC_PATH");
|
|
|
|
+ if (proc_path == NULL) {
|
|
|
|
+ proc_path = PATH_LIBEXEC;
|
|
|
|
+ }
|
2015-11-14 20:32:51 +00:00
|
|
|
+
|
|
|
|
if ((tb = table_backend_lookup(backend)) == NULL) {
|
2016-05-22 21:22:39 +01:00
|
|
|
- if ((size_t)snprintf(path, sizeof(path), PATH_LIBEXEC"/table-%s",
|
|
|
|
- backend) >= sizeof(path)) {
|
|
|
|
- fatalx("table_create: path too long \""
|
|
|
|
- PATH_LIBEXEC"/table-%s\"", backend);
|
2015-11-14 20:32:51 +00:00
|
|
|
+ if ((size_t)snprintf(path, sizeof(path), "%s/table-%s",
|
2016-05-22 21:22:39 +01:00
|
|
|
+ proc_path, backend) >= sizeof(path)) {
|
|
|
|
+ fatalx("table_create: path too long \"%s/table-%s\"",
|
|
|
|
+ proc_path, backend);
|
|
|
|
}
|
|
|
|
if (stat(path, &sb) == 0) {
|
|
|
|
tb = table_backend_lookup("proc");
|