Hello community,

here is the log from the commit of package shadow for openSUSE:Factory checked 
in at 2020-11-07 21:00:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/shadow (Old)
 and      /work/SRC/openSUSE:Factory/.shadow.new.11331 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "shadow"

Sat Nov  7 21:00:53 2020 rev:41 rq:845486 version:4.8.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/shadow/shadow.changes    2020-10-15 
13:43:50.525139908 +0200
+++ /work/SRC/openSUSE:Factory/.shadow.new.11331/shadow.changes 2020-11-07 
21:01:12.750041863 +0100
@@ -1,0 +2,8 @@
+Mon Nov  2 15:54:02 UTC 2020 - Dr. Werner Fink <wer...@suse.de>
+
+- Change again useradd.local script to let it work even for system
+  accounts and work together with SELinux (bsc#1178296)
+- Change patch useradd-script.patch to support the four arguments
+  used by the useradd.local script (bsc#1178296)
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------


++++++ useradd-script.patch ++++++
--- /var/tmp/diff_new_pack.jJLpK3/_old  2020-11-07 21:01:14.394039353 +0100
+++ /var/tmp/diff_new_pack.jJLpK3/_new  2020-11-07 21:01:14.394039353 +0100
@@ -1,8 +1,12 @@
-Index: etc/login.defs
-===================================================================
---- etc/login.defs.orig
-+++ etc/login.defs
-@@ -212,6 +212,13 @@ CHFN_RESTRICT             rwh
+---
+ etc/login.defs |    7 +++++++
+ lib/getdef.c   |    1 +
+ src/useradd.c  |   41 ++++++++++++++++++++++++++++++++++++++++-
+ 3 files changed, 48 insertions(+), 1 deletion(-)
+
+--- etc/login.defs
++++ etc/login.defs     2020-10-30 12:54:38.117849829 +0000
+@@ -242,6 +242,13 @@ CHFN_RESTRICT             rwh
  DEFAULT_HOME  yes
  
  #
@@ -16,11 +20,9 @@
  # If defined, this command is run when removing a user.
  # It should remove any at/cron/print jobs etc. owned by
  # the user to be removed (passed as the first argument).
-Index: lib/getdef.c
-===================================================================
---- lib/getdef.c.orig
-+++ lib/getdef.c
-@@ -126,6 +126,7 @@ static struct itemdef def_table[] = {
+--- lib/getdef.c
++++ lib/getdef.c       2020-10-30 12:54:38.117849829 +0000
+@@ -134,6 +134,7 @@ static struct itemdef def_table[] = {
        {"UID_MAX", NULL},
        {"UID_MIN", NULL},
        {"UMASK", NULL},
@@ -28,11 +30,9 @@
        {"USERDEL_CMD", NULL},
        {"USERDEL_PRECMD", NULL},
        {"USERDEL_POSTCMD", NULL},
-Index: src/useradd.c
-===================================================================
---- src/useradd.c.orig
-+++ src/useradd.c
-@@ -2216,6 +2216,30 @@ static void create_mail (void)
+--- src/useradd.c
++++ src/useradd.c      2020-10-30 13:08:17.378336989 +0000
+@@ -2238,6 +2238,44 @@ static void create_mail (void)
  }
  
  /*
@@ -42,20 +42,34 @@
 + *      account.
 + */
 +
-+static void call_script (const char *user)
++static void call_script (const char *user, const uid_t uid, const gid_t gid, 
const char *home)
 +{
 +        const char *cmd;
-+        const char *argv[3];
++        const char *argv[6];
++        char *strgid, *struid;
 +        int status;
 +
 +        cmd = getdef_str ("USERADD_CMD");
 +        if (NULL == cmd) {
 +                return;
 +        }
++        if (asprintf(&struid, "%lu", (long unsigned)uid) < 0) {
++                (void) fprintf (stderr, _("%s: out of memory\n"), Prog);
++                exit(1);
++        }
++        if (asprintf(&strgid, "%lu", (long unsigned)gid) < 0) {
++                (void) fprintf (stderr, _("%s: out of memory\n"), Prog);
++                exit(1);
++        }
 +        argv[0] = cmd;
 +        argv[1] = user;
-+        argv[2] = (char *)0;
++        argv[2] = struid;
++        argv[3] = strgid;
++        argv[4] = home;
++        argv[5] = (char *)0;
 +        (void) run_command (cmd, argv, NULL, &status);
++        free(strgid);
++        free(struid);
 +}
 +
 +
@@ -63,11 +77,11 @@
   * main - useradd command
   */
  int main (int argc, char **argv)
-@@ -2492,6 +2516,7 @@ int main (int argc, char **argv)
+@@ -2514,6 +2552,7 @@ int main (int argc, char **argv)
        nscd_flush_cache ("group");
        sssd_flush_cache (SSSD_DB_PASSWD | SSSD_DB_GROUP);
  
-+      call_script (user_name);
++      call_script (user_name, user_id, user_gid, user_home);
 +
        return E_SUCCESS;
  }

++++++ useradd.local ++++++
--- /var/tmp/diff_new_pack.jJLpK3/_old  2020-11-07 21:01:14.414039323 +0100
+++ /var/tmp/diff_new_pack.jJLpK3/_new  2020-11-07 21:01:14.418039316 +0100
@@ -21,44 +21,43 @@
   exit 1
 fi
 
-# definition of "root" $HOME for users
-. /etc/default/useradd
-
 USER=$1
-GID=$(id -g $USER)
-HOMEDIR=$HOME/$USER
 
-if [ $# -lt 4 ]; then
-  HOMEDIR=$HOME/$USER
-else
+if [ $# -eq 4 ]; then
+  GID=$3
   HOMEDIR=$4
+else
+  GID=$(id -g $USER)
+  HOMEDIR=$(grep -E "^${USER}:" /etc/passwd| cut -d: -f6,6)
 fi
 
 # Update NIS database
 # make -C /var/yp
 
+# Main useradd tool creates this if specified on command line
+[ -d $HOMEDIR ] || exit 0
+
+#
+# Copy also skeleton files from /usr/etc/skel (boo#1173321)
+#
+USRSKELDIR=/usr/etc/skel
+if [ -d $USRSKELDIR ] ; then
+  for file in $(ls -A $USRSKELDIR); do
+    # Only copy if not exist yet, i.e. does *not* exist in /etc/skel, which is 
still
+    # being preferred ...
+    test -e $HOMEDIR/$file && continue
+    cp -a $USRSKELDIR/$file $HOMEDIR
+    chown -R $USER.$GID $HOMEDIR/$file
+  done
+fi
+
 # If SELinux is enabled, we have to run restorecon to assign
 # appropriate fcontexts to the respective $HOME and files under it
 if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then
   test -x /sbin/restorecon || exit 2
 
-  if [ -d $HOMEDIR ]; then
-      /sbin/restorecon -R $HOMEDIR
-  fi
+  /sbin/restorecon -R $HOMEDIR
 fi
 
-#
-# Copy also skeleton files from /usr/etc/skel (boo#1173321)
-#
-
-USRSKELDIR=/usr/etc/skel
-for file in $(ls -A $USRSKELDIR); do
-  # Only copy if not exist yet, i.e. does *not* exist in /etc/skel, which is 
still
-  # being preferred ...
-  test -e $HOMEDIR/$file && continue
-  cp -a $USRSKELDIR/$file $HOMEDIR
-  chown -R $USER.$GID $HOMEDIR/$file
-done
-
 # All done.
 exit 0


Reply via email to