0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-19 09:51:19 +02:00

Fix config.getboolean

This commit is contained in:
FeliiiciaWen 2022-07-26 03:04:38 +08:00 committed by GitHub
parent 943f1e14e2
commit 544ccb4b2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,22 +19,22 @@ def doAuth(pamh):
# Abort if Howdy is disabled
if config.getboolean("core", "disabled"):
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Howdy is disabled."))
return pamh.PAM_AUTHINFO_UNAVAIL
# Abort if we're in a remote SSH env
if config.getboolean("core", "ignore_ssh"):
if config.getboolean("core", "abort_if_ssh"):
if "SSH_CONNECTION" in os.environ or "SSH_CLIENT" in os.environ or "SSHD_OPTS" in os.environ:
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Howdy is disabled in ssh."))
return pamh.PAM_AUTHINFO_UNAVAIL
# Abort if lid is closed
if config.getboolean("core", "ignore_closed_lid"):
if config.getboolean("core", "abort_if_lid_closed"):
if any("closed" in open(f).read() for f in glob.glob("/proc/acpi/button/lid/*/state")):
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "LID is closed."))
return pamh.PAM_AUTHINFO_UNAVAIL
# Abort if the video device does not exist
if not os.path.exists(config.get("video", "device_path")):
if config.getboolean("video", "warn_no_device"):
print("Camera path is not configured correctly, please edit the 'device_path' config value.")
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Camera path is not configured correctly, please edit the 'device_path' config value."))
return pamh.PAM_AUTHINFO_UNAVAIL
# Set up syslog