From: Florian Obser Subject: Re: ldapd: use imsg_get_fd() To: tech@openbsd.org Date: Tue, 16 Jan 2024 12:40:12 +0100 OK On 2024-01-16 12:31 +01, Claudio Jeker wrote: > This converts ldapd to use imsg_get_fd(). > > -- > :wq Claudio > > Index: ldape.c > =================================================================== > RCS file: /cvs/src/usr.sbin/ldapd/ldape.c,v > diff -u -p -r1.37 ldape.c > --- ldape.c 1 Mar 2023 08:17:53 -0000 1.37 > +++ ldape.c 12 Dec 2023 16:49:29 -0000 > @@ -541,6 +541,7 @@ ldape_open_result(struct imsg *imsg) > { > struct namespace *ns; > struct open_req *oreq = imsg->data; > + int fd; > > if (imsg->hdr.len != sizeof(*oreq) + IMSG_HEADER_SIZE) > fatal("invalid size of open result"); > @@ -548,24 +549,25 @@ ldape_open_result(struct imsg *imsg) > if (oreq->path[PATH_MAX-1] != '\0') > fatal("bogus path"); > > - log_debug("open(%s) returned fd %d", oreq->path, imsg->fd); > + fd = imsg_get_fd(imsg); > + log_debug("open(%s) returned fd %d", oreq->path, fd); > > TAILQ_FOREACH(ns, &conf->namespaces, next) { > if (namespace_has_referrals(ns)) > continue; > if (strcmp(oreq->path, ns->data_path) == 0) { > - namespace_set_data_fd(ns, imsg->fd); > + namespace_set_data_fd(ns, fd); > break; > } > if (strcmp(oreq->path, ns->indx_path) == 0) { > - namespace_set_indx_fd(ns, imsg->fd); > + namespace_set_indx_fd(ns, fd); > break; > } > } > > if (ns == NULL) { > log_warnx("spurious open result"); > - close(imsg->fd); > + close(fd); > } else > namespace_queue_schedule(ns, 0); > } > -- In my defence, I have been left unsupervised.