From c27dfe617a53d351d51eb3d0e92391eae009ab31 Mon Sep 17 00:00:00 2001 From: Peter Vrabec Date: Thu, 6 Jan 2011 10:28:41 +0100 Subject: [PATCH 1/3] fix Bug #665780 - fix gshadow functions from shadow utils - make shadow utils use gshadow functions from glibc --- shadow-4.1.4.2-gshadow.patch | 49 ++++++++++++++++++++++++++++++++++++ shadow-utils.spec | 9 ++++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 shadow-4.1.4.2-gshadow.patch diff --git a/shadow-4.1.4.2-gshadow.patch b/shadow-4.1.4.2-gshadow.patch new file mode 100644 index 0000000..6e4e911 --- /dev/null +++ b/shadow-4.1.4.2-gshadow.patch @@ -0,0 +1,49 @@ +diff -up shadow-4.1.4.2/configure.gshadow shadow-4.1.4.2/configure +--- shadow-4.1.4.2/configure.gshadow 2011-01-05 16:29:33.355695459 +0100 ++++ shadow-4.1.4.2/configure 2011-01-05 16:29:58.322687480 +0100 +@@ -18220,7 +18220,7 @@ cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + +- #include ++ #include + main() + { + struct sgrp *sg = sgetsgent("test:x::"); +diff -up shadow-4.1.4.2/lib/defines.h.gshadow shadow-4.1.4.2/lib/defines.h +--- shadow-4.1.4.2/lib/defines.h.gshadow 2011-01-05 16:29:21.914687787 +0100 ++++ shadow-4.1.4.2/lib/defines.h 2011-01-05 16:29:58.323739225 +0100 +@@ -134,6 +134,10 @@ char *strchr (), *strrchr (), *strtok () + * - /usr/include/shadow.h exists, but we use our own gshadow.h. + */ + #include ++#if defined(HAVE_SHADOWGRP) ++#include ++#define sg_name sg_namp ++#endif + #if defined(SHADOWGRP) && !defined(GSHADOW) + #include "gshadow_.h" + #endif +diff -up shadow-4.1.4.2/lib/gshadow.c.gshadow shadow-4.1.4.2/lib/gshadow.c +--- shadow-4.1.4.2/lib/gshadow.c.gshadow 2009-06-12 19:50:23.000000000 +0200 ++++ shadow-4.1.4.2/lib/gshadow.c 2011-01-05 16:28:55.207685148 +0100 +@@ -223,6 +223,7 @@ void endsgent (void) + if (NULL == buf) { + return NULL; + } ++ buflen = BUFSIZ; + } + + if (NULL == fp) { +@@ -230,9 +231,9 @@ void endsgent (void) + } + + #ifdef USE_NIS +- while (fgetsx (buf, (int) sizeof buf, fp) == buf) ++ while (fgetsx (buf, (int) buflen, fp) == buf) + #else +- if (fgetsx (buf, (int) sizeof buf, fp) == buf) ++ if (fgetsx (buf, (int) buflen, fp) == buf) + #endif + { + while ( ((cp = strrchr (buf, '\n')) == NULL) diff --git a/shadow-utils.spec b/shadow-utils.spec index a09e6d8..1afc5c5 100644 --- a/shadow-utils.spec +++ b/shadow-utils.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing accounts and shadow password files Name: shadow-utils Version: 4.1.4.2 -Release: 8%{?dist} +Release: 9%{?dist} Epoch: 2 URL: http://pkg-shadow.alioth.debian.org/ Source0: ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-%{version}.tar.bz2 @@ -16,6 +16,7 @@ Patch5: shadow-4.1.4.2-semange.patch Patch6: shadow-4.1.4.2-acl.patch Patch7: shadow-4.1.4.2-underflow.patch Patch8: shadow-4.1.4.2-uflg.patch +Patch9: shadow-4.1.4.2-gshadow.patch License: BSD and GPLv2+ Group: System Environment/Base BuildRequires: libselinux-devel >= 1.25.2-1 @@ -50,6 +51,7 @@ are used for managing group accounts. %patch6 -p1 -b .acl %patch7 -p1 -b .underflow %patch8 -p1 -b .uflg +%patch9 -p1 -b .gshadow iconv -f ISO88591 -t utf-8 doc/HOWTO > doc/HOWTO.utf8 cp -f doc/HOWTO.utf8 doc/HOWTO @@ -192,6 +194,11 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/vigr.8* %changelog +* Wed Jan 05 2011 Peter Vrabec - 2:4.1.4.2-9 +- fix gshadow functions from shadow utils +- make shadow utils use gshadow functions from glibc + Resolves: #665780 + * Tue Jul 20 2010 Peter Vrabec - 2:4.1.4.2-8 - fix pwck/grpck hang Resolves: #586322 From eedd174dca3f877d8d5d1a5739553bf10c64d7e5 Mon Sep 17 00:00:00 2001 From: Peter Vrabec Date: Tue, 1 Feb 2011 17:16:10 +0100 Subject: [PATCH 2/3] do not use gshadow functions from glibc (#674234) --- shadow-4.1.4.2-gshadow.patch | 26 -------------------------- shadow-utils.spec | 7 ++++++- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/shadow-4.1.4.2-gshadow.patch b/shadow-4.1.4.2-gshadow.patch index 6e4e911..1cf5ba6 100644 --- a/shadow-4.1.4.2-gshadow.patch +++ b/shadow-4.1.4.2-gshadow.patch @@ -1,29 +1,3 @@ -diff -up shadow-4.1.4.2/configure.gshadow shadow-4.1.4.2/configure ---- shadow-4.1.4.2/configure.gshadow 2011-01-05 16:29:33.355695459 +0100 -+++ shadow-4.1.4.2/configure 2011-01-05 16:29:58.322687480 +0100 -@@ -18220,7 +18220,7 @@ cat confdefs.h >>conftest.$ac_ext - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - -- #include -+ #include - main() - { - struct sgrp *sg = sgetsgent("test:x::"); -diff -up shadow-4.1.4.2/lib/defines.h.gshadow shadow-4.1.4.2/lib/defines.h ---- shadow-4.1.4.2/lib/defines.h.gshadow 2011-01-05 16:29:21.914687787 +0100 -+++ shadow-4.1.4.2/lib/defines.h 2011-01-05 16:29:58.323739225 +0100 -@@ -134,6 +134,10 @@ char *strchr (), *strrchr (), *strtok () - * - /usr/include/shadow.h exists, but we use our own gshadow.h. - */ - #include -+#if defined(HAVE_SHADOWGRP) -+#include -+#define sg_name sg_namp -+#endif - #if defined(SHADOWGRP) && !defined(GSHADOW) - #include "gshadow_.h" - #endif diff -up shadow-4.1.4.2/lib/gshadow.c.gshadow shadow-4.1.4.2/lib/gshadow.c --- shadow-4.1.4.2/lib/gshadow.c.gshadow 2009-06-12 19:50:23.000000000 +0200 +++ shadow-4.1.4.2/lib/gshadow.c 2011-01-05 16:28:55.207685148 +0100 diff --git a/shadow-utils.spec b/shadow-utils.spec index 1afc5c5..bc9b61f 100644 --- a/shadow-utils.spec +++ b/shadow-utils.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing accounts and shadow password files Name: shadow-utils Version: 4.1.4.2 -Release: 9%{?dist} +Release: 10%{?dist} Epoch: 2 URL: http://pkg-shadow.alioth.debian.org/ Source0: ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-%{version}.tar.bz2 @@ -194,6 +194,11 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/vigr.8* %changelog +* Tue Feb 01 2011 Peter Vrabec - 2:4.1.4.2-10 +- do not use gshadow functions from glibc, there is a bug + in glibc sgetsgent(#674361) + Resolves: #674234 + * Wed Jan 05 2011 Peter Vrabec - 2:4.1.4.2-9 - fix gshadow functions from shadow utils - make shadow utils use gshadow functions from glibc From 7b0edc2c1bfaedd7a9abaaafbb3b3b531ff93a30 Mon Sep 17 00:00:00 2001 From: Peter Vrabec Date: Thu, 10 Feb 2011 11:39:31 +0100 Subject: [PATCH 3/3] - useradd man page (-m option) - create home directory on fs with noacl --- shadow-4.1.4.2-acl.patch | 58 ++++++++++++++++++++++++++++--------- shadow-4.1.4.2-redhat.patch | 18 ++++++++++-- shadow-utils.spec | 7 ++++- 3 files changed, 65 insertions(+), 18 deletions(-) diff --git a/shadow-4.1.4.2-acl.patch b/shadow-4.1.4.2-acl.patch index 9af543c..0071c31 100644 --- a/shadow-4.1.4.2-acl.patch +++ b/shadow-4.1.4.2-acl.patch @@ -1,6 +1,6 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c ---- shadow-4.1.4.2/libmisc/copydir.c.acl 2010-04-29 15:55:26.949959971 +0200 -+++ shadow-4.1.4.2/libmisc/copydir.c 2010-04-29 15:55:26.956960471 +0200 +--- shadow-4.1.4.2/libmisc/copydir.c.acl 2011-02-09 17:35:23.455413575 +0100 ++++ shadow-4.1.4.2/libmisc/copydir.c 2011-02-09 17:49:17.606330202 +0100 @@ -45,6 +45,9 @@ #ifdef WITH_SELINUX #include @@ -20,7 +20,7 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c const struct stat *statp, const struct timeval mt[], long int uid, long int gid); static int copy_file (const char *src, const char *dst, -@@ -78,6 +81,24 @@ static int copy_file (const char *src, c +@@ -78,6 +81,28 @@ static int copy_file (const char *src, c long int uid, long int gid); #ifdef WITH_SELINUX @@ -28,6 +28,10 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c +void error (struct error_context *ctx, const char *fmt, ...) +{ + va_list ap; ++ ++ /* ignore the case when destination does not support ACLs */ ++ if(errno==EOPNOTSUPP) ++ return; + + va_start (ap, fmt); + (void) fprintf (stderr, _("%s: "), Prog); @@ -45,7 +49,7 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c /* * selinux_file_context - Set the security context before any file or * directory creation. -@@ -369,7 +390,7 @@ static int copy_entry (const char *src, +@@ -369,7 +394,7 @@ static int copy_entry (const char *src, */ else if (!S_ISREG (sb.st_mode)) { @@ -54,15 +58,30 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c } /* -@@ -413,6 +434,7 @@ static int copy_dir (const char *src, co +@@ -413,8 +438,20 @@ static int copy_dir (const char *src, co || (chown (dst, (uid == - 1) ? statp->st_uid : (uid_t) uid, (gid == - 1) ? statp->st_gid : (gid_t) gid) != 0) -+ || (perm_copy_file (src, dst, &ctx) != 0) - || (chmod (dst, statp->st_mode) != 0) - || (copy_tree (src, dst, uid, gid) != 0) +- || (chmod (dst, statp->st_mode) != 0) +- || (copy_tree (src, dst, uid, gid) != 0) ++ || (chmod (dst, statp->st_mode) != 0)) { ++ err = -1; ++ return err; ++ } ++ ++ /* ignore the case when destination does not support ACLs */ ++ if (perm_copy_file (src, dst, &ctx) != 0) { ++ if (errno!=EOPNOTSUPP) { ++ err = -1; ++ return err; ++ } ++ } ++ ++ if ((copy_tree (src, dst, uid, gid) != 0) || (utimes (dst, mt) != 0)) { -@@ -514,6 +536,13 @@ static int copy_symlink (const char *src + err = -1; + } +@@ -514,6 +551,13 @@ static int copy_symlink (const char *src || (lchown (dst, (uid == -1) ? statp->st_uid : (uid_t) uid, (gid == -1) ? statp->st_gid : (gid_t) gid) != 0)) { @@ -76,7 +95,7 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c free (oldlink); return -1; } -@@ -542,7 +571,7 @@ static int copy_symlink (const char *src +@@ -542,7 +586,7 @@ static int copy_symlink (const char *src static int copy_hardlink (const char *src, const char *dst, struct link_name *lp) { @@ -85,7 +104,7 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c if (link (lp->ln_name, dst) != 0) { return -1; -@@ -574,7 +603,7 @@ static int copy_hardlink (const char *sr +@@ -574,7 +618,7 @@ static int copy_hardlink (const char *sr * * Return 0 on success, -1 on error. */ @@ -94,18 +113,29 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c const struct stat *statp, const struct timeval mt[], long int uid, long int gid) { -@@ -628,7 +657,7 @@ static int copy_file (const char *src, c +@@ -628,11 +672,18 @@ static int copy_file (const char *src, c || (fchown (ofd, (uid == -1) ? statp->st_uid : (uid_t) uid, (gid == -1) ? statp->st_gid : (gid_t) gid) != 0) - || (fchmod (ofd, statp->st_mode & 07777) != 0)) { -+ || (perm_copy_fd (src, ifd, dst, ofd, &ctx) != 0) ) { ++ || (fchmod (ofd, statp->st_mode & 07777) != 0)) { (void) close (ifd); return -1; } + ++ if (perm_copy_fd (src, ifd, dst, ofd, &ctx) != 0) { ++ if (errno!=EOPNOTSUPP) { ++ (void) close (ifd); ++ return -1; ++ } ++ } ++ + while ((cnt = read (ifd, buf, sizeof buf)) > 0) { + if (write (ofd, buf, (size_t)cnt) != cnt) { + return -1; diff -up shadow-4.1.4.2/src/Makefile.in.acl shadow-4.1.4.2/src/Makefile.in --- shadow-4.1.4.2/src/Makefile.in.acl 2009-07-24 03:16:00.000000000 +0200 -+++ shadow-4.1.4.2/src/Makefile.in 2010-04-29 16:08:34.347960372 +0200 ++++ shadow-4.1.4.2/src/Makefile.in 2011-02-09 17:35:23.470411800 +0100 @@ -430,9 +430,9 @@ su_SOURCES = \ su_LDADD = $(LDADD) $(LIBPAM) $(LIBCRYPT_NOPAM) $(LIBSKEY) $(LIBMD) diff --git a/shadow-4.1.4.2-redhat.patch b/shadow-4.1.4.2-redhat.patch index 2b9e334..da39e65 100644 --- a/shadow-4.1.4.2-redhat.patch +++ b/shadow-4.1.4.2-redhat.patch @@ -1,6 +1,6 @@ diff -up shadow-4.1.4.2/libmisc/find_new_gid.c.redhat shadow-4.1.4.2/libmisc/find_new_gid.c --- shadow-4.1.4.2/libmisc/find_new_gid.c.redhat 2009-07-18 01:53:42.000000000 +0200 -+++ shadow-4.1.4.2/libmisc/find_new_gid.c 2009-09-07 16:34:26.640814090 +0200 ++++ shadow-4.1.4.2/libmisc/find_new_gid.c 2011-02-09 11:04:06.009400412 +0100 @@ -58,11 +58,11 @@ int find_new_gid (bool sys_group, assert (gid != NULL); @@ -18,7 +18,7 @@ diff -up shadow-4.1.4.2/libmisc/find_new_gid.c.redhat shadow-4.1.4.2/libmisc/fin used_gids = alloca (sizeof (bool) * (gid_max +1)); diff -up shadow-4.1.4.2/libmisc/find_new_uid.c.redhat shadow-4.1.4.2/libmisc/find_new_uid.c --- shadow-4.1.4.2/libmisc/find_new_uid.c.redhat 2009-07-18 01:53:43.000000000 +0200 -+++ shadow-4.1.4.2/libmisc/find_new_uid.c 2009-09-07 16:34:19.695877000 +0200 ++++ shadow-4.1.4.2/libmisc/find_new_uid.c 2011-02-09 11:04:06.009400412 +0100 @@ -58,11 +58,11 @@ int find_new_uid (bool sys_user, assert (uid != NULL); @@ -34,9 +34,21 @@ diff -up shadow-4.1.4.2/libmisc/find_new_uid.c.redhat shadow-4.1.4.2/libmisc/fin uid_max = (uid_t) getdef_ulong ("SYS_UID_MAX", (unsigned long) uid_max); } used_uids = alloca (sizeof (bool) * (uid_max +1)); +diff -up shadow-4.1.4.2/man/useradd.8.redhat shadow-4.1.4.2/man/useradd.8 +--- shadow-4.1.4.2/man/useradd.8.redhat 2009-07-24 03:16:44.000000000 +0200 ++++ shadow-4.1.4.2/man/useradd.8 2011-02-09 11:04:24.851151246 +0100 +@@ -211,7 +211,7 @@ Create the user\'s home directory if it + \fB\-k\fR + option) will be copied to the home directory\&. + .sp +-By default, no home directories are created\&. ++The home directories are created by default on RHEL/Fedora systems because of /etc/login.defs (\fBCREATE_HOME\fR) setting\&. + .RE + .PP + \fB\-M\fR diff -up shadow-4.1.4.2/src/useradd.c.redhat shadow-4.1.4.2/src/useradd.c --- shadow-4.1.4.2/src/useradd.c.redhat 2009-06-06 00:16:58.000000000 +0200 -+++ shadow-4.1.4.2/src/useradd.c 2009-09-07 16:34:01.402878101 +0200 ++++ shadow-4.1.4.2/src/useradd.c 2011-02-09 11:04:06.031036886 +0100 @@ -90,7 +90,7 @@ char *Prog; static gid_t def_group = 100; static const char *def_gname = "other"; diff --git a/shadow-utils.spec b/shadow-utils.spec index bc9b61f..a04e5f2 100644 --- a/shadow-utils.spec +++ b/shadow-utils.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing accounts and shadow password files Name: shadow-utils Version: 4.1.4.2 -Release: 10%{?dist} +Release: 11%{?dist} Epoch: 2 URL: http://pkg-shadow.alioth.debian.org/ Source0: ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-%{version}.tar.bz2 @@ -194,6 +194,11 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/vigr.8* %changelog +* Thu Feb 10 2011 Peter Vrabec - 2:4.1.4.2-11 +- useradd man page (-m option) +- create home directory on fs with noacl + Resolves: #523265, #622320 + * Tue Feb 01 2011 Peter Vrabec - 2:4.1.4.2-10 - do not use gshadow functions from glibc, there is a bug in glibc sgetsgent(#674361)