ok
Alexander Bluhm(alexander.bl...@gmx.net) on 2018.09.01 00:20:15 +0200:
> Hi,
>
> Accidentally relayd(8) closes file descriptor 0 in the pfe child
> process. Usually this is a bad idea.
>
> snmp_init() does this:
>
> if (env->sc_snmp != -1) {
> ...
> close(env->sc_snmp);
> env->sc_snmp = -1;
> }
>
> But env has been initialized with 0 by calloc(3). It has to be set
> to -1 to make the logic work.
>
> ok?
>
> bluhm
>
> Index: usr.sbin/relayd/relayd.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/relayd/relayd.c,v
> retrieving revision 1.172
> diff -u -p -r1.172 relayd.c
> --- usr.sbin/relayd/relayd.c 6 Aug 2018 17:31:31 -0000 1.172
> +++ usr.sbin/relayd/relayd.c 31 Aug 2018 22:10:25 -0000
> @@ -184,6 +184,7 @@ main(int argc, char *argv[])
> TAILQ_INIT(&env->sc_hosts);
> TAILQ_INIT(&env->sc_sessions);
> env->sc_rtable = getrtable();
> + env->sc_snmp = -1;
> /* initialize the TLS session id to a random key for all relay procs */
> arc4random_buf(env->sc_conf.tls_sid, sizeof(env->sc_conf.tls_sid));
>
>