diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-11-30 14:13:04 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-11-30 14:13:04 +0000 |
commit | 6de76162d8096c22183a10330d6b78d22b862609 (patch) | |
tree | 785bc144744057702889cd50cd4c207cd7de1f00 /usr.sbin/smtpd | |
parent | e37d081909191a42d53d61e1f7adb6cbdffd1551 (diff) |
when looking up tables, start in /usr/local/libexec before /usr/libexec, so
ports/packages can be installed in the proper place
ok jung@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/parse.y | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/smtpd/table.c | 37 |
4 files changed, 29 insertions, 21 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 77511d00726..ee3a73740a1 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.157 2015/11/30 12:26:55 sunil Exp $ */ +/* $OpenBSD: parse.y,v 1.158 2015/11/30 14:13:03 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -2322,7 +2322,7 @@ create_filter_proc(char *name, char *prog) return (NULL); } - if (asprintf(&path, "%s/filter-%s", PATH_LIBEXEC, prog) == -1) { + if (asprintf(&path, "%s/filter-%s", PATH_LIBEXEC_DEPRECATED, prog) == -1) { yyerror("filter \"%s\" asprintf failed", name); return (0); } diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index fa0f37c50e7..f4880aadeef 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.255 2015/11/30 12:49:35 gilles Exp $ */ +/* $OpenBSD: smtpd.c,v 1.256 2015/11/30 14:13:03 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -793,7 +793,7 @@ fork_proc_backend(const char *key, const char *conf, const char *procname) if (arg) *arg++ = '\0'; - if (snprintf(path, sizeof(path), PATH_LIBEXEC "/%s-%s", key, name) >= + if (snprintf(path, sizeof(path), PATH_LIBEXEC_DEPRECATED "/%s-%s", key, name) >= (ssize_t)sizeof(path)) { log_warn("warn: %s-proc: exec path too long", key); return (-1); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 7a1c85d5f7c..781d3a79af7 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.487 2015/11/30 12:49:35 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.488 2015/11/30 14:13:03 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -58,7 +58,8 @@ #define PATH_PURGE "/purge" #define PATH_TEMPORARY "/temporary" -#define PATH_LIBEXEC "/usr/libexec/smtpd" +#define PATH_LIBEXEC_DEPRECATED "/usr/libexec/smtpd" +#define PATH_LIBEXEC "/usr/local/libexec/smtpd:/usr/libexec/smtpd" /* diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c index d0217ac8e13..b5f8c5e822e 100644 --- a/usr.sbin/smtpd/table.c +++ b/usr.sbin/smtpd/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.20 2015/11/23 21:50:12 gilles Exp $ */ +/* $OpenBSD: table.c,v 1.21 2015/11/30 14:13:03 gilles Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -191,8 +191,11 @@ table_create(const char *backend, const char *name, const char *tag, { struct table *t; struct table_backend *tb; + char *ps; + char *p; char buf[LINE_MAX]; char path[LINE_MAX]; + char pathsplit[LINE_MAX]; size_t n; struct stat sb; @@ -208,21 +211,25 @@ table_create(const char *backend, const char *name, const char *tag, fatalx("table_create: table \"%s\" already defined", name); if ((tb = table_backend_lookup(backend)) == NULL) { - 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); - } - if (stat(path, &sb) == 0) { - tb = table_backend_lookup("proc"); - (void)strlcpy(path, backend, sizeof(path)); - if (config) { - (void)strlcat(path, ":", sizeof(path)); - if (strlcat(path, config, sizeof(path)) - >= sizeof(path)) - fatalx("table_create: config file path too long"); + (void)strlcpy(pathsplit, PATH_LIBEXEC, sizeof pathsplit); + for (ps = pathsplit; (p = strsep(&ps, ":")) != NULL;) { + if ((size_t)snprintf(path, sizeof(path), "%s/table-%s", + p, backend) >= sizeof(path)) { + fatalx("table_create: path too long \"" + "%s/table-%s\"", p, backend); + } + if (stat(path, &sb) == 0) { + tb = table_backend_lookup("proc"); + (void)strlcpy(path, backend, sizeof(path)); + if (config) { + (void)strlcat(path, ":", sizeof(path)); + if (strlcat(path, config, sizeof(path)) + >= sizeof(path)) + fatalx("table_create: config file path too long"); + } + config = path; + break; } - config = path; } } |