From: op Date: Tue, 28 May 2024 07:10:30 +0000 (+0000) Subject: actually honour the services supported by the proc tables X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2ee83f25fcae94b5622e5946df51671cece070ef;p=openbsd actually honour the services supported by the proc tables ok gilles@ --- diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 0ab99d7f4f4..e7ff0e3cafb 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.684 2024/05/07 12:10:06 op Exp $ */ +/* $OpenBSD: smtpd.h,v 1.685 2024/05/28 07:10:30 op Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -356,6 +356,7 @@ struct table { enum table_type t_type; char t_config[PATH_MAX]; + unsigned int t_services; void *t_handle; struct table_backend *t_backend; }; diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c index d24892ede64..2b9c9cf2511 100644 --- a/usr.sbin/smtpd/table.c +++ b/usr.sbin/smtpd/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.52 2024/05/07 12:10:06 op Exp $ */ +/* $OpenBSD: table.c,v 1.53 2024/05/28 07:10:30 op Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -245,6 +245,7 @@ table_create(struct smtpd *conf, const char *backend, const char *name, fatalx("table_create: backend \"%s\" does not exist", backend); t = xcalloc(1, sizeof(*t)); + t->t_services = tb->services; t->t_backend = tb; if (config) { @@ -341,7 +342,7 @@ table_check_type(struct table *t, uint32_t mask) int table_check_service(struct table *t, uint32_t mask) { - return t->t_backend->services & mask; + return t->t_services & mask; } int diff --git a/usr.sbin/smtpd/table_proc.c b/usr.sbin/smtpd/table_proc.c index e7f2a736bbd..07598ca69c6 100644 --- a/usr.sbin/smtpd/table_proc.c +++ b/usr.sbin/smtpd/table_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_proc.c,v 1.22 2024/05/23 17:10:00 op Exp $ */ +/* $OpenBSD: table_proc.c,v 1.23 2024/05/28 07:10:30 op Exp $ */ /* * Copyright (c) 2024 Omar Polo @@ -172,6 +172,7 @@ table_proc_open(struct table *table) if (services == 0) fatalx("table-proc: no services registered"); + table->t_services = services; table->t_handle = priv; return (1);