From 06bcee19a248efe225d744a09a44638c07685bef Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Apr 2007 11:44:19 +0200 Subject: [PATCH] build-sys: add SUID_CFLAGS The patch allows to define special CFLAGS for typical suid programs (like mount, umount, chfn, ...). Some distributions use for example "-fpic" for suid binaries. Signed-off-by: Karel Zak --- README | 12 ++++++++++++ configure.ac | 3 +++ login-utils/Makefile.am | 4 ++++ misc-utils/Makefile.am | 1 + mount/Makefile.am | 2 ++ 5 files changed, 22 insertions(+) diff --git a/README b/README index 9b3cdea6..ff49b3e6 100644 --- a/README +++ b/README @@ -48,3 +48,15 @@ VERSION SCHEMA: suffix = "devel" or "rc" +COMPILATION: + + See the INSTALL file for more details. + + Notes: + * use SUID_CFLAGS when you want to define special compiler options + for typical suid programs, for example: + + SUID_CFLAGS="-fpic" ./configure + + Now this feature is supported for chfn, chsh, newgrp, write, + mount and umount. diff --git a/configure.ac b/configure.ac index 66e88df8..d24ce099 100644 --- a/configure.ac +++ b/configure.ac @@ -398,6 +398,9 @@ if test x$enable_use_tty_group = xyes; then AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?]) fi + +AC_SUBST([SUID_CFLAGS]) + CPPFLAGS="-fsigned-char -fomit-frame-pointer $CPPFLAGS" LIBS="" diff --git a/login-utils/Makefile.am b/login-utils/Makefile.am index 404b7987..74aa29ea 100644 --- a/login-utils/Makefile.am +++ b/login-utils/Makefile.am @@ -51,6 +51,10 @@ login_LDADD = ../lib/libsetproctitle.a newgrp_LDADD = vipw_LDADD = +chfn_CFLAGS = $(SUID_CFLAGS) +chsh_CFLAGS = $(SUID_CFLAGS) +newgrp_CFLAGS = $(SUID_CFLAGS) + if NEED_LIBCRYPT chfn_LDADD += -lcrypt chsh_LDADD += -lcrypt diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index 5ccb76da..461344d1 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -64,6 +64,7 @@ if BUILD_WRITE usrbinexec_PROGRAMS += write man_MANS += write.1 +write_CFLAGS = $(SUID_CFLAGS) if USE_TTY_GROUP install-exec-hook:: diff --git a/mount/Makefile.am b/mount/Makefile.am index f34fc83b..6f0d403d 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -22,6 +22,7 @@ mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ $(MNTHDRS) mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a +mount_CFLAGS = $(SUID_CFLAGS) umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c \ @@ -29,6 +30,7 @@ umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c $(MNTHDRS) umount_LDADD = $(top_srcdir)/lib/libenv.a +umount_CFLAGS = $(SUID_CFLAGS) swapon_SOURCES = swapon.c xmalloc.c \ get_label_uuid.c mount_by_label.c mount_blkid.c \ -- 2.39.5