- useradd man page (-m option)

- create home directory on fs with noacl
This commit is contained in:
Peter Vrabec 2011-02-10 11:39:31 +01:00
parent eedd174dca
commit 7b0edc2c1b
3 changed files with 65 additions and 18 deletions

View file

@ -1,6 +1,6 @@
diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c 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.acl 2011-02-09 17:35:23.455413575 +0100
+++ shadow-4.1.4.2/libmisc/copydir.c 2010-04-29 15:55:26.956960471 +0200 +++ shadow-4.1.4.2/libmisc/copydir.c 2011-02-09 17:49:17.606330202 +0100
@@ -45,6 +45,9 @@ @@ -45,6 +45,9 @@
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
@ -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[], const struct stat *statp, const struct timeval mt[],
long int uid, long int gid); long int uid, long int gid);
static int copy_file (const char *src, const char *dst, 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); long int uid, long int gid);
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
@ -29,6 +29,10 @@ diff -up shadow-4.1.4.2/libmisc/copydir.c.acl shadow-4.1.4.2/libmisc/copydir.c
+{ +{
+ va_list ap; + va_list ap;
+ +
+ /* ignore the case when destination does not support ACLs */
+ if(errno==EOPNOTSUPP)
+ return;
+
+ va_start (ap, fmt); + va_start (ap, fmt);
+ (void) fprintf (stderr, _("%s: "), Prog); + (void) fprintf (stderr, _("%s: "), Prog);
+ if (vfprintf (stderr, fmt, ap) != 0) { + if (vfprintf (stderr, fmt, ap) != 0) {
@ -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 * selinux_file_context - Set the security context before any file or
* directory creation. * 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)) { 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, || (chown (dst,
(uid == - 1) ? statp->st_uid : (uid_t) uid, (uid == - 1) ? statp->st_uid : (uid_t) uid,
(gid == - 1) ? statp->st_gid : (gid_t) gid) != 0) (gid == - 1) ? statp->st_gid : (gid_t) gid) != 0)
+ || (perm_copy_file (src, dst, &ctx) != 0) - || (chmod (dst, statp->st_mode) != 0)
|| (chmod (dst, statp->st_mode) != 0) - || (copy_tree (src, dst, uid, gid) != 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)) { || (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, || (lchown (dst,
(uid == -1) ? statp->st_uid : (uid_t) uid, (uid == -1) ? statp->st_uid : (uid_t) uid,
(gid == -1) ? statp->st_gid : (gid_t) gid) != 0)) { (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); free (oldlink);
return -1; 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, static int copy_hardlink (const char *src, const char *dst,
struct link_name *lp) 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) { if (link (lp->ln_name, dst) != 0) {
return -1; 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. * 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[], const struct stat *statp, const struct timeval mt[],
long int uid, long int gid) 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, || (fchown (ofd,
(uid == -1) ? statp->st_uid : (uid_t) uid, (uid == -1) ? statp->st_uid : (uid_t) uid,
(gid == -1) ? statp->st_gid : (gid_t) gid) != 0) (gid == -1) ? statp->st_gid : (gid_t) gid) != 0)
- || (fchmod (ofd, statp->st_mode & 07777) != 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); (void) close (ifd);
return -1; 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 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.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 = \ @@ -430,9 +430,9 @@ su_SOURCES = \
su_LDADD = $(LDADD) $(LIBPAM) $(LIBCRYPT_NOPAM) $(LIBSKEY) $(LIBMD) su_LDADD = $(LDADD) $(LIBPAM) $(LIBCRYPT_NOPAM) $(LIBSKEY) $(LIBMD)

View file

@ -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 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.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, @@ -58,11 +58,11 @@ int find_new_gid (bool sys_group,
assert (gid != NULL); 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)); 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 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.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, @@ -58,11 +58,11 @@ int find_new_uid (bool sys_user,
assert (uid != NULL); 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); uid_max = (uid_t) getdef_ulong ("SYS_UID_MAX", (unsigned long) uid_max);
} }
used_uids = alloca (sizeof (bool) * (uid_max +1)); 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 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.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; @@ -90,7 +90,7 @@ char *Prog;
static gid_t def_group = 100; static gid_t def_group = 100;
static const char *def_gname = "other"; static const char *def_gname = "other";

View file

@ -1,7 +1,7 @@
Summary: Utilities for managing accounts and shadow password files Summary: Utilities for managing accounts and shadow password files
Name: shadow-utils Name: shadow-utils
Version: 4.1.4.2 Version: 4.1.4.2
Release: 10%{?dist} Release: 11%{?dist}
Epoch: 2 Epoch: 2
URL: http://pkg-shadow.alioth.debian.org/ URL: http://pkg-shadow.alioth.debian.org/
Source0: ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-%{version}.tar.bz2 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* %{_mandir}/man8/vigr.8*
%changelog %changelog
* Thu Feb 10 2011 Peter Vrabec <pvrabec@redhat.com> - 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 <pvrabec@redhat.com> - 2:4.1.4.2-10 * Tue Feb 01 2011 Peter Vrabec <pvrabec@redhat.com> - 2:4.1.4.2-10
- do not use gshadow functions from glibc, there is a bug - do not use gshadow functions from glibc, there is a bug
in glibc sgetsgent(#674361) in glibc sgetsgent(#674361)