Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-6274

lslogins incorrect account expiration field

    • util-linux-2.32.1-46.el8
    • None
    • Low
    • rhel-sst-cs-plumbers
    • ssg_core_services
    • 26
    • 2
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • If docs needed, set a value
    • None

      Description of problem:
      Issue 1. Incorrect description.

      According to shadow specification, the 8th field is Account Expiration. It is mistakenly labeled as Password Expiration by lslogins.

      struct spwd

      { char *sp_namp; /* user login name */ char *sp_pwdp; /* encrypted password */ long int sp_lstchg; /* last password change */ long int sp_min; /* days until change allowed. */ long int sp_max; /* days before change required */ long int sp_warn; /* days warning for expiration */ long int sp_inact; /* days before account inactive */ long int sp_expire; /* date when account expires */ unsigned long int sp_flag; /* reserved for future use */ }
      1. useradd jane
      1. grep jane /etc/shadow
        jane:!!:19494:0:99999:7:::
      1. lslogins jane
        Username: jane
        UID: 1003
        Gecos field:
        Home directory: /home/jane
        Shell: /bin/bash
        No login: no
        Password is locked: yes
        Password not required (empty): yes
        Login by password disabled: no
        Primary group: jane
        GID: 1003
        Hushed: no
        Password expiration warn interval: 7
        Password changed: 10:00
        Maximum change time: 99999
        Running processes: 0
      1. usermod -e "2020-12-31" jane
      1. grep jane /etc/shadow
        jane:!!:19494:0:99999:7::18627:
      1. lslogins jane
        Username: jane
        UID: 1003
        Gecos field:
        Home directory: /home/jane
        Shell: /bin/bash
        No login: no
        Password is locked: yes
        Password not required (empty): yes
        Login by password disabled: no
        Primary group: jane
        GID: 1003
        Hushed: no
        Password expiration warn interval: 7
        Password changed: 10:00
        Maximum change time: 99999
        Password expiration: 2020-Dec31 <<<<<=====
        Running processes: 0

      2. Date format consistency
      If expiration is set to 31 Dec of past year, the output is shown as "Dec31/10:00", i.e.:

      1. date
        Wed May 17 10:25:14 AEST 2023 <<<<< Today is May 2023
      1. usermod -e "2022-12-31" jane <<<<< Dec last year
      1. lslogins jane
        Password expiration: Dec31/10:00 <<<<< year is omitted

      If year is omitted, users will be mistaken to think it is same year as today, i.e. 2023-Dec-31

      In contrast, if account expiration is set to 2023-12-31, the full date is printed:

      1. usermod -e "2023-12-31" jane
        Password expiration: 2023-Dec31 <<<<< year is printed

      Suggestion:
      1. Same output format regardless the expiration year relative to current year, or
      2. Omit the year if expiration date is the same as current year.

      Version-Release number of selected component (if applicable):
      util-linux-2.32.1-39.el8_7.x86_64

              rhn-engineering-kzak Karel Zak
              rhn-support-suwu Sunny Wu
              Karel Zak Karel Zak
              Radka Brychtova Radka Brychtova
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: