Description
In PasswHardening.passwd_aging_expire_modify(), a spurious error is always logged to
syslog on every invocation — even when chage executes successfully.
Steps to reproduce
- Configure password hardening policy with expiration days in CONFIG_DB
- Observe syslog output
Actual behavior
Syslog always contains the following error regardless of whether chage succeeded:
Suggested fix
Replace Popen + poll() with wait() to block until the child process exits, then
check the actual return code:
chage_p_m = subprocess.Popen(
('chage', chage_flag + str(curr_expiration), normal_account),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
chage_p_m.wait()
return_code_chage_p_m = chage_p_m.returncode
if return_code_chage_p_m != 0:
syslog.syslog(syslog.LOG_ERR, "failed: return code - {}".format(return_code_chage_p_m))
Description
In
PasswHardening.passwd_aging_expire_modify(), a spurious error is always logged tosyslog on every invocation — even when
chageexecutes successfully.Steps to reproduce
Actual behavior
Syslog always contains the following error regardless of whether
chagesucceeded:Suggested fix
Replace
Popen+poll()withwait()to block until the child process exits, thencheck the actual return code: