Bug 271747 - login.conf(5), setusercontext(): umask has no default value, simplify code
Summary: login.conf(5), setusercontext(): umask has no default value, simplify code
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Olivier Certner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-31 15:42 UTC by Olivier Certner
Modified: 2024-02-01 21:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Certner freebsd_committer freebsd_triage 2023-05-31 15:42:31 UTC
Analysis and simplification of code in setusercontext() shows that it doesn't apply any default umask if none is explicitly specified in login.conf.

This is coherent with what is done for other context pieces (except priorities, subject of another bug), and is desirable to enable login classes where the umask is simply inherited.

Fix the documentation accordingly.
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-01-29 22:32:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d1fe948d97d2d6e3708349b74cf438f9604a8d1

commit 0d1fe948d97d2d6e3708349b74cf438f9604a8d1
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-05-25 12:41:03 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-01-29 21:58:05 +0000

    login.conf(5): umask has no default value

    The umask is simply left unchanged if no explicit value is specified in
    the login class capabilities database.

    PR:                     271747
    Reviewed by:            emaste
    Approved by:            emaste (mentor)
    MFC after:              3 days
    Sponsored by:           Kumacom SAS
    Differential Revision:  https://reviews.freebsd.org/D40345

 lib/libutil/login.conf.5 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-01-29 22:32:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e99c28e93bd4d04ff877459734e9ce06ad2335a7

commit e99c28e93bd4d04ff877459734e9ce06ad2335a7
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-05-25 12:18:45 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-01-29 21:57:58 +0000

    setusercontext(): umask: Set it only once (in the common case)

    Simplify the code and make it more coherent (umask was the only context
    setting not modified by setlogincontext() directly).

    Preserve the current behavior of not changing the umask if none is
    specified in the login class capabilities database, but without the
    superfluous umask() dance.  (The only exception to this is that
    a special value no user is likely to input in the database now stands
    for no specification.)

    If some user has a 'umask' override in its '~/.login_conf', the umask
    will still be set twice as before (as is the case for all other context
    settings overriden in '~/.login_conf').

    Log a warning in case of an invalid umask specification.

    This change makes it apparent that the value of LOGIN_DEFUMASK doesn't
    matter.  It will be removed in a subsequent commit.

    PR:                     271747
    Reviewed by:            emaste, kib (earlier version)
    Approved by:            emaste
    MFC after:              3 days
    Sponsored by:           Kumacom SAS
    Differential Revision:  https://reviews.freebsd.org/D40344

 lib/libutil/login_class.c | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-02-01 21:26:43 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=11919f8eaf973018d81618da8a2b0ec214b22ee6

commit 11919f8eaf973018d81618da8a2b0ec214b22ee6
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-05-25 12:41:03 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-02-01 21:22:46 +0000

    login.conf(5): umask has no default value

    The umask is simply left unchanged if no explicit value is specified in
    the login class capabilities database.

    PR:                     271747
    Reviewed by:            emaste
    Approved by:            emaste (mentor)
    MFC after:              3 days
    Sponsored by:           Kumacom SAS
    Differential Revision:  https://reviews.freebsd.org/D40345

    (cherry picked from commit 0d1fe948d97d2d6e3708349b74cf438f9604a8d1)

    Approved by:            markj (mentor)

 lib/libutil/login.conf.5 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-02-01 21:26:43 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2006be8bc46fef3c37404827dbaf49749122553c

commit 2006be8bc46fef3c37404827dbaf49749122553c
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-05-25 12:18:45 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-02-01 21:22:26 +0000

    setusercontext(): umask: Set it only once (in the common case)

    Simplify the code and make it more coherent (umask was the only context
    setting not modified by setlogincontext() directly).

    Preserve the current behavior of not changing the umask if none is
    specified in the login class capabilities database, but without the
    superfluous umask() dance.  (The only exception to this is that
    a special value no user is likely to input in the database now stands
    for no specification.)

    If some user has a 'umask' override in its '~/.login_conf', the umask
    will still be set twice as before (as is the case for all other context
    settings overriden in '~/.login_conf').

    Log a warning in case of an invalid umask specification.

    This change makes it apparent that the value of LOGIN_DEFUMASK doesn't
    matter.  It will be removed in a subsequent commit.

    PR:                     271747
    Reviewed by:            emaste, kib (earlier version)
    Approved by:            emaste
    MFC after:              3 days
    Sponsored by:           Kumacom SAS
    Differential Revision:  https://reviews.freebsd.org/D40344

    (cherry picked from commit e99c28e93bd4d04ff877459734e9ce06ad2335a7)

    Approved by:            markj (mentor)

 lib/libutil/login_class.c | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-02-01 21:31:47 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3dec4c30c76b1646c835768863c876f516852fc3

commit 3dec4c30c76b1646c835768863c876f516852fc3
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-05-25 12:18:45 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-02-01 21:28:27 +0000

    setusercontext(): umask: Set it only once (in the common case)

    Simplify the code and make it more coherent (umask was the only context
    setting not modified by setlogincontext() directly).

    Preserve the current behavior of not changing the umask if none is
    specified in the login class capabilities database, but without the
    superfluous umask() dance.  (The only exception to this is that
    a special value no user is likely to input in the database now stands
    for no specification.)

    If some user has a 'umask' override in its '~/.login_conf', the umask
    will still be set twice as before (as is the case for all other context
    settings overriden in '~/.login_conf').

    Log a warning in case of an invalid umask specification.

    This change makes it apparent that the value of LOGIN_DEFUMASK doesn't
    matter.  It will be removed in a subsequent commit.

    PR:                     271747
    Reviewed by:            emaste, kib (earlier version)
    Approved by:            emaste
    MFC after:              3 days
    Sponsored by:           Kumacom SAS
    Differential Revision:  https://reviews.freebsd.org/D40344

    (cherry picked from commit e99c28e93bd4d04ff877459734e9ce06ad2335a7)

    Approved by:            markj (mentor)

 lib/libutil/login_class.c | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-02-01 21:31:50 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0551aa362c946c16a246e744ceba53dec66ea8e

commit f0551aa362c946c16a246e744ceba53dec66ea8e
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-05-25 12:41:03 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-02-01 21:28:34 +0000

    login.conf(5): umask has no default value

    The umask is simply left unchanged if no explicit value is specified in
    the login class capabilities database.

    PR:                     271747
    Reviewed by:            emaste
    Approved by:            emaste (mentor)
    MFC after:              3 days
    Sponsored by:           Kumacom SAS
    Differential Revision:  https://reviews.freebsd.org/D40345

    (cherry picked from commit 0d1fe948d97d2d6e3708349b74cf438f9604a8d1)

    Approved by:            markj (mentor)

 lib/libutil/login.conf.5 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)