Skip to content

Conversation

@ikerexxe
Copy link
Collaborator

Expand the system test framework to provide python bindings for passwd, chpasswd, gpasswd, chgpasswd and vipw binaries. Also include at least one test case example for each of them. Additional changes has been made to the way we generate the test environment (a.k.a. containers) so that it contains everything needed to run these tests.

Temporary workaround to create the newusers PAM service file. Fedora
will soon provide this service file and we'll be able to remove the
workaround.

Signed-off-by: Iker Pedrosa <[email protected]>
This is the transformation to Python of the test located in
`tests/newusers/35_read_from_stdin/newusers.test`, which checks that
`newusers` is able to create new users from stdin.

Signed-off-by: Iker Pedrosa <[email protected]>
… input

This is the transformation to Python of the test located in
`tests/newusers/20_multiple_users/newusers.test`, which checks that
`newusers` is able to create new users from file.

Signed-off-by: Iker Pedrosa <[email protected]>
Temporary workaround to create the groupmems PAM service file. Fedora
will soon provide this service file and we'll be able to remove the
workaround.

Signed-off-by: Iker Pedrosa <[email protected]>
This is the transformation to Python of the test located in
`tests/grouptools/groupmems/01_groupmems_root_add_user/groupmems.test`,
which checks that `groupmems` is able to add a user to a group running
as the root user.

Signed-off-by: Iker Pedrosa <[email protected]>
Change to a new group using `newgrp`.

Signed-off-by: Iker Pedrosa <[email protected]>
@ikerexxe
Copy link
Collaborator Author

This PR depends on #1340 as it contains several changes that are included there too.

* file (gshadow or group) and the password changed.
*/
while (fgets (buf, (int) sizeof buf, stdin) != NULL) {
char *cp;

Check notice

Code scanning / CodeQL

Declaration hides variable Note

Variable cp hides another variable of the same name (on
line 420
).
Expose shadow's password regex pattern in a function.

Signed-off-by: Iker Pedrosa <[email protected]>
…teractive mode

This is the transformation to Python of the test located in
`tests/passwd/18_passwd_root_change_password_user/passwd.test`,
which checks that `passwd` is able to change a user's password running
as root in interactive mode.

Signed-off-by: Iker Pedrosa <[email protected]>
…teractive mode

This is the transformation to Python of the test located in
`tests/passwd/19_passwd_user_change_password/passwd.test`,
which checks that `passwd` is able to change a user's password running
as the user in interactive mode.

Signed-off-by: Iker Pedrosa <[email protected]>
Temporary workaround to create the chpasswd PAM service file. Fedora
will soon provide this service file and we'll be able to remove the
workaround.

Signed-off-by: Iker Pedrosa <[email protected]>
…nteractive

This is the transformation to Python of the test located in
`tests/usertools/chpasswd/02_chpasswd_multiple_users/chpasswd.test`,
which checks that `chpasswd` is able to change the password of multiple
users in batch.

Signed-off-by: Iker Pedrosa <[email protected]>
Define administrators and members as list.

Signed-off-by: Iker Pedrosa <[email protected]>
…oot user

This is the transformation to Python of the test located in
`tests/grouptools/gpasswd/31_gpasswd_add_user_to_group/gpasswd.test`,
which checks that `gpasswd` is able to add a user to a group membership
running as root.

Signed-off-by: Iker Pedrosa <[email protected]>
This is the transformation to Python of the test located in
`tests/grouptools/gpasswd/50_gpasswd_change_admin_list/gpasswd.test`,
which checks that `gpasswd` is able to add a user as a group
administrator.

Signed-off-by: Iker Pedrosa <[email protected]>
Fix chgpasswd to properly handle input files that don't end with a
newline, similar to how chpasswd handles this case. Previously,
chgpasswd would incorrectly report "line too long" errors when
processing the last line of a file that didn't end with a newline
character.

The fix adds proper end-of-file detection and long line handling logic
consistent with chpasswd implementation.

Signed-off-by: Iker Pedrosa <[email protected]>
… interactive

This is the transformation to Python of the test located in
`tests/grouptools/chgpasswd/02_chgpasswd_multiple_groups/chgpasswd.test`,
which checks that `chgpasswd` is able to change the password of multiple
groups in batch.

Signed-off-by: Iker Pedrosa <[email protected]>
* Run vipw on passwd file and add a user
* Run vipw on shadow file and add a user
* Run vipw on group file and add a group
* Run vipw on gshadow file and add a group

Signed-off-by: Iker Pedrosa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant