summaryrefslogtreecommitdiffstats
path: root/src/daemon/privsep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/privsep.c')
-rw-r--r--src/daemon/privsep.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/daemon/privsep.c b/src/daemon/privsep.c
new file mode 100644
index 0000000..04c49a9
--- /dev/null
+++ b/src/daemon/privsep.c
@@ -0,0 +1,26 @@
+/* -*- mode: c; c-file-style: "openbsd" -*- */
+
+#include "lldpd.h"
+
+static int privileged, unprivileged;
+void
+priv_privileged_fd(int fd)
+{
+ privileged = fd;
+}
+void
+priv_unprivileged_fd(int fd)
+{
+ unprivileged = fd;
+}
+int
+priv_fd(enum priv_context ctx)
+{
+ switch (ctx) {
+ case PRIV_PRIVILEGED:
+ return privileged;
+ case PRIV_UNPRIVILEGED:
+ return unprivileged;
+ }
+ return -1; /* Not possible */
+}