From: claudio Date: Tue, 18 Jul 2023 13:06:33 +0000 (+0000) Subject: Do not duplicate prototypes of log.h in ypldap.h (without the extra X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=73492e0c7abc13d0fcf5a83c7f5cd157534d380a;p=openbsd Do not duplicate prototypes of log.h in ypldap.h (without the extra __format__ attribute on top). Also properly ignore SIGHUP in the child processes. OK jmatthew@ --- diff --git a/usr.sbin/ypldap/entries.c b/usr.sbin/ypldap/entries.c index 3d259e6e40d..1387d11533a 100644 --- a/usr.sbin/ypldap/entries.c +++ b/usr.sbin/ypldap/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.5 2022/02/05 22:59:58 naddy Exp $ */ +/* $OpenBSD: entries.c,v 1.6 2023/07/18 13:06:33 claudio Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard * @@ -34,6 +34,7 @@ #include #include "ypldap.h" +#include "log.h" void flatten_entries(struct env *env) diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c index 50dfedec84b..31f29efd1f2 100644 --- a/usr.sbin/ypldap/ldapclient.c +++ b/usr.sbin/ypldap/ldapclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapclient.c,v 1.48 2023/05/22 05:59:05 jmatthew Exp $ */ +/* $OpenBSD: ldapclient.c,v 1.49 2023/07/18 13:06:33 claudio Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver @@ -115,6 +115,9 @@ client_sig_handler(int sig, short event, void *p) case SIGTERM: client_shutdown(); break; + case SIGHUP: + /* ingore */ + break; default: fatalx("unexpected signal"); } @@ -326,6 +329,7 @@ ldapclient(int pipe_main2client[2]) struct passwd *pw; struct event ev_sigint; struct event ev_sigterm; + struct event ev_sighup; struct env env; switch (pid = fork()) { @@ -377,8 +381,10 @@ ldapclient(int pipe_main2client[2]) signal(SIGPIPE, SIG_IGN); signal_set(&ev_sigint, SIGINT, client_sig_handler, NULL); signal_set(&ev_sigterm, SIGTERM, client_sig_handler, NULL); + signal_set(&ev_sighup, SIGHUP, client_sig_handler, NULL); signal_add(&ev_sigint, NULL); signal_add(&ev_sigterm, NULL); + signal_add(&ev_sighup, NULL); close(pipe_main2client[0]); if ((env.sc_iev = calloc(1, sizeof(*env.sc_iev))) == NULL) diff --git a/usr.sbin/ypldap/parse.y b/usr.sbin/ypldap/parse.y index 8770a6ca066..5cfb72951f7 100644 --- a/usr.sbin/ypldap/parse.y +++ b/usr.sbin/ypldap/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.36 2022/10/13 04:55:33 jmatthew Exp $ */ +/* $OpenBSD: parse.y,v 1.37 2023/07/18 13:06:33 claudio Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -51,6 +51,7 @@ #include #include "ypldap.h" +#include "log.h" TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); static struct file { diff --git a/usr.sbin/ypldap/yp.c b/usr.sbin/ypldap/yp.c index 98ed3f7ebb2..d975d247f3f 100644 --- a/usr.sbin/ypldap/yp.c +++ b/usr.sbin/ypldap/yp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yp.c,v 1.21 2022/08/19 03:50:32 jmatthew Exp $ */ +/* $OpenBSD: yp.c,v 1.22 2023/07/18 13:06:33 claudio Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard * @@ -44,6 +44,7 @@ #include #include "ypldap.h" +#include "log.h" #define BINDINGDIR "/var/yp/binding" diff --git a/usr.sbin/ypldap/ypldap.h b/usr.sbin/ypldap/ypldap.h index 1f9a16d814a..8baa0f12b03 100644 --- a/usr.sbin/ypldap/ypldap.h +++ b/usr.sbin/ypldap/ypldap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ypldap.h,v 1.23 2022/10/13 04:55:33 jmatthew Exp $ */ +/* $OpenBSD: ypldap.h,v 1.24 2023/07/18 13:06:33 claudio Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -193,17 +193,6 @@ struct env { int update_trashed; }; -/* log.c */ -void log_init(int); -void log_warn(const char *, ...); -void log_warnx(const char *, ...); -void log_info(const char *, ...); -void log_debug(const char *, ...); -void logit(int, const char *, ...); -void vlog(int, const char *, va_list); -__dead void fatal(const char *); -__dead void fatalx(const char *); - /* parse.y */ int parse_config(struct env *, const char *, int); int cmdline_symset(char *); diff --git a/usr.sbin/ypldap/ypldap_dns.c b/usr.sbin/ypldap/ypldap_dns.c index 59835a80e5c..6645e1100f7 100644 --- a/usr.sbin/ypldap/ypldap_dns.c +++ b/usr.sbin/ypldap/ypldap_dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypldap_dns.c,v 1.15 2022/08/23 02:57:27 jmatthew Exp $ */ +/* $OpenBSD: ypldap_dns.c,v 1.16 2023/07/18 13:06:33 claudio Exp $ */ /* * Copyright (c) 2003-2008 Henning Brauer @@ -38,6 +38,7 @@ #include #include "ypldap.h" +#include "log.h" volatile sig_atomic_t quit_dns = 0; struct imsgev *iev_dns; @@ -55,6 +56,9 @@ dns_sig_handler(int sig, short event, void *p) case SIGTERM: dns_shutdown(); break; + case SIGHUP: + /* ignore */ + break; default: fatalx("unexpected signal"); } @@ -70,7 +74,7 @@ dns_shutdown(void) pid_t ypldap_dns(int pipe_ntp[2], struct passwd *pw) { - pid_t pid; + pid_t pid; struct event ev_sigint; struct event ev_sigterm; struct event ev_sighup;