[OpenWrt-Devel] [PATCH packages 1/2] shadow: use proper fix for checking subordinate IDs support

Rafał Miłecki zajec5 at gmail.com
Tue Nov 14 07:14:24 EST 2017


From: Rafał Miłecki <rafal at milecki.pl>

During 4.2.1 version update support for subordinate IDs has been
disabled. It was handled by:

1) Adding --disable-subordinate-ids to avoid:
configure: error: cannot run test program while cross compiling

2) Adding patch 003-fix-disabling-subids.patch to avoid:
usermod.c: In function 'process_flags':
usermod.c:1364:10: error: 'vflg' undeclared (first use in this function)
  if (   (vflg || Vflg)
          ^

This commit adds a patch with a proper configure.in fix. We don't need
to disable subordinate IDs anymore.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 utils/shadow/Makefile                              |  5 ++--
 ...-of-uid_t-and-gid_t-using-AC_CHECK_SIZEOF.patch | 35 ++++++++++++++++++++++
 .../shadow/patches/003-fix-disabling-subids.patch  | 32 --------------------
 .../patches/004-fix-su-controoling-term.patch      |  2 +-
 4 files changed, 38 insertions(+), 36 deletions(-)
 create mode 100644 utils/shadow/patches/003-Check-size-of-uid_t-and-gid_t-using-AC_CHECK_SIZEOF.patch
 delete mode 100644 utils/shadow/patches/003-fix-disabling-subids.patch

diff --git a/utils/shadow/Makefile b/utils/shadow/Makefile
index db9f7fb6..2cefe8b0 100644
--- a/utils/shadow/Makefile
+++ b/utils/shadow/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=shadow
 PKG_VERSION:=4.2.1
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://pkg-shadow.alioth.debian.org/releases
@@ -37,8 +37,7 @@ CONFIGURE_ARGS += \
 	--without-acl \
 	--without-attr \
 	--without-tcb \
-	--without-nscd \
-	--disable-subordinate-ids \
+	--without-nscd
 
 define Package/shadow/Default
   SECTION:=utils
diff --git a/utils/shadow/patches/003-Check-size-of-uid_t-and-gid_t-using-AC_CHECK_SIZEOF.patch b/utils/shadow/patches/003-Check-size-of-uid_t-and-gid_t-using-AC_CHECK_SIZEOF.patch
new file mode 100644
index 00000000..046523df
--- /dev/null
+++ b/utils/shadow/patches/003-Check-size-of-uid_t-and-gid_t-using-AC_CHECK_SIZEOF.patch
@@ -0,0 +1,35 @@
+From 2cb54158b80cdbd97ca3b36df83f9255e923ae3f Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi at aura-online.co.uk>
+Date: Sat, 23 Aug 2014 09:46:39 +0100
+Subject: [PATCH] Check size of uid_t and gid_t using AC_CHECK_SIZEOF
+
+This built-in check is simpler than the previous method and, most
+importantly, works when cross-compiling.
+
+Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
+---
+ configure.in | 14 ++++----------
+ 1 file changed, 4 insertions(+), 10 deletions(-)
+
+--- a/configure.in
++++ b/configure.in
+@@ -334,16 +334,10 @@ if test "$enable_subids" != "no"; then
+ 	dnl
+ 	dnl FIXME: check if 32 bit UIDs/GIDs are supported by libc
+ 	dnl
+-	AC_RUN_IFELSE([AC_LANG_SOURCE([
+-#include <sys/types.h>
+-int main(void) {
+-	uid_t u;
+-	gid_t g;
+-	return (sizeof u < 4) || (sizeof g < 4);
+-}
+-	])], [id32bit="yes"], [id32bit="no"])
++	AC_CHECK_SIZEOF([uid_t],, [#include "sys/types.h"])
++	AC_CHECK_SIZEOF([gid_t],, [#include "sys/types.h"])
+ 
+-	if test "x$id32bit" = "xyes"; then
++	if test "$ac_cv_sizeof_uid_t" -ge 4 && test "$ac_cv_sizeof_gid_t" -ge 4; then
+ 		AC_DEFINE(ENABLE_SUBIDS, 1, [Define to support the subordinate IDs.])
+ 		enable_subids="yes"
+ 	else
diff --git a/utils/shadow/patches/003-fix-disabling-subids.patch b/utils/shadow/patches/003-fix-disabling-subids.patch
deleted file mode 100644
index bbc65c7d..00000000
--- a/utils/shadow/patches/003-fix-disabling-subids.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/src/usermod.c
-+++ b/src/usermod.c
-@@ -1361,6 +1361,7 @@ static void process_flags (int argc, cha
- 		exit (E_UID_IN_USE);
- 	}
- 
-+#ifdef ENABLE_SUBIDS
- 	if (   (vflg || Vflg)
- 	    && !is_sub_uid) {
- 		fprintf (stderr,
-@@ -1376,6 +1377,7 @@ static void process_flags (int argc, cha
- 		         Prog, sub_gid_dbname (), "-w", "-W");
- 		exit (E_USAGE);
- 	}
-+#endif
- }
- 
- /*
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -52,7 +52,10 @@ usbin_PROGRAMS = \
- noinst_PROGRAMS = id sulogin
- 
- suidbins       = su
--suidubins      = chage chfn chsh expiry gpasswd newgrp passwd newuidmap newgidmap
-+suidubins      = chage chfn chsh expiry gpasswd newgrp passwd
-+if ENABLE_SUBIDS
-+	suidubins += newuidmap newgidmap
-+endif
- if ACCT_TOOLS_SETUID
- 	suidubins += chage chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod
- endif
diff --git a/utils/shadow/patches/004-fix-su-controoling-term.patch b/utils/shadow/patches/004-fix-su-controoling-term.patch
index 4c130c73..2f7a670b 100644
--- a/utils/shadow/patches/004-fix-su-controoling-term.patch
+++ b/utils/shadow/patches/004-fix-su-controoling-term.patch
@@ -1,6 +1,6 @@
 --- a/src/su.c
 +++ b/src/su.c
-@@ -1090,8 +1090,12 @@
+@@ -1090,8 +1090,12 @@ int main (int argc, char **argv)
  
  		if (fd >= 0) {
  			err = ioctl (fd, TIOCNOTTY, (char *) 0);
-- 
2.11.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list