URL: https://github.com/SSSD/sssd/pull/5565 Author: aborah-sudo Title: #5565: Tests: Tests if shadow-utils are immune against bugs in 2006:0032 Action: synchronized
To pull the PR as Git branch: git remote add ghsssd https://github.com/SSSD/sssd git fetch ghsssd pull/5565/head:pr5565 git checkout pr5565
From 6eaf088c8174237956e77d561ef53856a125b19a Mon Sep 17 00:00:00 2001 From: aborah <abo...@anuj.master.com> Date: Thu, 1 Apr 2021 10:51:11 +0530 Subject: [PATCH] Tests: Tests if shadow-utils are immune against bugs in 2006:0032 Tests if shadow-utils are immune against bugs in 2006:0032 --- .../shadow_utils/test_error_2006_0032.py | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/tests/multihost/shadow_utils/test_error_2006_0032.py diff --git a/src/tests/multihost/shadow_utils/test_error_2006_0032.py b/src/tests/multihost/shadow_utils/test_error_2006_0032.py new file mode 100644 index 0000000000..2f490f9dbb --- /dev/null +++ b/src/tests/multihost/shadow_utils/test_error_2006_0032.py @@ -0,0 +1,67 @@ +""" Automation of Shadow Utils tests """ + +from __future__ import print_function +import pytest + + +class TestShadowUtilsErrors(): + """ + Automation of Shadow Utils tests + """ + @pytest.mark.tier1 + def test_error_2006_0032(self, multihost): + """ + :title: Shadow-Utils: Tests if shadow-utils are + immune against bugs in 2006:0032 + :id: 017f615a-92a8-11eb-bca1-002b677efe14 + :steps: + 1. Creating tmp directory + 2. Allowing '.' in usernames + 3. Added two patches to shadow-utils for + additional usermod flag + 4. The user foo must be included in both + foo-group and foo-group2 groups + 5. usermod -p does not update sp_lstchg + :expectedresults: + 1. Should succeed + 2. Should succeed + 3. Should succeed + 4. Should succeed + 5. Should succeed + """ + # Creating tmp directory + cmd = multihost.client[0].run_command("mktemp -d") + assert cmd.returncode == 0 + # useradd not allowing '.' in usernames + cmd = multihost.client[0].run_command("useradd " + "joe.testing") + assert cmd.returncode == 0 + multihost.client[0].run_command("userdel " + "-r joe.testing") + # Added two patches to shadow-utils for + # additional usermod flag + multihost.client[0].run_command("useradd foo") + multihost.client[0].run_command("groupadd foo-group") + multihost.client[0].run_command("usermod -G " + "foo-group foo") + multihost.client[0].run_command("groupadd foo-group2") + multihost.client[0].run_command("usermod -G " + "foo-group2 -a foo") + # The user foo must be included in both + # foo-group and foo-group2 groups + cmd = multihost.client[0].run_command("id foo") + assert cmd.returncode == 0 + multihost.client[0].run_command("groupdel " + "foo-group") + multihost.client[0].run_command("groupdel " + "foo-group2") + # usermod -p does not update sp_lstchg + pass_ch0 = multihost.client[0].run_command("chage -l foo") + pass_ch0 = pass_ch0.stdout_text.split('\n')[0].split(':')[1] + multihost.client[0].run_command("date -s '-2 day'; usermod" + " -p foopass foo; " + "date -s '+2 day'") + pass_change = multihost.client[0].run_command("chage -l foo") + pass_change = pass_change.stdout_text.split('\n')[0].split(':')[1] + assert pass_ch0 != pass_change + multihost.client[0].run_command("userdel -r foo")
_______________________________________________ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure