Alejandro Colomar 68d42a8fbe src/usermod.c: update_group_file(): Reduce scope of local variable
After _every_ iteration, 'changed' is always 'false'.  We don't need to
have it outside of the loop.

See:

$ grepc update_group_file . \
| grep -e changed -e goto -e continue -e break -e free_ngrp -e '{' -e '}' \
| pcre2grep -v -M '{\n\t*}';
{
	bool                changed;
	changed = false;
	while ((grp = gr_next ()) != NULL) {
		if (!was_member && !is_member) {
			continue;
		}
		if (was_member) {
			if ((!Gflg) || is_member) {
				if (lflg) {
					changed = true;
				}
			} else {
				changed = true;
			}
		} else if (is_member) {
			changed = true;
		}
		if (!changed)
			goto free_ngrp;
		changed = false;
free_ngrp:
	}
}

This was already true in the commit that introduced the code:

$ git show 45c6603cc:src/usermod.c \
| grepc update_group \
| grep -e changed -e goto -e break -e continue -e '\<if\>' -e '{' -e '}' \
| pcre2grep -v -M '{\n\t*}';
{
	int changed;
	changed = 0;
	while ((grp = gr_next())) {
		 * See if the user specified this group as one of their
		if (!was_member && !is_member)
			continue;
		if (was_member && (!Gflg || is_member)) {
			if (lflg) {
				changed = 1;
			}
		} else if (was_member && Gflg && !is_member) {
			changed = 1;
		} else if (!was_member && Gflg && is_member) {
			changed = 1;
		}
		if (!changed)
			continue;
		changed = 0;
	}
}

Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream version, shadow (19990709)")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-05-20 09:37:01 +02:00
2023-10-04 13:31:38 -05:00
2023-10-04 13:31:38 -05:00
2024-02-13 18:45:04 +01:00
2024-05-17 16:08:26 +02:00
2023-11-25 21:24:38 -06:00
2024-05-09 14:25:19 +02:00
2023-03-02 16:33:06 -06:00
2024-03-23 16:39:07 -05:00
2024-02-06 16:16:32 +01:00
2023-04-26 17:35:58 -05:00
2024-03-23 18:33:45 -05:00
2021-12-23 19:36:50 -06:00
2024-03-23 16:39:07 -05:00
2023-04-26 17:35:58 -05:00
2021-12-19 14:09:08 -06:00
2023-03-20 10:54:45 -05:00

shadow-utils

Introduction

The shadow-utils package includes the necessary programs for converting UNIX password files to the shadow password format, plus programs for managing user and group accounts. The pwconv command converts passwords to the shadow password format. The pwunconv command unconverts shadow passwords and generates a passwd file (a standard UNIX password file). The pwck command checks the integrity of password and shadow files. The lastlog command prints out the last login times for all users. The useradd, userdel, and usermod commands are used for managing user accounts. The groupadd, groupdel, and groupmod commands are used for managing group accounts.

Sites

Code

The main development branch is at https://github.com/shadow-maint/shadow.git

See STABLE.md for a list of supported stable branches.

Contacts

There are several ways to contact us:

Mailing archives

Contributions

Contributions are welcome. Follow the guidelines before posting any patches.

Authors and maintainers

Authors and maintainers are listed in AUTHORS.md.

Description
Upstream shadow tree
Readme 30 MiB
Languages
Shell 54.2%
C 41.2%
Python 3.1%
M4 0.8%
Makefile 0.6%
Other 0.1%