integ/base/base-passwd/debian/patches/0002-update-passwd.c-set-walk-to-walk-next-before-removin.patch
Yue Tao 9b545c5e19 Add debian package for base-passwd
Porting patch 0001-Change-group-passwd-and-uidgid.patch from setup of
CentOS. Skip porting uidgid file, a doc file which changed format.

Postgres,neutron,barbican,ceilometer all creates the user when the
package installs so this is not needed as well.

A new patch 0002-update-passwd.c-set-...-before-removin.patch is
used to fix a bug in update-passwd of removing items from group,
passwd. More details please see the patch header.

Test Plan: building, installing, booting, checking /etc/group,
/etc/passwd

Pass: building test
Pass: installing test
Pass: booting test
Pass: the /etc/group, /etc/passwd are same with /usr/shar/base-passwd
/group.master and passwd.master

Story: 2009221
Task: 43417
Signed-off-by: Yue Tao <yue.tao@windriver.com>
Change-Id: I53f1f323e2e293c641af7142a0d3388cc3dde8eb
2021-11-27 21:53:17 +08:00

70 lines
2.0 KiB
Diff

From a2a96fa28fe132e34185ab1646b1f1ea4baf4942 Mon Sep 17 00:00:00 2001
From: Yue Tao <Yue.Tao@windriver.com>
Date: Thu, 25 Nov 2021 10:14:45 +0800
Subject: [PATCH] update-passwd.c: set walk to walk->next before removing
update-passwd only removes once and exits even more
than one items need to be removed. Root cause is walk
is set to walk->next after remove_node(), in which the
walk has been cleaned, so the while(walk) is terminated.
Without the fix, the output of update-passwd
$update-passwd --verbose
Adding group "postgres" (120)
Adding group "nova" (162)
Adding group "barbican" (978)
Adding group "keystone" (42424)
Adding group "neutron" (164)
Adding group "ceilometer" (166)
Adding group "sysinv" (168)
Adding group "snmpd" (169)
Adding group "fm" (195)
Adding group "libvirt" (991)
Adding group "ironic" (1874)
Adding group "www" (1877)
Removing group "daemon" (1)
Adding user "postgres" (120)
Adding user "neutron" (164)
Adding user "sysinv" (168)
Adding user "snmpd" (169)
Adding user "fm" (195)
Adding user "barbican" (982)
Adding user "ceilometer" (991)
Adding user "keystone" (42424)
Adding user "nova" (994)
Adding user "ironic" (1874)
Adding user "www" (1877)
Removing user "daemon" (1)
25 changes have been made, rewriting files
Writing passwd-file to /etc/passwd
Writing shadow-file to /etc/shadow
Writing group-file to /etc/group
Signed-off-by: Yue Tao <Yue.Tao@windriver.com>
---
update-passwd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/update-passwd.c b/update-passwd.c
index 3f3dffa..1a56ed9 100644
--- a/update-passwd.c
+++ b/update-passwd.c
@@ -806,13 +806,13 @@ void process_old_entries(const struct _info* lst, struct _node** passwd, struct
free(id);
}
+ walk=walk->next;
if (make_change) {
if (opt_verbose)
printf("Removing %s \"%s\" (%u)\n", descr, oldnode->name, oldnode->id);
remove_node(passwd, oldnode);
flag_dirty++;
}
- walk=walk->next;
continue;
}
walk=walk->next;
--
2.25.1