Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ autoreconf -v -f --install || exit 1
--disable-shared \
--without-libpam \
--with-selinux \
--enable-fcaps=auto \
"$@"
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,24 @@ if test "$enable_subids" != "no"; then
fi
AM_CONDITIONAL(ENABLE_SUBIDS, test "x$enable_subids" != "xno")

AC_ARG_ENABLE(fcaps,
[AC_HELP_STRING([--enable-fcaps],
[use file capabilities for newuidmap@<:@default=yes@:>@])],
[enable_fcaps="${enableval}"],
[enable_fcaps="maybe"]
)

if test "$enable_fcaps" != "no"; then
AC_CHECK_PROGS(capcmd, "setcap")
if test "x$capcmd" = "x" ; then
if test "x$enable_fcaps" = "xyes" ; then
AC_MSG_ERROR([setcap command not available])
fi
enable_fcaps="no"
fi
fi
AM_CONDITIONAL(ENABLE_FCAPS, test "x$enable_fcaps" != "xno")

AC_SUBST(LIBCRYPT)
AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
[AC_MSG_ERROR([crypt() not found])])
Expand Down
8 changes: 8 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ usbin_PROGRAMS = \
# id and groups are from gnu, sulogin from sysvinit
noinst_PROGRAMS = id sulogin

fcapubins =
suidbins = su
suidubins = chage chfn chsh expiry gpasswd newgrp
if !WITH_TCB
Expand All @@ -61,8 +62,12 @@ if ACCT_TOOLS_SETUID
suidubins += chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod
endif
if ENABLE_SUBIDS
if ENABLE_FCAPS
fcapubins += newgidmap newuidmap
else
suidubins += newgidmap newuidmap
endif
endif

if WITH_TCB
shadowsgidubins = passwd
Expand Down Expand Up @@ -129,6 +134,9 @@ install-am: all-am
for i in $(suidbins); do \
chmod $(suidperms) $(DESTDIR)$(bindir)/$$i; \
done
for i in $(fcapubins); do \
setcap cap_setuid,cap_setgid=pe $(DESTDIR)$(ubindir)/$$i; \
done
for i in $(suidubins); do \
chmod $(suidperms) $(DESTDIR)$(ubindir)/$$i; \
done
Expand Down