summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2018-06-16 19:41:26 +0000
committergilles <gilles@openbsd.org>2018-06-16 19:41:26 +0000
commitb80b41af33b3db14a33fcedddb502cdb0a22968b (patch)
tree361c8780af2e9455540d779d3d9be084f68ef5ac
parentTIOCSTI is gone (diff)
downloadwireguard-openbsd-b80b41af33b3db14a33fcedddb502cdb0a22968b.tar.xz
wireguard-openbsd-b80b41af33b3db14a33fcedddb502cdb0a22968b.zip
rework the table API so that it takes a struct smtpd * context in parameter
of functions creating, looking up or destroying tables. this is a first step in cleaning up parse.y so it doesn't have side effects outside of parse_config(), bringing nothing but making code cleaner. ok millert@
-rw-r--r--usr.sbin/smtpd/aliases.c10
-rw-r--r--usr.sbin/smtpd/config.c4
-rw-r--r--usr.sbin/smtpd/lka.c24
-rw-r--r--usr.sbin/smtpd/lka_session.c4
-rw-r--r--usr.sbin/smtpd/makemap.c4
-rw-r--r--usr.sbin/smtpd/parse.y30
-rw-r--r--usr.sbin/smtpd/ruleset.c14
-rw-r--r--usr.sbin/smtpd/smtpd.h14
-rw-r--r--usr.sbin/smtpd/table.c30
-rw-r--r--usr.sbin/smtpd/table_static.c8
10 files changed, 71 insertions, 71 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c
index c48108258c5..93d3fe685ce 100644
--- a/usr.sbin/smtpd/aliases.c
+++ b/usr.sbin/smtpd/aliases.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aliases.c,v 1.72 2018/05/24 11:38:24 gilles Exp $ */
+/* $OpenBSD: aliases.c,v 1.73 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -50,8 +50,8 @@ aliases_get(struct expand *expand, const char *username)
char *pbuf;
dsp = dict_xget(env->sc_dispatchers, expand->rule->dispatcher);
- userbase = table_find(dsp->u.local.table_userbase, NULL);
- mapping = table_find(dsp->u.local.table_alias, NULL);
+ userbase = table_find(env, dsp->u.local.table_userbase, NULL);
+ mapping = table_find(env, dsp->u.local.table_alias, NULL);
xlowercase(buf, username, sizeof(buf));
@@ -107,8 +107,8 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr)
struct table *userbase = NULL;
dsp = dict_xget(env->sc_dispatchers, expand->rule->dispatcher);
- userbase = table_find(dsp->u.local.table_userbase, NULL);
- mapping = table_find(dsp->u.local.table_virtual, NULL);
+ userbase = table_find(env, dsp->u.local.table_userbase, NULL);
+ mapping = table_find(env, dsp->u.local.table_virtual, NULL);
if (!bsnprintf(user, sizeof(user), "%s", maddr->user))
return 0;
diff --git a/usr.sbin/smtpd/config.c b/usr.sbin/smtpd/config.c
index d894194f559..597cffffb61 100644
--- a/usr.sbin/smtpd/config.c
+++ b/usr.sbin/smtpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.39 2018/05/24 11:38:24 gilles Exp $ */
+/* $OpenBSD: config.c,v 1.40 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -57,7 +57,7 @@ purge_config(uint8_t what)
}
if (what & PURGE_TABLES) {
while (dict_root(env->sc_tables_dict, NULL, (void **)&t))
- table_destroy(t);
+ table_destroy(env, t);
free(env->sc_tables_dict);
env->sc_tables_dict = NULL;
}
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index 40f57159515..78889153bbf 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.205 2018/05/31 21:06:12 gilles Exp $ */
+/* $OpenBSD: lka.c,v 1.206 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -259,7 +259,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
m_get_string(&m, &tablename);
m_end(&m);
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
m_create(p, IMSG_MTA_LOOKUP_SOURCE, 0, 0, -1);
m_add_id(p, reqid);
@@ -308,7 +308,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
m_get_string(&m, &tablename);
m_end(&m);
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
m_create(p, IMSG_MTA_LOOKUP_SMARTHOST, 0, 0, -1);
m_add_id(p, reqid);
@@ -336,10 +336,10 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
case IMSG_CONF_END:
if (tracing & TRACE_TABLES)
- table_dump_all();
+ table_dump_all(env);
/* fork & exec tables that need it */
- table_open_all();
+ table_open_all(env);
/* revoke proc & exec */
if (pledge("stdio rpath inet dns getpw recvfd",
@@ -375,7 +375,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
case IMSG_CTL_UPDATE_TABLE:
ret = 0;
- table = table_find(imsg->data, NULL);
+ table = table_find(env, imsg->data, NULL);
if (table == NULL) {
log_warnx("warn: Lookup table not found: "
"\"%s\"", (char *)imsg->data);
@@ -468,7 +468,7 @@ lka_authenticate(const char *tablename, const char *user, const char *password)
union lookup lk;
log_debug("debug: lka: authenticating for %s:%s", tablename, user);
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
if (table == NULL) {
log_warnx("warn: could not find table %s needed for authentication",
tablename);
@@ -497,7 +497,7 @@ lka_credentials(const char *tablename, const char *label, char *dst, size_t sz)
char *buf;
int buflen, r;
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
if (table == NULL) {
log_warnx("warn: credentials table %s missing", tablename);
return (LKA_TEMPFAIL);
@@ -505,7 +505,7 @@ lka_credentials(const char *tablename, const char *label, char *dst, size_t sz)
dst[0] = '\0';
- switch(table_lookup(table, NULL, label, K_CREDENTIALS, &lk)) {
+ switch (table_lookup(table, NULL, label, K_CREDENTIALS, &lk)) {
case -1:
log_warnx("warn: credentials lookup fail for %s:%s",
tablename, label);
@@ -540,7 +540,7 @@ lka_userinfo(const char *tablename, const char *username, struct userinfo *res)
union lookup lk;
log_debug("debug: lka: userinfo %s:%s", tablename, username);
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
if (table == NULL) {
log_warnx("warn: cannot find user table %s", tablename);
return (LKA_TEMPFAIL);
@@ -570,7 +570,7 @@ lka_addrname(const char *tablename, const struct sockaddr *sa,
source = sa_to_text(sa);
log_debug("debug: lka: helo %s:%s", tablename, source);
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
if (table == NULL) {
log_warnx("warn: cannot find helo table %s", tablename);
return (LKA_TEMPFAIL);
@@ -598,7 +598,7 @@ lka_mailaddrmap(const char *tablename, const char *username, const struct mailad
int found;
log_debug("debug: lka: mailaddrmap %s:%s", tablename, username);
- table = table_find(tablename, NULL);
+ table = table_find(env, tablename, NULL);
if (table == NULL) {
log_warnx("warn: cannot find mailaddrmap table %s", tablename);
return (LKA_TEMPFAIL);
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index ed6ea290118..77cfe990e74 100644
--- a/usr.sbin/smtpd/lka_session.c
+++ b/usr.sbin/smtpd/lka_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_session.c,v 1.83 2018/05/31 21:06:12 gilles Exp $ */
+/* $OpenBSD: lka_session.c,v 1.84 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -363,7 +363,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn)
if ((tag = strchr(xn->u.user, *env->sc_subaddressing_delim)) != NULL)
*tag++ = '\0';
- userbase = table_find(dsp->u.local.table_userbase, NULL);
+ userbase = table_find(env, dsp->u.local.table_userbase, NULL);
r = table_lookup(userbase, NULL, xn->u.user, K_USERINFO, &lk);
if (r == -1) {
log_trace(TRACE_EXPAND, "expand: lka_expand: "
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c
index d2ffeff8407..d4c34479404 100644
--- a/usr.sbin/smtpd/makemap.c
+++ b/usr.sbin/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.69 2018/05/31 21:06:12 gilles Exp $ */
+/* $OpenBSD: makemap.c,v 1.70 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -448,7 +448,7 @@ conf_aliases(char *cfgpath)
if (parse_config(env, cfgpath, 0))
exit(1);
- table = table_find("aliases", NULL);
+ table = table_find(env, "aliases", NULL);
if (table == NULL)
return (PATH_ALIASES);
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 29eea52189b..e56f229d08d 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.212 2018/06/15 08:57:17 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.213 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -945,7 +945,7 @@ negation TAG tables {
rule->flag_from_socket = 1;
}
| negation FROM LOCAL {
- struct table *t = table_find("<localhost>", NULL);
+ struct table *t = table_find(conf, "<localhost>", NULL);
if (rule->flag_from) {
yyerror("from already specified for this rule");
@@ -955,7 +955,7 @@ negation TAG tables {
rule->table_from = strdup(t->t_name);
}
| negation FROM ANY {
- struct table *t = table_find("<anyhost>", NULL);
+ struct table *t = table_find(conf, "<anyhost>", NULL);
if (rule->flag_from) {
yyerror("from already specified for this rule");
@@ -983,7 +983,7 @@ negation TAG tables {
}
| negation FOR LOCAL {
- struct table *t = table_find("<localnames>", NULL);
+ struct table *t = table_find(conf, "<localnames>", NULL);
if (rule->flag_for) {
yyerror("for already specified for this rule");
@@ -993,7 +993,7 @@ negation TAG tables {
rule->table_for = strdup(t->t_name);
}
| negation FOR ANY {
- struct table *t = table_find("<anydestination>", NULL);
+ struct table *t = table_find(conf, "<anydestination>", NULL);
if (rule->flag_for) {
yyerror("for already specified for this rule");
@@ -1509,7 +1509,7 @@ table : TABLE STRING STRING {
free($3);
YYERROR;
}
- table = table_create(backend, $2, NULL, config);
+ table = table_create(conf, backend, $2, NULL, config);
if (!table_config(table)) {
yyerror("invalid configuration file %s for table %s",
config, table->t_name);
@@ -1521,7 +1521,7 @@ table : TABLE STRING STRING {
free($3);
}
| TABLE STRING {
- table = table_create("static", $2, NULL, NULL);
+ table = table_create(conf, "static", $2, NULL, NULL);
free($2);
} '{' tableval_list '}' {
table = NULL;
@@ -1531,14 +1531,14 @@ table : TABLE STRING STRING {
tablenew : STRING {
struct table *t;
- t = table_create("static", NULL, NULL, NULL);
+ t = table_create(conf, "static", NULL, NULL, NULL);
t->t_type = T_LIST;
table_add(t, $1, NULL);
free($1);
$$ = t;
}
| '{' {
- table = table_create("static", NULL, NULL, NULL);
+ table = table_create(conf, "static", NULL, NULL, NULL);
} tableval_list '}' {
$$ = table;
}
@@ -1547,7 +1547,7 @@ tablenew : STRING {
tableref : '<' STRING '>' {
struct table *t;
- if ((t = table_find($2, NULL)) == NULL) {
+ if ((t = table_find(conf, $2, NULL)) == NULL) {
yyerror("no such table: %s", $2);
free($2);
YYERROR;
@@ -2128,7 +2128,7 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts)
*/
set_local(hostname);
- t = table_create("static", "<anydestination>", NULL, NULL);
+ t = table_create(conf, "static", "<anydestination>", NULL, NULL);
t->t_type = T_LIST;
table_add(t, "*", NULL);
@@ -2139,7 +2139,7 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts)
if (strcmp(hostname, hostname_copy) != 0)
table_add(t, hostname_copy, NULL);
- table_create("getpwnam", "<getpwnam>", NULL, NULL);
+ table_create(conf, "getpwnam", "<getpwnam>", NULL, NULL);
/* bounce dispatcher */
dispatcher = xcalloc(1, sizeof *dispatcher);
@@ -2556,7 +2556,7 @@ set_local(const char *hostname)
{
struct table *t;
- t = table_create("static", "<localnames>", NULL, NULL);
+ t = table_create(conf, "static", "<localnames>", NULL, NULL);
t->t_type = T_LIST;
table_add(t, "localhost", NULL);
table_add(t, hostname, NULL);
@@ -2574,7 +2574,7 @@ set_localaddrs(struct table *localnames)
struct table *t;
char buf[NI_MAXHOST + 5];
- t = table_create("static", "<anyhost>", NULL, NULL);
+ t = table_create(conf, "static", "<anyhost>", NULL, NULL);
table_add(t, "local", NULL);
table_add(t, "0.0.0.0/0", NULL);
table_add(t, "::/0", NULL);
@@ -2582,7 +2582,7 @@ set_localaddrs(struct table *localnames)
if (getifaddrs(&ifap) == -1)
fatal("getifaddrs");
- t = table_create("static", "<localhost>", NULL, NULL);
+ t = table_create(conf, "static", "<localhost>", NULL, NULL);
table_add(t, "local", NULL);
for (p = ifap; p != NULL; p = p->ifa_next) {
diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c
index 1ecaa298458..a2617a699a2 100644
--- a/usr.sbin/smtpd/ruleset.c
+++ b/usr.sbin/smtpd/ruleset.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ruleset.c,v 1.35 2018/05/24 11:38:24 gilles Exp $ */
+/* $OpenBSD: ruleset.c,v 1.36 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@poolp.org>
@@ -59,7 +59,7 @@ ruleset_match_tag(struct rule *r, const struct envelope *evp)
if (!r->flag_tag)
return 1;
- table = table_find(r->table_tag, NULL);
+ table = table_find(env, r->table_tag, NULL);
if ((ret = ruleset_match_table_lookup(table, evp->tag, K_STRING)) < 0)
return ret;
@@ -87,7 +87,7 @@ ruleset_match_from(struct rule *r, const struct envelope *evp)
else
key = ss_to_text(&evp->ss);
- table = table_find(r->table_from, NULL);
+ table = table_find(env, r->table_from, NULL);
if ((ret = ruleset_match_table_lookup(table, key, K_NETADDR)) < 0)
return -1;
@@ -103,7 +103,7 @@ ruleset_match_to(struct rule *r, const struct envelope *evp)
if (!r->flag_for)
return 1;
- table = table_find(r->table_for, NULL);
+ table = table_find(env, r->table_for, NULL);
if ((ret = ruleset_match_table_lookup(table, evp->dest.domain,
K_DOMAIN)) < 0)
return -1;
@@ -120,7 +120,7 @@ ruleset_match_smtp_helo(struct rule *r, const struct envelope *evp)
if (!r->flag_smtp_helo)
return 1;
- table = table_find(r->table_smtp_helo, NULL);
+ table = table_find(env, r->table_smtp_helo, NULL);
if ((ret = ruleset_match_table_lookup(table, evp->helo, K_DOMAIN)) < 0)
return -1;
@@ -176,7 +176,7 @@ ruleset_match_smtp_mail_from(struct rule *r, const struct envelope *evp)
if ((key = mailaddr_to_text(&evp->sender)) == NULL)
return -1;
- table = table_find(r->table_smtp_mail_from, NULL);
+ table = table_find(env, r->table_smtp_mail_from, NULL);
if ((ret = ruleset_match_table_lookup(table, key, K_MAILADDR)) < 0)
return -1;
@@ -196,7 +196,7 @@ ruleset_match_smtp_rcpt_to(struct rule *r, const struct envelope *evp)
if ((key = mailaddr_to_text(&evp->dest)) == NULL)
return -1;
- table = table_find(r->table_smtp_rcpt_to, NULL);
+ table = table_find(env, r->table_smtp_rcpt_to, NULL);
if ((ret = ruleset_match_table_lookup(table, key, K_MAILADDR)) < 0)
return -1;
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 168975ba780..43adf8b4bd7 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.552 2018/06/07 16:28:14 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.553 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1407,8 +1407,8 @@ struct stat_value *stat_timespec(struct timespec *);
/* table.c */
-struct table *table_find(const char *, const char *);
-struct table *table_create(const char *, const char *, const char *,
+struct table *table_find(struct smtpd *, const char *, const char *);
+struct table *table_create(struct smtpd *, const char *, const char *, const char *,
const char *);
int table_config(struct table *);
int table_open(struct table *);
@@ -1420,14 +1420,14 @@ int table_check_service(struct table *, uint32_t);
int table_lookup(struct table *, struct dict *, const char *, enum table_service,
union lookup *);
int table_fetch(struct table *, struct dict *, enum table_service, union lookup *);
-void table_destroy(struct table *);
+void table_destroy(struct smtpd *, struct table *);
void table_add(struct table *, const char *, const char *);
int table_domain_match(const char *, const char *);
int table_netaddr_match(const char *, const char *);
int table_mailaddr_match(const char *, const char *);
-void table_open_all(void);
-void table_dump_all(void);
-void table_close_all(void);
+void table_open_all(struct smtpd *);
+void table_dump_all(struct smtpd *);
+void table_close_all(struct smtpd *);
int table_parse_lookup(enum table_service, const char *, const char *,
union lookup *);
diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c
index 10e21d631e2..9bfea5eb256 100644
--- a/usr.sbin/smtpd/table.c
+++ b/usr.sbin/smtpd/table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.c,v 1.29 2018/05/31 21:06:12 gilles Exp $ */
+/* $OpenBSD: table.c,v 1.30 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -104,19 +104,19 @@ table_service_name(enum table_service s)
}
struct table *
-table_find(const char *name, const char *tag)
+table_find(struct smtpd *conf, const char *name, const char *tag)
{
char buf[LINE_MAX];
if (tag == NULL)
- return dict_get(env->sc_tables_dict, name);
+ return dict_get(conf->sc_tables_dict, name);
if ((size_t)snprintf(buf, sizeof(buf), "%s#%s", name, tag) >= sizeof(buf)) {
log_warnx("warn: table name too long: %s#%s", name, tag);
return (NULL);
}
- return dict_get(env->sc_tables_dict, buf);
+ return dict_get(conf->sc_tables_dict, buf);
}
int
@@ -187,7 +187,7 @@ table_fetch(struct table *table, struct dict *params, enum table_service kind, u
}
struct table *
-table_create(const char *backend, const char *name, const char *tag,
+table_create(struct smtpd *conf, const char *backend, const char *name, const char *tag,
const char *config)
{
struct table *t;
@@ -205,7 +205,7 @@ table_create(const char *backend, const char *name, const char *tag,
name = buf;
}
- if (name && table_find(name, NULL))
+ if (name && table_find(conf, name, NULL))
fatalx("table_create: table \"%s\" already defined", name);
if ((tb = table_backend_lookup(backend)) == NULL) {
@@ -260,20 +260,20 @@ table_create(const char *backend, const char *name, const char *tag,
}
dict_init(&t->t_dict);
- dict_set(env->sc_tables_dict, t->t_name, t);
+ dict_set(conf->sc_tables_dict, t->t_name, t);
return (t);
}
void
-table_destroy(struct table *t)
+table_destroy(struct smtpd *conf, struct table *t)
{
void *p = NULL;
while (dict_poproot(&t->t_dict, (void **)&p))
free(p);
- dict_xpop(env->sc_tables_dict, t->t_name);
+ dict_xpop(conf->sc_tables_dict, t->t_name);
free(t);
}
@@ -459,7 +459,7 @@ table_inet6_match(struct sockaddr_in6 *ss, struct netaddr *ssmask)
}
void
-table_dump_all(void)
+table_dump_all(struct smtpd *conf)
{
struct table *t;
void *iter, *i2;
@@ -468,7 +468,7 @@ table_dump_all(void)
char buf[1024];
iter = NULL;
- while (dict_iter(env->sc_tables_dict, &iter, NULL, (void **)&t)) {
+ while (dict_iter(conf->sc_tables_dict, &iter, NULL, (void **)&t)) {
i2 = NULL;
sep = "";
buf[0] = '\0';
@@ -498,25 +498,25 @@ table_dump_all(void)
}
void
-table_open_all(void)
+table_open_all(struct smtpd *conf)
{
struct table *t;
void *iter;
iter = NULL;
- while (dict_iter(env->sc_tables_dict, &iter, NULL, (void **)&t))
+ while (dict_iter(conf->sc_tables_dict, &iter, NULL, (void **)&t))
if (!table_open(t))
fatalx("failed to open table %s", t->t_name);
}
void
-table_close_all(void)
+table_close_all(struct smtpd *conf)
{
struct table *t;
void *iter;
iter = NULL;
- while (dict_iter(env->sc_tables_dict, &iter, NULL, (void **)&t))
+ while (dict_iter(conf->sc_tables_dict, &iter, NULL, (void **)&t))
table_close(t);
}
diff --git a/usr.sbin/smtpd/table_static.c b/usr.sbin/smtpd/table_static.c
index ded0321ae9c..d76eb1dbb02 100644
--- a/usr.sbin/smtpd/table_static.c
+++ b/usr.sbin/smtpd/table_static.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table_static.c,v 1.18 2018/05/24 11:38:24 gilles Exp $ */
+/* $OpenBSD: table_static.c,v 1.19 2018/06/16 19:41:26 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -181,7 +181,7 @@ table_static_update(struct table *table)
if (table->t_config[0] == '\0')
goto ok;
- t = table_create("static", table->t_name, "update", table->t_config);
+ t = table_create(env, "static", table->t_name, "update", table->t_config);
if (!table_config(t))
goto err;
@@ -189,14 +189,14 @@ table_static_update(struct table *table)
while (dict_poproot(&table->t_dict, (void **)&p))
free(p);
dict_merge(&table->t_dict, &t->t_dict);
- table_destroy(t);
+ table_destroy(env, t);
ok:
log_info("info: Table \"%s\" successfully updated", table->t_name);
return 1;
err:
- table_destroy(t);
+ table_destroy(env, t);
log_info("info: Failed to update table \"%s\"", table->t_name);
return 0;
}