From 7b0edc2c1bfaedd7a9abaaafbb3b3b531ff93a30 Mon Sep 17 00:00:00 2001 From: Peter Vrabec Date: Thu, 10 Feb 2011 11:39:31 +0100 Subject: [PATCH] - 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)