forked from pool/shadow
Accepting request 228508 from home:netsroth:branches:Base:System
- Add patch useradd-mkdirs.diff: fix for bnc#865563, create all parts of the path OBS-URL: https://build.opensuse.org/request/show/228508 OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=15
This commit is contained in:
parent
70307c69f1
commit
c2bce11198
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 31 22:00:00 UTC 2014 - tbehrens@suse.com
|
||||||
|
|
||||||
|
- Add patch useradd-mkdirs.diff: fix for bnc#865563, create all parts
|
||||||
|
of the path
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Nov 22 10:15:25 UTC 2013 - werner@suse.de
|
Fri Nov 22 10:15:25 UTC 2013 - werner@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package shadow
|
# spec file for package shadow
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -40,6 +40,7 @@ Patch7: shadow-4.1.5.1-logmsg.patch
|
|||||||
Patch8: shadow-4.1.5.1-errmsg.patch
|
Patch8: shadow-4.1.5.1-errmsg.patch
|
||||||
Patch9: shadow-4.1.5.1-backup-mode.patch
|
Patch9: shadow-4.1.5.1-backup-mode.patch
|
||||||
Patch10: encryption_method_nis.diff
|
Patch10: encryption_method_nis.diff
|
||||||
|
Patch11: useradd-mkdirs.diff
|
||||||
BuildRequires: audit-devel
|
BuildRequires: audit-devel
|
||||||
BuildRequires: libacl-devel
|
BuildRequires: libacl-devel
|
||||||
BuildRequires: libattr-devel
|
BuildRequires: libattr-devel
|
||||||
@ -69,6 +70,7 @@ group accounts.
|
|||||||
%patch8 -p0
|
%patch8 -p0
|
||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
%patch10 -p0
|
%patch10 -p0
|
||||||
|
%patch11 -p1
|
||||||
|
|
||||||
iconv -f ISO88591 -t utf-8 doc/HOWTO > doc/HOWTO.utf8
|
iconv -f ISO88591 -t utf-8 doc/HOWTO > doc/HOWTO.utf8
|
||||||
mv -v doc/HOWTO.utf8 doc/HOWTO
|
mv -v doc/HOWTO.utf8 doc/HOWTO
|
||||||
|
71
useradd-mkdirs.diff
Normal file
71
useradd-mkdirs.diff
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
diff --git a/src/useradd.c b/src/useradd.c
|
||||||
|
index fa93853..a9f8caa 100644
|
||||||
|
--- a/src/useradd.c
|
||||||
|
+++ b/src/useradd.c
|
||||||
|
@@ -1757,6 +1757,13 @@ static void usr_update (void)
|
||||||
|
static void create_home (void)
|
||||||
|
{
|
||||||
|
if (access (user_home, F_OK) != 0) {
|
||||||
|
+ char path[strlen (user_home) + 2];
|
||||||
|
+ char *bhome, *cp;
|
||||||
|
+
|
||||||
|
+ path[0] = '\0';
|
||||||
|
+ bhome = strdup (user_home);
|
||||||
|
+ ++bhome;
|
||||||
|
+
|
||||||
|
#ifdef WITH_SELINUX
|
||||||
|
if (set_selinux_file_context (user_home) != 0) {
|
||||||
|
fprintf (stderr,
|
||||||
|
@@ -1765,19 +1772,42 @@ static void create_home (void)
|
||||||
|
fail_exit (E_HOMEDIR);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
- /* XXX - create missing parent directories. --marekm */
|
||||||
|
- if (mkdir (user_home, 0) != 0) {
|
||||||
|
- fprintf (stderr,
|
||||||
|
- _("%s: cannot create directory %s\n"),
|
||||||
|
- Prog, user_home);
|
||||||
|
+
|
||||||
|
+ /* Check for every part of the path, if the directory
|
||||||
|
+ exists. If not, create it with permissions 755 and
|
||||||
|
+ owner root:root.
|
||||||
|
+ */
|
||||||
|
+ cp = strtok (bhome, "/");
|
||||||
|
+ while (cp) {
|
||||||
|
+ strcat (path, "/");
|
||||||
|
+ strcat (path, cp);
|
||||||
|
+ if (access (path, F_OK) != 0) {
|
||||||
|
+ if (mkdir (path, 0) != 0) {
|
||||||
|
+ fprintf (stderr,
|
||||||
|
+ _("%s: cannot create directory %s\n"),
|
||||||
|
+ Prog, path);
|
||||||
|
#ifdef WITH_AUDIT
|
||||||
|
- audit_logger (AUDIT_ADD_USER, Prog,
|
||||||
|
- "adding home directory",
|
||||||
|
- user_name, (unsigned int) user_id,
|
||||||
|
- SHADOW_AUDIT_FAILURE);
|
||||||
|
+ audit_logger (AUDIT_ADD_USER, Prog,
|
||||||
|
+ "adding home directory",
|
||||||
|
+ user_name, (unsigned int) user_id,
|
||||||
|
+ SHADOW_AUDIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
- fail_exit (E_HOMEDIR);
|
||||||
|
+ fail_exit (E_HOMEDIR);
|
||||||
|
+ }
|
||||||
|
+ if (chown (path, 0, 0) < 0) {
|
||||||
|
+ fprintf (stderr,
|
||||||
|
+ _("%s: warning: chown on `%s' failed: %m\n"),
|
||||||
|
+ Prog, path);
|
||||||
|
+ }
|
||||||
|
+ if (chmod (path, 0777) < 0) {
|
||||||
|
+ fprintf (stderr,
|
||||||
|
+ _("%s: warning: chmod on `%s' failed: %m\n"),
|
||||||
|
+ Prog, path);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ cp = strtok (NULL, "/");
|
||||||
|
}
|
||||||
|
+
|
||||||
|
chown (user_home, user_id, user_gid);
|
||||||
|
chmod (user_home,
|
||||||
|
0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
|
Loading…
Reference in New Issue
Block a user