From: blambert Date: Thu, 8 May 2014 13:08:48 +0000 (+0000) Subject: match relayd proc.c infrastructure with snmpd X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=61da45ab461a9b96726b139f959ec071ab5bf4c8;p=openbsd match relayd proc.c infrastructure with snmpd okay reyk@ --- diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c index d147f4c3775..810126f82be 100644 --- a/usr.sbin/relayd/proc.c +++ b/usr.sbin/relayd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.13 2014/05/06 06:40:03 jsg Exp $ */ +/* $OpenBSD: proc.c,v 1.14 2014/05/08 13:08:48 blambert Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -336,10 +336,11 @@ proc_run(struct privsep *ps, struct privsep_proc *p, struct privsep_proc *procs, u_int nproc, void (*init)(struct privsep *, struct privsep_proc *, void *), void *arg) { - pid_t pid; - struct passwd *pw; - const char *root; - u_int n; + pid_t pid; + struct passwd *pw; + const char *root; + struct control_sock *rcs; + u_int n; if (ps->ps_noaction) return (0); @@ -363,6 +364,9 @@ proc_run(struct privsep *ps, struct privsep_proc *p, if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) { if (control_init(ps, &ps->ps_csock) == -1) fatalx(p->p_title); + TAILQ_FOREACH(rcs, &ps->ps_rcsocks, cs_entry) + if (control_init(ps, rcs) == -1) + fatalx(p->p_title); } /* Change root directory */ @@ -418,6 +422,9 @@ proc_run(struct privsep *ps, struct privsep_proc *p, TAILQ_INIT(&ctl_conns); if (control_listen(&ps->ps_csock) == -1) fatalx(p->p_title); + TAILQ_FOREACH(rcs, &ps->ps_rcsocks, cs_entry) + if (control_listen(rcs) == -1) + fatalx(p->p_title); } if (init != NULL) diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index 2e8cc86051d..1ceadb5e605 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.122 2014/04/22 08:04:23 reyk Exp $ */ +/* $OpenBSD: relayd.c,v 1.123 2014/05/08 13:08:48 blambert Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -195,6 +195,9 @@ main(int argc, char *argv[]) relayd_env = env; env->sc_ps = ps; ps->ps_env = env; +log_warnx("batman"); + TAILQ_INIT(&ps->ps_rcsocks); +log_warnx("robin"); env->sc_conffile = conffile; env->sc_opts = opts; diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 74e13d54fd5..d5adaac4f14 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.178 2014/05/04 16:38:19 reyk Exp $ */ +/* $OpenBSD: relayd.h,v 1.179 2014/05/08 13:08:48 blambert Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter @@ -761,7 +761,10 @@ struct control_sock { int cs_fd; int cs_restricted; void *cs_env; + + TAILQ_ENTRY(control_sock) cs_entry; }; +TAILQ_HEAD(control_socks, control_sock); struct { struct event ev; @@ -891,6 +894,7 @@ struct privsep { u_int ps_instance; struct control_sock ps_csock; + struct control_socks ps_rcsocks; /* Event and signal handlers */ struct event ps_evsigint;