Compare commits

...

3 Commits

Author SHA1 Message Date
Peter Vrabec 7b0edc2c1b - useradd man page (-m option)
- create home directory on fs with noacl
2011-02-10 11:39:31 +01:00
Peter Vrabec eedd174dca do not use gshadow functions from glibc (#674234) 2011-02-01 17:16:10 +01:00
Peter Vrabec c27dfe617a fix Bug #665780
- fix gshadow functions from shadow utils
- make shadow utils use gshadow functions from glibc
2011-01-06 10:28:41 +01:00
4 changed files with 100 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
--- 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 <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[],
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)

View File

@ -0,0 +1,23 @@
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)

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
--- 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";

View File

@ -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: 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
@ -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,21 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/vigr.8*
%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
- do not use gshadow functions from glibc, there is a bug
in glibc sgetsgent(#674361)
Resolves: #674234
* Wed Jan 05 2011 Peter Vrabec <pvrabec@redhat.com> - 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 <pvrabec@redhat.com> - 2:4.1.4.2-8
- fix pwck/grpck hang
Resolves: #586322