server: Introduce privilege separation.
[tripe] / server / peer.c
index 3cb12ea..4bb2c82 100644 (file)
@@ -742,9 +742,9 @@ peer *p_create(peerspec *spec)
   p->ifname = 0;
   memset(&p->st, 0, sizeof(stats));
   p->st.t_start = time(0);
-  if (!tops->open)
+  if (!(tops->flags & TUNF_PRIVOPEN))
     fd = -1;
-  else if ((fd = tops->open(&p->ifname)) < 0)
+  else if ((fd = ps_tunfd(tops, &p->ifname)) < 0)
     goto tidy_2;
   if ((p->t = tops->create(p, fd, &p->ifname)) == 0)
     goto tidy_3;