summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/id.h
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-18 00:01:44 +0000
committerbrian <brian@FreeBSD.org>2000-08-18 00:01:44 +0000
commitbac59a32d06fce1477c920a3c8aad60f73ae9af9 (patch)
tree7688894f80a2ddf31d01f87489e92fffb7e1953c /usr.sbin/ppp/id.h
parentc0049c3df2bfda77644542cc72cd5d7949841805 (diff)
downloadFreeBSD-src-bac59a32d06fce1477c920a3c8aad60f73ae9af9.zip
FreeBSD-src-bac59a32d06fce1477c920a3c8aad60f73ae9af9.tar.gz
Make -DNOSUID (or -DPPP_NOSUID) possible to build ppp without SUID
capabilities.
Diffstat (limited to 'usr.sbin/ppp/id.h')
-rw-r--r--usr.sbin/ppp/id.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/usr.sbin/ppp/id.h b/usr.sbin/ppp/id.h
index 8c48767..409da49 100644
--- a/usr.sbin/ppp/id.h
+++ b/usr.sbin/ppp/id.h
@@ -26,6 +26,7 @@
* $FreeBSD$
*/
+#ifndef NOSUID
struct utmp;
struct sockaddr_un;
@@ -51,3 +52,40 @@ extern int ID0kldload(const char *);
#ifndef NONETGRAPH
extern int ID0NgMkSockNode(const char *, int *, int *);
#endif
+#else /* NOSUID */
+#define ID0init()
+#define ID0realuid() (0)
+#define ID0ioctl ioctl
+#define ID0unlink unlink
+#define ID0socket socket
+#define ID0fopen fopen
+#define ID0open open
+#define ID0write write
+#define ID0uu_lock uu_lock
+#define ID0uu_lock_txfr uu_lock_txfr
+#define ID0uu_unlock uu_unlock
+#define ID0login(u) \
+ do { \
+ if (logout((u)->ut_line)) \
+ logwtmp((u)->ut_line, "", ""); \
+ login(u); \
+ } while (0)
+#define ID0logout(dev, no) \
+ do { \
+ struct utmp ut; \
+ strncpy(ut.ut_line, dev, sizeof ut.ut_line - 1); \
+ ut.ut_line[sizeof ut.ut_line - 1] = '\0'; \
+ if (no || logout(ut.ut_line)) \
+ logwtmp(ut.ut_line, "", ""); \
+ } while (0)
+#define ID0bind_un(s, n) bind(s, (const struct sockaddr *)(n), sizeof *(n))
+#define ID0connect_un(s, n) \
+ connect(s, (const struct sockaddr *)(n), sizeof *(n))
+#define ID0kill kill
+#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
+#define ID0kldload kldload
+#endif
+#ifndef NONETGRAPH
+#define ID0NgMkSockNode NgMkSockNode
+#endif
+#endif
OpenPOWER on IntegriCloud