summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-11-21 23:27:23 +0000
committerbrian <brian@FreeBSD.org>1999-11-21 23:27:23 +0000
commit257703c14f8e6f30e188734cc44777626b976637 (patch)
treecc06d1361c0b14915b70a014a507291f2e1b5093
parentc53a2225ab03295e0fe4a22fff7212cb3b6003db (diff)
downloadFreeBSD-src-257703c14f8e6f30e188734cc44777626b976637.zip
FreeBSD-src-257703c14f8e6f30e188734cc44777626b976637.tar.gz
Call MkSockNode() as uid 0
Forgotten by: julian
-rw-r--r--usr.sbin/ppp/ether.c2
-rw-r--r--usr.sbin/ppp/id.c18
-rw-r--r--usr.sbin/ppp/id.h3
3 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/ppp/ether.c b/usr.sbin/ppp/ether.c
index 14ec99a..77cd5e1 100644
--- a/usr.sbin/ppp/ether.c
+++ b/usr.sbin/ppp/ether.c
@@ -457,7 +457,7 @@ ether_Create(struct physical *p)
*/
/* Create a socket node */
- if (NgMkSockNode(NULL, &dev->cs, &p->fd) == -1) {
+ if (ID0NgMkSockNode(NULL, &dev->cs, &p->fd) == -1) {
log_Printf(LogWARN, "Cannot create netgraph socket node: %s\n",
strerror(errno));
free(dev);
diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c
index 0d15c92..f2b4581 100644
--- a/usr.sbin/ppp/id.c
+++ b/usr.sbin/ppp/id.c
@@ -32,6 +32,9 @@
#include <sys/ioctl.h>
#include <fcntl.h>
+#ifndef NONETGRAPH
+#include <netgraph.h>
+#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
@@ -296,3 +299,18 @@ ID0kldload(const char *dev)
return result;
}
#endif
+
+#ifndef NONETGRAPH
+int
+ID0NgMkSockNode(const char *name, int *cs, int *ds)
+{
+ int result;
+
+ ID0set0();
+ result = NgMkSockNode(name, cs, ds);
+ log_Printf(LogID0, "%d = NgMkSockNode(\"%s\", &cs, &ds)\n",
+ result, name ? name : "");
+ ID0setuser();
+ return result;
+}
+#endif
diff --git a/usr.sbin/ppp/id.h b/usr.sbin/ppp/id.h
index 57344cf..11cb831 100644
--- a/usr.sbin/ppp/id.h
+++ b/usr.sbin/ppp/id.h
@@ -49,3 +49,6 @@ extern void ID0setproctitle(const char *);
#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
extern int ID0kldload(const char *);
#endif
+#ifndef NONETGRAPH
+extern int ID0NgMkSockNode(const char *, int *, int *);
+#endif
OpenPOWER on IntegriCloud