Adapt userns patches to 4.2.0 (hopefully)

This commit is contained in:
Christian Perrier
2014-03-14 21:51:03 +01:00
parent bbfcca9015
commit 68fb7adaf7
2 changed files with 47 additions and 59 deletions

View File

@@ -1,8 +1,8 @@
=== modified file 'etc/login.defs'
Index: shadow/etc/login.defs
Index: git/etc/login.defs
===================================================================
--- shadow.orig/etc/login.defs 2014-02-16 19:31:38.934898148 -0500
+++ shadow/etc/login.defs 2014-02-16 19:31:38.926898149 -0500
--- git.orig/etc/login.defs
+++ git/etc/login.defs
@@ -229,7 +229,7 @@
# Extra per user uids
SUB_UID_MIN 100000
@@ -11,7 +11,7 @@ Index: shadow/etc/login.defs
+SUB_UID_COUNT 65536
#
# Min/max values for automatic gid selection in groupadd
# Min/max values for automatic gid selection in groupadd(8)
@@ -242,7 +242,7 @@
# Extra per user group ids
SUB_GID_MIN 100000
@@ -20,27 +20,27 @@ Index: shadow/etc/login.defs
+SUB_GID_COUNT 65536
#
# Max number of login retries if password is bad
Index: shadow/src/newusers.c
# Max number of login(1) retries if password is bad
Index: git/src/newusers.c
===================================================================
--- shadow.orig/src/newusers.c 2014-02-16 19:31:38.934898148 -0500
+++ shadow/src/newusers.c 2014-02-16 19:31:38.926898149 -0500
@@ -946,8 +946,8 @@
#ifdef SHADOWGRP
--- git.orig/src/newusers.c
+++ git/src/newusers.c
@@ -988,8 +988,8 @@
is_shadow_grp = sgr_file_present ();
#endif
#ifdef ENABLE_SUBIDS
- is_sub_uid = sub_uid_file_present ();
- is_sub_gid = sub_gid_file_present ();
+ is_sub_uid = sub_uid_file_present () && !rflg;
+ is_sub_gid = sub_gid_file_present () && !rflg;
#endif /* ENABLE_SUBIDS */
open_files ();
Index: shadow/src/useradd.c
Index: git/src/useradd.c
===================================================================
--- shadow.orig/src/useradd.c 2014-02-16 19:31:38.934898148 -0500
+++ shadow/src/useradd.c 2014-02-16 19:31:38.926898149 -0500
@@ -1978,6 +1978,10 @@
--- git.orig/src/useradd.c
+++ git/src/useradd.c
@@ -1994,6 +1994,10 @@
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
@@ -51,55 +51,43 @@ Index: shadow/src/useradd.c
/*
* Get my name so that I can use it to report errors.
*/
@@ -2001,18 +2005,20 @@
*/
user_groups[0] = (char *) 0;
-
is_shadow_pwd = spw_file_present ();
#ifdef SHADOWGRP
@@ -2023,9 +2027,10 @@
is_shadow_grp = sgr_file_present ();
#endif
#ifdef ENABLE_SUBIDS
- is_sub_uid = sub_uid_file_present ();
- is_sub_gid = sub_gid_file_present ();
-
- get_defaults ();
process_flags (argc, argv);
-#endif /* ENABLE_SUBIDS */
+ is_sub_uid = sub_uid_file_present () && !rflg &&
+ (!user_id || (user_id <= uid_max && user_id >= uid_min));
+ is_sub_gid = sub_gid_file_present () && !rflg &&
+ (!user_id || (user_id <= uid_max && user_id >= uid_min));
+
+ get_defaults ();
+
#ifdef ACCT_TOOLS_SETUID
#ifdef USE_PAM
{
Index: shadow/libmisc/find_new_sub_uids.c
get_defaults ();
Index: git/libmisc/find_new_sub_uids.c
===================================================================
--- shadow.orig/libmisc/find_new_sub_uids.c 2014-02-16 19:31:38.934898148 -0500
+++ shadow/libmisc/find_new_sub_uids.c 2014-02-16 19:31:38.926898149 -0500
@@ -56,7 +56,7 @@
--- git.orig/libmisc/find_new_sub_uids.c
+++ git/libmisc/find_new_sub_uids.c
@@ -58,7 +58,7 @@
min = getdef_ulong ("SUB_UID_MIN", 100000UL);
max = getdef_ulong ("SUB_UID_MAX", 600100000UL);
- count = getdef_ulong ("SUB_UID_COUNT", 10000);
+ count = getdef_ulong ("SUB_UID_COUNT", 65536);
if (min >= max || count >= max || (min + count) >= max) {
if (min > max || count >= max || (min + count - 1) > max) {
(void) fprintf (stderr,
Index: shadow/libmisc/find_new_sub_gids.c
Index: git/libmisc/find_new_sub_gids.c
===================================================================
--- shadow.orig/libmisc/find_new_sub_gids.c 2014-02-16 19:32:21.298896382 -0500
+++ shadow/libmisc/find_new_sub_gids.c 2014-02-16 19:32:34.462895834 -0500
@@ -56,7 +56,7 @@
--- git.orig/libmisc/find_new_sub_gids.c
+++ git/libmisc/find_new_sub_gids.c
@@ -58,7 +58,7 @@
min = getdef_ulong ("SUB_GID_MIN", 100000UL);
max = getdef_ulong ("SUB_GID_MAX", 600100000UL);
- count = getdef_ulong ("SUB_GID_COUNT", 10000);
+ count = getdef_ulong ("SUB_GID_COUNT", 65536);
if (min >= max || count >= max || (min + count) >= max) {
if (min > max || count >= max || (min + count - 1) > max) {
(void) fprintf (stderr,

32
debian/patches/series vendored
View File

@@ -16,20 +16,20 @@
523_su_arguments_are_no_more_concatenated_by_default
508_nologin_in_usr_sbin
505_useradd_recommend_adduser
userns/01_userns_doc
userns/02_userns_doc_login.defs
userns/03_userns_implement_commonio_append
userns/04_userns_add_backend_support
userns/05_userns_implemend_find_new_sub_xids
userns/06_userns_userdel
userns/07_userns_useradd
userns/08_userns_detect_busy_subids
userns/09_userns_usermod
userns/10_userns_newusers
userns/11_userns_newxidmap
userns/12_userns_selinuxlibs
userns/13_subordinate_parse_static_buf
userns/14_fix_getopt
userns/manpagetypo
userns/16_add-argument-sanity-checking.patch
#userns/01_userns_doc
#userns/02_userns_doc_login.defs
#userns/03_userns_implement_commonio_append
#userns/04_userns_add_backend_support
#userns/05_userns_implemend_find_new_sub_xids
#userns/06_userns_userdel
#userns/07_userns_useradd
#userns/08_userns_detect_busy_subids
#userns/09_userns_usermod
#userns/10_userns_newusers
#userns/11_userns_newxidmap
#userns/12_userns_selinuxlibs
#userns/13_subordinate_parse_static_buf
#userns/14_fix_getopt
#userns/manpagetypo
#userns/16_add-argument-sanity-checking.patch
1000_configure_userns