[users] Expand tests and repair newly-acceptable cases
This commit is contained in:
parent
4ac0529d1c
commit
c68c3632cc
@ -523,6 +523,10 @@ UserTests::testUserUmask_data()
|
||||
QTest::newRow( "good " ) << "tests/8a-issue-2362.conf" << 0700 << 0077;
|
||||
QTest::newRow( "open " ) << "tests/8b-issue-2362.conf" << 0755 << 0022;
|
||||
QTest::newRow( "weird" ) << "tests/8c-issue-2362.conf" << 0126 << 0651;
|
||||
QTest::newRow( "rwxx " ) << "tests/8d-issue-2362.conf" << 0710 << 0067;
|
||||
QTest::newRow( "-wrd " ) << "tests/8e-issue-2362.conf" << 0214 << 0563;
|
||||
QTest::newRow( "bogus" ) << "tests/8f-issue-2362.conf" << -1 << -1;
|
||||
QTest::newRow( "good2" ) << "tests/8g-issue-2362.conf" << 0750 << 0027;
|
||||
}
|
||||
|
||||
void
|
||||
@ -531,7 +535,12 @@ UserTests::testUserUmask()
|
||||
static constexpr int no_permissions = -1;
|
||||
const QString old_shell = QStringLiteral( "/bin/ls" );
|
||||
const QString new_shell = QStringLiteral( "/usr/bin/new" );
|
||||
const QStringList forbidden { QStringLiteral( "me" ), QStringLiteral( "myself" ), QStringLiteral( "moi" ) };
|
||||
// nobody and root are always forbidden, even if not mentioned in the config, entries are alphabetical
|
||||
const QStringList forbidden { QStringLiteral( "me" ),
|
||||
QStringLiteral( "moi" ),
|
||||
QStringLiteral( "myself" ),
|
||||
QStringLiteral( "nobody" ),
|
||||
QStringLiteral( "root" ) };
|
||||
Config c;
|
||||
c.setUserShell( old_shell );
|
||||
QCOMPARE( c.homePermissions(), no_permissions );
|
||||
@ -541,8 +550,12 @@ UserTests::testUserUmask()
|
||||
QFETCH( int, permission );
|
||||
QFETCH( int, umask );
|
||||
|
||||
QCOMPARE( permission & umask, 0 );
|
||||
QCOMPARE( permission | umask, 0777 );
|
||||
// Checks that the test-data is valid
|
||||
if ( permission != -1 )
|
||||
{
|
||||
QCOMPARE( permission & umask, 0 );
|
||||
QCOMPARE( permission | umask, 0777 );
|
||||
}
|
||||
|
||||
QFileInfo fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QVERIFY( fi.exists() );
|
||||
|
@ -8,4 +8,4 @@ user:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
home_permissions: "700"
|
||||
home_permissions: "o700"
|
||||
|
@ -4,8 +4,10 @@
|
||||
---
|
||||
user:
|
||||
shell: /usr/bin/new
|
||||
# Order of names here doesn't matter (and "nobody" and "root" are always added)
|
||||
forbidden_names:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
home_permissions: "755"
|
||||
- me
|
||||
- root
|
||||
home_permissions: "o755"
|
||||
|
@ -8,4 +8,4 @@ user:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
home_permissions: "126"
|
||||
home_permissions: "o126"
|
||||
|
11
src/modules/users/tests/8d-issue-2362.conf
Normal file
11
src/modules/users/tests/8d-issue-2362.conf
Normal file
@ -0,0 +1,11 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
user:
|
||||
shell: /usr/bin/new
|
||||
forbidden_names:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
home_permissions: rwx--x---
|
11
src/modules/users/tests/8e-issue-2362.conf
Normal file
11
src/modules/users/tests/8e-issue-2362.conf
Normal file
@ -0,0 +1,11 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
user:
|
||||
shell: /usr/bin/new
|
||||
forbidden_names:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
home_permissions: -w---xr--
|
11
src/modules/users/tests/8f-issue-2362.conf
Normal file
11
src/modules/users/tests/8f-issue-2362.conf
Normal file
@ -0,0 +1,11 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
user:
|
||||
shell: /usr/bin/new
|
||||
forbidden_names:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
home_permissions: Bogus
|
12
src/modules/users/tests/8g-issue-2362.conf
Normal file
12
src/modules/users/tests/8g-issue-2362.conf
Normal file
@ -0,0 +1,12 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
user:
|
||||
shell: /usr/bin/new
|
||||
forbidden_names:
|
||||
- me
|
||||
- myself
|
||||
- moi
|
||||
# This is a number, not a string, due to vagaries of YAML
|
||||
home_permissions: "0750"
|
Loading…
Reference in New Issue
Block a user