match iked proc.c infrastructure with proc.c
authorblambert <blambert@openbsd.org>
Thu, 8 May 2014 13:11:16 +0000 (13:11 +0000)
committerblambert <blambert@openbsd.org>
Thu, 8 May 2014 13:11:16 +0000 (13:11 +0000)
ok reyk@

sbin/iked/iked.c
sbin/iked/iked.h
sbin/iked/proc.c

index f139dbd..68a13b2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: iked.c,v 1.20 2014/04/22 12:00:03 reyk Exp $  */
+/*     $OpenBSD: iked.c,v 1.21 2014/05/08 13:11:16 blambert Exp $      */
 
 /*
  * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -118,6 +118,7 @@ main(int argc, char *argv[])
 
        ps = &env->sc_ps;
        ps->ps_env = env;
+       TAILQ_INIT(&ps->ps_rcsocks);
 
        if ((opts & (IKED_OPT_NONATT|IKED_OPT_NATT)) ==
            (IKED_OPT_NONATT|IKED_OPT_NATT))
index 172cc68..34d8204 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: iked.h,v 1.78 2014/05/07 12:57:13 markus Exp $        */
+/*     $OpenBSD: iked.h,v 1.79 2014/05/08 13:11:16 blambert Exp $      */
 
 /*
  * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -80,7 +80,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 ctl_conn {
        TAILQ_ENTRY(ctl_conn)    entry;
@@ -521,6 +524,7 @@ struct privsep {
        int                              ps_noaction;
 
        struct control_sock              ps_csock;
+       struct control_socks             ps_rcsocks;
 
        u_int                            ps_instances[PROC_MAX];
        u_int                            ps_ninstances;
index aca5cfb..37a9d14 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: proc.c,v 1.16 2014/05/06 06:40:03 jsg Exp $   */
+/*     $OpenBSD: proc.c,v 1.17 2014/05/08 13:11:16 blambert Exp $      */
 
 /*
  * Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -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)