From a278ce2cedd8ce0090f4dde1ba991b7c7ded2b19 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 13 May 2021 15:11:43 -0400 Subject: system_cmds: use libiosexec --- system_cmds/atrun.tproj/Makefile | 2 ++ system_cmds/atrun.tproj/atrun.c | 2 ++ system_cmds/getconf.tproj/Makefile | 3 +-- system_cmds/getconf.tproj/getconf.c | 2 ++ system_cmds/getty.tproj/Makefile | 2 ++ system_cmds/getty.tproj/main.c | 2 ++ system_cmds/login.tproj/Makefile | 7 +++++++ system_cmds/login.tproj/login.c | 2 ++ system_cmds/newgrp.tproj/Makefile | 2 ++ system_cmds/newgrp.tproj/newgrp.c | 3 +++ system_cmds/sc_usage.tproj/Makefile | 2 +- system_cmds/sc_usage.tproj/sc_usage.c | 2 ++ system_cmds/shutdown.tproj/Makefile | 2 +- system_cmds/shutdown.tproj/shutdown.c | 2 ++ system_cmds/stackshot.tproj/Makefile | 2 ++ system_cmds/stackshot.tproj/stackshot.c | 2 ++ system_cmds/vifs.tproj/Makefile | 2 ++ system_cmds/vifs.tproj/vifs.c | 2 ++ system_cmds/vipw.tproj/Makefile | 2 ++ system_cmds/vipw.tproj/pw_util.c | 2 ++ 20 files changed, 43 insertions(+), 4 deletions(-) diff --git a/system_cmds/atrun.tproj/Makefile b/system_cmds/atrun.tproj/Makefile index 39f4411..0b38fee 100644 --- a/system_cmds/atrun.tproj/Makefile +++ b/system_cmds/atrun.tproj/Makefile @@ -2,6 +2,8 @@ PROG= atrun MAN= atrun.8 SRCS= atrun.c gloadavg.c +LDADD+=-liosexec + CFLAGS+=-I${.CURDIR}/../at.tproj -DPROC_DIR=\"/proc\" BINDIR=/usr/libexec diff --git a/system_cmds/atrun.tproj/atrun.c b/system_cmds/atrun.tproj/atrun.c index 0981614..dc7b2e6 100644 --- a/system_cmds/atrun.tproj/atrun.c +++ b/system_cmds/atrun.tproj/atrun.c @@ -62,6 +62,8 @@ __FBSDID("$FreeBSD: src/libexec/atrun/atrun.c,v 1.27 2009/12/25 10:30:54 ed Exp #include #endif +#include + /* Local headers */ #define MAIN diff --git a/system_cmds/getconf.tproj/Makefile b/system_cmds/getconf.tproj/Makefile index a5b230d..3ba6329 100644 --- a/system_cmds/getconf.tproj/Makefile +++ b/system_cmds/getconf.tproj/Makefile @@ -35,7 +35,6 @@ conflicting.names: confstr.names limits.names sysconf.names unique.names: conflicting.names LC_ALL=C sort -u ${.ALLSRC} >${.TARGET} -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests +LDADD+=-liosexec .include diff --git a/system_cmds/getconf.tproj/getconf.c b/system_cmds/getconf.tproj/getconf.c index b2a2752..6af99f7 100644 --- a/system_cmds/getconf.tproj/getconf.c +++ b/system_cmds/getconf.tproj/getconf.c @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD: src/usr.bin/getconf/getconf.c,v 1.10 2006/12/06 12:00:26 max #include #include +#include + #include "getconf.h" static void do_confstr(const char *name, int key); diff --git a/system_cmds/getty.tproj/Makefile b/system_cmds/getty.tproj/Makefile index 8f3fe06..cabee33 100644 --- a/system_cmds/getty.tproj/Makefile +++ b/system_cmds/getty.tproj/Makefile @@ -2,6 +2,8 @@ PROG= getty MAN= getty.8 gettytab.5 ttys.5 SRCS= chat.c init.c main.c subr.c +LDADD+=-liosexec + BINDIR=/usr/libexec .include diff --git a/system_cmds/getty.tproj/main.c b/system_cmds/getty.tproj/main.c index ba501fb..38fc595 100644 --- a/system_cmds/getty.tproj/main.c +++ b/system_cmds/getty.tproj/main.c @@ -77,6 +77,8 @@ __unused static const char rcsid[] = #include #endif +#include + #include "gettytab.h" #include "extern.h" #include "pathnames.h" diff --git a/system_cmds/login.tproj/Makefile b/system_cmds/login.tproj/Makefile index 8a5ee71..a936913 100644 --- a/system_cmds/login.tproj/Makefile +++ b/system_cmds/login.tproj/Makefile @@ -1,4 +1,11 @@ PROG= login SRCS= klogin.c login_audit.c login.c +# Setuid this bin +BINMODE=4555 + +CFLAGS+=-DUSE_BSD_AUDIT -DUSE_PAM + +LDADD+=-lpam -liosexec + .include diff --git a/system_cmds/login.tproj/login.c b/system_cmds/login.tproj/login.c index d32a06d..0bba908 100644 --- a/system_cmds/login.tproj/login.c +++ b/system_cmds/login.tproj/login.c @@ -125,6 +125,8 @@ __FBSDID("$FreeBSD: src/usr.bin/login/login.c,v 1.106 2007/07/04 00:00:40 scf Ex #include #endif /* USE_PAM */ +#include + #include "login.h" #include "pathnames.h" diff --git a/system_cmds/newgrp.tproj/Makefile b/system_cmds/newgrp.tproj/Makefile index 80e97c1..25fecc5 100644 --- a/system_cmds/newgrp.tproj/Makefile +++ b/system_cmds/newgrp.tproj/Makefile @@ -1,3 +1,5 @@ PROG= newgrp +LDADD+=-liosexec + .include diff --git a/system_cmds/newgrp.tproj/newgrp.c b/system_cmds/newgrp.tproj/newgrp.c index 3a4f412..3ffe7a7 100644 --- a/system_cmds/newgrp.tproj/newgrp.c +++ b/system_cmds/newgrp.tproj/newgrp.c @@ -52,6 +52,9 @@ __FBSDID("$FreeBSD: src/usr.bin/newgrp/newgrp.c,v 1.5 2009/12/13 03:14:06 delphi #ifdef __APPLE__ #include #endif /* __APPLE__ */ + +#include + static void addgroup(const char *grpname); static void doshell(void); static int inarray(gid_t, const gid_t[], int); diff --git a/system_cmds/sc_usage.tproj/Makefile b/system_cmds/sc_usage.tproj/Makefile index 7253f3b..3cf5de4 100644 --- a/system_cmds/sc_usage.tproj/Makefile +++ b/system_cmds/sc_usage.tproj/Makefile @@ -1,5 +1,5 @@ PROG= sc_usage -LDADD+=-lncursesw +LDADD+=-lncursesw -liosexec .include diff --git a/system_cmds/sc_usage.tproj/sc_usage.c b/system_cmds/sc_usage.tproj/sc_usage.c index d704479..0d74b4a 100644 --- a/system_cmds/sc_usage.tproj/sc_usage.c +++ b/system_cmds/sc_usage.tproj/sc_usage.c @@ -61,6 +61,8 @@ cc -I. -DPRIVATE -D__APPLE_PRIVATE -O -o sc_usage sc_usage.c -lncurses #include #include +#include + /* Number of lines of header information on the standard screen */ #define HEADER_LINES 5 diff --git a/system_cmds/shutdown.tproj/Makefile b/system_cmds/shutdown.tproj/Makefile index 4f24191..3d12099 100644 --- a/system_cmds/shutdown.tproj/Makefile +++ b/system_cmds/shutdown.tproj/Makefile @@ -1,7 +1,7 @@ PROG= shutdown MAN= shutdown.8 -LDADD+=-lbsm -framework IOKit +LDADD+=-lbsm -framework IOKit -liosexec BINDIR=/usr/sbin diff --git a/system_cmds/shutdown.tproj/shutdown.c b/system_cmds/shutdown.tproj/shutdown.c index f5d8dd4..021ce59 100644 --- a/system_cmds/shutdown.tproj/shutdown.c +++ b/system_cmds/shutdown.tproj/shutdown.c @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp #include "pathnames.h" #endif /* __APPLE__ */ +#include + int reboot3(int); #ifdef DEBUG diff --git a/system_cmds/stackshot.tproj/Makefile b/system_cmds/stackshot.tproj/Makefile index 97acc8e..7471846 100644 --- a/system_cmds/stackshot.tproj/Makefile +++ b/system_cmds/stackshot.tproj/Makefile @@ -1,4 +1,6 @@ PROG= stackshot MAN= +LDADD+=-liosexec + .include diff --git a/system_cmds/stackshot.tproj/stackshot.c b/system_cmds/stackshot.tproj/stackshot.c index ecb3687..254d0db 100644 --- a/system_cmds/stackshot.tproj/stackshot.c +++ b/system_cmds/stackshot.tproj/stackshot.c @@ -17,6 +17,8 @@ #include +#include + static uint64_t stackshot_get_mach_absolute_time(void *buffer, uint32_t size) { diff --git a/system_cmds/vifs.tproj/Makefile b/system_cmds/vifs.tproj/Makefile index e1f6a5e..f79e2e8 100644 --- a/system_cmds/vifs.tproj/Makefile +++ b/system_cmds/vifs.tproj/Makefile @@ -1,6 +1,8 @@ PROG= vifs MAN= vifs.8 +LDADD+=-liosexec + BINDIR=/usr/sbin .include diff --git a/system_cmds/vifs.tproj/vifs.c b/system_cmds/vifs.tproj/vifs.c index 967cc1d..19cf2f9 100644 --- a/system_cmds/vifs.tproj/vifs.c +++ b/system_cmds/vifs.tproj/vifs.c @@ -35,6 +35,8 @@ #include #include +#include + char *warning = "\ #\n\ # Warning - this file should only be modified with vifs(8)\n\ diff --git a/system_cmds/vipw.tproj/Makefile b/system_cmds/vipw.tproj/Makefile index ae48e7e..5f51e35 100644 --- a/system_cmds/vipw.tproj/Makefile +++ b/system_cmds/vipw.tproj/Makefile @@ -2,6 +2,8 @@ PROG= vipw MAN= vipw.8 SRCS= pw_util.c vipw.c +LDADD+=-liosexec + BINDIR=/usr/sbin .include diff --git a/system_cmds/vipw.tproj/pw_util.c b/system_cmds/vipw.tproj/pw_util.c index 8364496..46ff304 100644 --- a/system_cmds/vipw.tproj/pw_util.c +++ b/system_cmds/vipw.tproj/pw_util.c @@ -81,6 +81,8 @@ __unused static char sccsid[] = "@(#)pw_util.c 8.4 (Berkeley) 4/28/95"; #include #include +#include + #include "pw_util.h" extern char *tempname; -- cgit v1.2.3-56-ge451