Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utmp/wtmp support #2745

Merged
merged 22 commits into from
Feb 21, 2024
Merged

Add utmp/wtmp support #2745

merged 22 commits into from
Feb 21, 2024

Commits on Feb 20, 2024

  1. Initial support for utmp/wtmp on linux

    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    895fe28 View commit details
    Browse the repository at this point in the history
  2. remove trailing space

    metalefty authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    42388ca View commit details
    Browse the repository at this point in the history
  3. sesman: add utmp files to makefile

    metalefty authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    c103d23 View commit details
    Browse the repository at this point in the history
  4. don't forget include utmp.h

    metalefty authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    3ea3062 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    56eec32 View commit details
    Browse the repository at this point in the history
  6. WIP utmp/wtmp

    - renamed the two files, including the header was conflicting with official headers
    - configure look for utmp/utmpx headers, wo we know which struct to use
    - reworked the usage for linux, works mostly (last still showing 'gone' for loggued users)
    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    bacda80 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d3a751c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e32671c View commit details
    Browse the repository at this point in the history
  9. cosmetic changes

    metalefty authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    eaffeaf View commit details
    Browse the repository at this point in the history
  10. Add the loginuid pam module, as we are starting a session.

    So /proc/<uid>/loginuid will be filled by the uid of the user.
    This will fix entries in 'last' with "gone - no logout" instead of
    'still logged in'
    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    2af2e03 View commit details
    Browse the repository at this point in the history
  11. Add support for FreeBSD

    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    547388d View commit details
    Browse the repository at this point in the history
  12. don't forget a free

    use g_*
    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    58b3989 View commit details
    Browse the repository at this point in the history
  13. More g_* functions usage

    Follow coding standard
    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    22f17ad View commit details
    Browse the repository at this point in the history
  14. Move some definitions, and small fixes

    moobyfr authored and matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    da0f3ce View commit details
    Browse the repository at this point in the history
  15. Remove AC_GNU_SOURCE

    AC_GNU_SOURCE is replaced with AC_USE_SYSTEM_EXTENSIONS (available
    from autoconf 2.6.0)
    matt335672 committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    49f60fc View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2024

  1. Rename struct exit_status in os_calls

    This conflicts with struct exit_status in <utmp.h>
    matt335672 committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    bc9b35c View commit details
    Browse the repository at this point in the history
  2. Remove wtmp updating code

    matt335672 committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    bf53a76 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3b6c9bc View commit details
    Browse the repository at this point in the history
  4. Don't use DEAD_PROCESS/USER_PROCESS for add_xtmp_entry

    If we're not compiling with USE_UTMP, these defines will not
    be available
    matt335672 committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    98d6545 View commit details
    Browse the repository at this point in the history
  5. Set ut_id field

    The utmp record is generally looked up by the ut_id field. Setting
    this field means we can use a blank username and host when the
    session exits
    matt335672 committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    04c67a5 View commit details
    Browse the repository at this point in the history
  6. Allow some utmpx fields to be optional

    POSIX.1 doesn't define ut_host in struct utmpx. Also, Linux has support
    for an exit status value in ut_exit. This commit adds conditional code
    for both ut_host and ut_exit to maximise portability.
    matt335672 committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    b53c683 View commit details
    Browse the repository at this point in the history
  7. Replace g_strncpy() with str2memcpy()

    g_strncpy() is the wrong function for copying strings in struct utmp[x]
    as it always terminates strings.
    
    strncpy() itself would be a good choice, but is marked by many compilers
    as being unsafe to use.
    
    str2memcpy() is taken from util-linux, and is exactly right for this
    application.
    matt335672 committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    8cea9b0 View commit details
    Browse the repository at this point in the history