From: gilles@poolp.org Subject: Re: smtpd: actually save the services supported by proc tables To: "Omar Polo" , tech@openbsd.org Date: Mon, 27 May 2024 19:09:36 +0000 May 27, 2024 7:59 PM, "Omar Polo" wrote: > for proc tables the actual services supported is known only after the > handshake. However, we still assume K_ANY for them, and it's a bit > gross. This is a step toward respecting what the actual table reported > it supports. > > (this is also needed for Gilles' diff to offload authentication, since > otherwise all proc tables will hit the K_AUTH codepath.) > > We could also remove K_ANY and leave the default services for the table > proc to zero at this point. > > ok? > I'd rather have this diff than removing K_ANY as it's easier to understand what happens here. ok gilles@ > diff /home/op/w/smtpd > commit - 9e9f678fa09b2345ea7d34e8e699e6e3b1f62316 > path + /home/op/w/smtpd > blob - 0ab99d7f4f490816061429b1a0c96d9cb17db4d4 > file + smtpd.h > --- smtpd.h > +++ smtpd.h > @@ -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; > }; > blob - d24892ede645c088aaef52368cf10db7a37108bb > file + table.c > --- table.c > +++ table.c > @@ -245,6 +245,7 @@ table_create(struct smtpd *conf, const char *backend, > 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 > blob - e7f2a736bbd27e0c60e1f6a9d5e57cddd3a64fcd > file + table_proc.c > --- table_proc.c > +++ table_proc.c > @@ -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);