feat(kernel): the live patches the running kernel carries, in the kernel facts, 4.52.0 (NetOrk/netork#2701) #139
@@ -84,8 +84,18 @@ _LASTLOG_DATE = re.compile(r"\s(\w{3} \w{3} +\d{1,2} \d{2}:\d{2}:\d{2}(?: [+-]\d
|
||||
_ISO = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}")
|
||||
#: A row of a ``faillock`` tally starts with its date.
|
||||
_ISO_DATE = re.compile(r"^\d{4}-\d{2}-\d{2} ")
|
||||
#: The states of an account's password, as the reading names them. Named, not literals in
|
||||
#: a comparison: a state word is no password, but a scanner reading ``password == "..."``
|
||||
#: takes it for one (bandit B105).
|
||||
STATE_SET, STATE_LOCKED, STATE_NONE = "set", "locked", "none"
|
||||
#: ``passwd -S``'s second word: shadow's and libuser's.
|
||||
_PASSWORD_STATES = {"P": "set", "PS": "set", "L": "locked", "LK": "locked", "NP": "none"}
|
||||
_PASSWORD_STATES = {
|
||||
"P": STATE_SET,
|
||||
"PS": STATE_SET,
|
||||
"L": STATE_LOCKED,
|
||||
"LK": STATE_LOCKED,
|
||||
"NP": STATE_NONE,
|
||||
}
|
||||
_NEVER = "never"
|
||||
_MUST_CHANGE = "password must be changed"
|
||||
|
||||
@@ -285,7 +295,7 @@ def _expired(account_expires: str | None, today: date | None) -> bool | None:
|
||||
|
||||
def _locked(password: str | None, account_expires: str | None, today: date | None) -> bool | None:
|
||||
"""Locked when either says so, open when both say not, else unknown."""
|
||||
password_locked = None if password is None else password == "locked"
|
||||
password_locked = None if password is None else password == STATE_LOCKED
|
||||
expired = _expired(account_expires, today)
|
||||
if password_locked or expired:
|
||||
return True
|
||||
|
||||
Reference in new issue
Block a user